Internal links redirects to website's entry page

Hi,

The internal links on my site (https://codesweetly.com/) redirect to the entry page—instead of the specified section of the same page.

For instance, suppose a user navigates from the homepage to CSS Unit – Explained with Examples | CodeSweetly. In that case, if the user clicks a link in the table of content, the site will navigate back to the homepage.

So, the server seems to read internal links as “initial-route-loaded/#internal-link”—instead of “current-route/#internal-link”.

BTW, this error happens only on the live site. The preview site works fine.

Any help in resolving this issue is greatly appreciated.

The Netlify site name is codesweetly.netlify.app

Thanks.

@oluwatobiss I’d imagine this has something to do with the router of the application itself, as anchor links don’t contact the server.

If you go to a page other than the entry page and instead of using the links provided set the anchor via your console (window.location.href += '#internal-link'), you will find that it jumps appropriately within the same page.

Thanks, @nathanmartin, for your help. Do you know if Netlify does cache a site? If so, how may I clear the cache on my site?

It depends on precisely what you mean by “cache a site”, but yes, Netlify does cache in a few ways.

There is the Build Cache.

Netlify also serve your site with specific Cache Headers.

Netlify also check the hashes of all the files within the output and only sync changes to the CDN, however that shouldn’t matter, as if “something hasn’t changed”, then it “hasn’t changed”.

Got it. Thanks a lot for your help.