פתח קישורים פנימיים באותה לשונית דפדפן

What’s the best way to do this Rafael?

I tried using:

<script type="text/discourse-plugin" version="0.8.42">
	api.decorateCookedElement(
	  element => {
	    const tags = element.querySelectorAll('.hashtag');

	    tags.forEach(function(tag) {
				if (tag.hasAttribute('href')) {
					if (tag.href.includes("site.com/tag/")) {
						tag.href = tag.href.replace("site.com/tag/", "newsite.com/")
						tag.setAttribute("target", "_self");
					}
				}
	    });
    },
	  {
	    onlyStream: true
	  }
	);
</script>

and while:

tag.setAttribute("target", "_self");

sets the attribute it doesn’t not have any impact, with links opening in a new tab as normal.

I guess I need to use something other than api.decorateCookedElement?