Skip to main content
DannyPancratz
VIP ⭐️⭐️⭐️⭐️⭐️
May 30, 2023
Solved

Anchor Links on Customizable Pages

  • May 30, 2023
  • 7 replies
  • 153 views

Is there any way to do add an anchor link parameter (usually # and a keyword) to a URL on customizable landing pages: 

  • home
  • community overview
  • knowledge base overview
  • ideas
  • custom pages

I’d love if I could anchor a link to a specific widget lower down the page. 

    Best answer by lauro.lana

    Hey @DannyPancratz, so this should be possible with some JavaScript but it’s not so easy as I thought. I did some research and tried some scripts to this topic but with no success 😪

    If you can have assistance from a developer, you should be able to achieve this.

    7 replies

    lauro.lana
    Gainsight Employee ⭐️
    Gainsight Employee ⭐️
    May 30, 2023

    Hey @DannyPancratz, that’s a very cool idea if I understood correctly. I believe this might be possible with some JavaScript work.

    For example, you can customize single pages and also add new elements/functions. You can see I’ve changed your rank to the color red only to this topic:

     

    I imagine you probably already knew about this but the script I’ve made was to target only this topic:

    <script>
    const isPage = window.location.pathname === '/got-a-question-38/anchor-links-on-customizable-pages-5865';
     
    if (isPage) {
     const rank = document.querySelector(".qa-usertitle");
     
     rank.style.color = 'red';
    }
     
    </script>

    I’d love if I could anchor a link to a specific widget lower down the page. 

    Not sure exactly what you mean here, would this be an InSided widget? Are you looking for this link to make the user scroll down in the same page directly to the widget?

    If you are able to share screenshots/video or a website that already does this, I could see if this is possible. I believe it would be something like this:

    function scrollTo(hash) {
    location.hash = "#" + hash;
    }

    source: https://stackoverflow.com/questions/3163615/how-to-scroll-an-html-page-to-a-given-anchor 

    DannyPancratz
    VIP ⭐️⭐️⭐️⭐️⭐️
    May 31, 2023

     

    I’d love if I could anchor a link to a specific widget lower down the page. 

    Not sure exactly what you mean here, would this be an InSided widget? Are you looking for this link to make the user scroll down in the same page directly to the widget?

    If you are able to share screenshots/video or a website that already does this, I could see if this is possible. I believe it would be something like this:

    function scrollTo(hash) {
    location.hash = "#" + hash;
    }

    source: https://stackoverflow.com/questions/3163615/how-to-scroll-an-html-page-to-a-given-anchor 

     

    Thanks @leo-inspired, yes that’s the intended result: a URL parameter that auto scrolls down to a specific Insided lower on the page. It’s pretty common functionality I’ve seen on a lot of websites, usually tied to header text or specific widgets on how the page is built. 

    FYI: I am no longer active in this community
    lauro.lana
    Gainsight Employee ⭐️
    Gainsight Employee ⭐️
    June 1, 2023

    Hey @DannyPancratz, so this should be possible with some JavaScript but it’s not so easy as I thought. I did some research and tried some scripts to this topic but with no success 😪

    If you can have assistance from a developer, you should be able to achieve this.

    DannyPancratz
    VIP ⭐️⭐️⭐️⭐️⭐️
    June 1, 2023

    Thanks, @leo-inspired. I’ve reconsidered my use case so I don’t need it currently, but it’s good to know it’s technically possible with the right technical friends to help. 🙂

    FYI: I am no longer active in this community
    anirbandutta
    Expert ⭐️
    June 6, 2023

    Making a note here that I added ?UTM codes to a Custom page from the Featured content widget links which broke the links… did not work, the urls could not render as intended.

    It's an opportunity for engagement
    revote
    VIP ⭐️⭐️⭐️⭐️⭐️
    June 20, 2023

    What comes to anchor links, I would like to add link to external site, for example .com, what points to the community & custom page and certain place there.

    For example:

    I have Custom page where I have Banner Widgets 1 & 2 & 3. I want that users what are in .com, when they click link there, they are directed to the Custom page and to Banner Widget 2 content there. Not to top of the Custom page.

    I tested this today and it didnt work. After I have added HTML to the Banner Widget, platform removed it after I saved it.

    Is this something you are looking for as well @DannyPancratz

    DannyPancratz
    VIP ⭐️⭐️⭐️⭐️⭐️
    June 20, 2023

    yes, I think that’s also what i’m looking to do

    FYI: I am no longer active in this community