Links to different page parts

Reporting back on the solution I just found. The origin of the problem was that I entered some really nice custom Javascript code from this forum post, as a privacy and security measure: Add rel =“noreferrer noopener” to external links by default as a privacy & security measure

It included this line of code, which will open all links in a new tab:
//post_links[i].target = "_blank";

So I modified the code to execute that line ONLY for links external to write.as/writeas.com. Now links to internal parts of a blog page work fine (staying within the page) while still having protection when navigating to external sites (which continue to open in a new page).

h = post_links[i].href;
if (!h.includes("write.as") && !h.includes("writeas.com") {
  post_links[i].target = "_blank";
}
1 Like