# Hyperlink on menu item

**URL:** <https://community.pickaxe.co/t/hyperlink-on-menu-item/8489>\
**Category:** General\
**Created:** [April 29, 2026, 12:32pm UTC](https://community.pickaxe.co/t/hyperlink-on-menu-item/8489 "2026-04-29T12:32:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![user40](https://avatars.discourse-cdn.com/v4/letter/u/c67d28/32.png) [@user40](https://community.pickaxe.co/u/user40)\
**Post date:** [April 29, 2026, 12:32pm UTC](https://community.pickaxe.co/t/hyperlink-on-menu-item/8489/1 "2026-04-29T12:32:39Z")

</div>

Before the new portal experience I was able to use code listed below to make a menu item just a hyperlink to an outside url. That stopped working and I had to put that into a page witht eh hyperlink so I now have to click on it twice. now that things have settled down is there a way to just make a menu item on the navigation bar a hyper link that can go direclty to an ootuside URL

Code I was using:

(() =\> { // IMPORTANT Edit this to the URL you want the button to redirect to const TARGET\_URL = "https://example.com"; // CSS selector const SIDEBAR\_SELECTOR = "body"; // leave as body if unsure // IMPORTANT Text label of the button you want to change (case-sensitive exact match after trimming) const BUTTON\_LABEL = "hyperlink"; // Handler: find matching button(s) and attach a click handler that redirects function attachRedirectHandlers(root = document) { const buttons = Array.from(root.querySelectorAll("button")); buttons.forEach((btn) =\> { // skip buttons already processed if (btn.dataset.redirectAttached === "1") return; const label = (btn.textContent || "").trim(); if (label === BUTTON\_LABEL) { // capture the click early, stop other handlers, and redirect btn.addEventListener( "click", (e) =\> { e.preventDefault(); e.stopImmediatePropagation(); // Optional: small delay so any UI effects complete, remove if you want immediate redirect window.location.href = TARGET\_URL; }, { capture: true } ); // mark processed so we don't attach twice btn.dataset.redirectAttached = "1"; // optionally change cursor to indicate a link btn.style.cursor = "pointer"; } }); } // Run once in case the element already exists attachRedirectHandlers(document);

---

<div class="post-metadata">

**Author:** ![danny\_support](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.pickaxe.co/danny_support/32/3492_2.png) [@danny\_support](https://community.pickaxe.co/u/danny_support)\
**Post date:** [May 5, 2026, 1:11am UTC](https://community.pickaxe.co/t/hyperlink-on-menu-item/8489/2 "2026-05-05T01:11:28Z")

</div>

Hi @user40 ,

Thank you for reaching out!

The reason the previous code stopped working is that this type of script usually targets specific page elements, classes, or selectors in the portal interface. Since the new portal experience changed parts of the page structure and styling, the old selectors likely no longer match the navigation item correctly.

Here is an updated script you can add to the Body custom code section of your workspace or portal:

```auto
<script>
(function () {
  const TARGET_LABEL = "this is a hyperlink";
  const REDIRECT_URL = "https://example.com";

  document.addEventListener(
    "click",
    function (event) {
      const button = event.target.closest("button");
      if (!button) return;

      const label = button.querySelector("p");
      if (!label) return;

      if (label.textContent.trim() === TARGET_LABEL) {
        event.preventDefault();
        event.stopPropagation();
        event.stopImmediatePropagation();

        window.location.href = REDIRECT_URL;
      }
    },
    true
  );
})();
</script>

```

Please replace TARGET\_LABEL with the exact name of the navigation/menu item you want to turn into a link.

Then replace [https://example.com](https://example.com) with the external URL you want users to be redirected to.

---

<div class="post-metadata">

**Author:** ![user40](https://avatars.discourse-cdn.com/v4/letter/u/c67d28/32.png) [@user40](https://community.pickaxe.co/u/user40)\
**Post date:** [May 5, 2026, 2:37pm UTC](https://community.pickaxe.co/t/hyperlink-on-menu-item/8489/3 "2026-05-05T14:37:49Z")

</div>

Danny, this worked like a charm - One other question, can you make the left hand menu bar sticky so it doesnt disappear - some of my users do not want it to go away

---

<div class="post-metadata">

**Author:** ![danny\_support](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.pickaxe.co/danny_support/32/3492_2.png) [@danny\_support](https://community.pickaxe.co/u/danny_support)\
**Post date:** [May 6, 2026, 8:35am UTC](https://community.pickaxe.co/t/hyperlink-on-menu-item/8489/4 "2026-05-06T08:35:08Z")

</div>

Hi @user40 ,

I shared the custom code for keeping the left-hand menu visible here:

> [@Keep menu visible](https://community.pickaxe.co/t/keep-menu-visible/8505/2):
>
> Hi @user40 , Thank you for reaching out! This can be done with custom code. Please add the script below to the Body custom code section of your workspace or portal. This should keep the left sidebar menu open after users select an Agent, select a content page, or click elsewhere on the page. \<script\> (() =\> { if (window.\_\_pickaxePinnedSidebar) return; window.\_\_pickaxePinnedSidebar = true; const DESKTOP\_QUERY = "(min-width: 860px)"; const SIDEBAR\_SELECTOR = "div.glass-dynamic.group.f…
