Configure a custom sidebar link to open in a new tab

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