Homepage Section Links Not Working from Other Pages


Hi Webflow Support, This is my first post here, and I’m having an issue with my site navigation links to homepage sections (like https://www.mahsanazari.com/).

On the homepage, these links usually work. Clicking them scrolls smoothly to the correct section. However, on other pages, clicking the same links either does not scroll to the section or sometimes shows a “Page not found” error.

Additionally, my homepage navigation (the logo at the top) has a simple page link to the homepage. Even when I’m on the homepage and click the logo, it shows this error: Page not found The page you are looking for doesn’t exist or has been moved.

Here’s what I’ve already tried:

Using links like #work or /#work→ works on homepage, but fails from other pages.
Using URLs like Home → still doesn’t scroll from other pages.
Adding custom JS scripts to detect hashes and scroll → nothing works reliably.
Checking my homepage slug → it’s empty (homepage is at root /).
Setting links as Page type in Webflow → still receives the same error from other pages.
Ensuring my logo links to the homepage correctly → did not fix the issue.

I’ve tried everything I can think of, but these section links still do not work reliably. I need them to work from any page, not just the homepage. I also don’t understand why my logo can’t link properly to the homepage..

I would really appreciate it if you could advise.

Thank you so much for your help!

Hello @Mahsa, welcome to the community!

I have tried your navbar links from your work pages and they are all working, also your logo is working as intended, did you fix your issue?

@pablo_cortes Thank you so much for getting back to me! No, I didn’t make any updates, it actually works on mobile but not on desktop. Did you try it on desktop?

Hello @Mahsa, I did try it on desktop, Chrome and Safari. Try testing in an incognito window, because the issue is coming from your browser, your links are set properly, I hope this helps.

@pablo_cortes Omg! That’s such a huge relief, you have no idea how many days I’ve been trying to fix this issue. Thank you so, so much!

1 Like

@Mahsa, The animation when navigating from an inner page to a homepage section needs to be fixed. Did you add the script yourself, or was it part of a pre-built template you used?

@ahmed_moeed No, I didn’t use a template. ChatGPT gave me the code. :sweat_smile: Could you please tell me how to fix it? Thank you so much!

@Mahsa

window.addEventListener(‘load’, () => {
const hash = window.location.hash;
if (hash) {
const target = document.querySelector(hash);
if (target) {
target.scrollIntoView({ behavior: ‘smooth’ });
}
}
});

Add the script below to the page that handles section animations.
This ensures that if the URL contains a hash (like #about or #contact), the page will automatically and smoothly scroll to that section after the window finishes loading.

@ahmed_moeed Thank you! I’m not sure where I should add this code. do you mean in the Page Settings under Custom Code? I just checked, and I actually deleted the code ChatGPT gave me, so there’s no code for my navigation right now.

  1. Go to the Edit Page Settings section.

  2. Scroll down to the bottom of the page.

  3. In the field labeled Before </body> tag, paste the code there.

    window.addEventListener(‘load’, () => {
    const hash = window.location.hash;
    if (hash) {
    const target = document.querySelector(hash);
    if (target) {
    target.scrollIntoView({ behavior: ‘smooth’ });
    }
    }
    });