Configure a custom sidebar link to open in a new tab

I too have external_links_in_new_tab set true, which is appropriate for pdfs and most external links. But I want to integrate the forum seamlessly with the main site, which has a link back to the forum.

That’s just not possible if the sidebar opens the main site in a new tab.

Is there any path if I go to Marketplace? What would I ask for?

1 Like

I ended up adding this to my custom JS:

  const MAIN_SITE = "https://www.main-site.com";

  api.onPageChange(() => {
    requestAnimationFrame(() => {
      document
        .querySelectorAll(`.sidebar-wrapper a[href^="${MAIN_SITE}"]`)
        .forEach((a) => {
          a.removeAttribute("target");
          a.removeAttribute("rel");
        });
    });
  });
1 Like