Hi!
This seems to be a problem with a specific Hugo setting.
On the menu of the site I see this link:
<a class="navigation-link" href="posts/">Blog</a>
That means it will be followed relative to the current page. So if you are on /projects/
, it will try going to /projects/posts/
.
For the link to work properly on any site it would need to look like this:
<a class="navigation-link" href="/posts/">Blog</a>
Notice the leading slash. That makes the URL “absolute”, meaning it will always be applied to the bare domain.
You might be seeing this just on Netlify, because we redirect /projects
to /projects/
which is to avoid having multiple paths with the same content.
It’s a general best-practice to have urls in global things (like in a menu or paths for assets) to be absolute.
How can you fix it?
I think it should be enough to have this setting in your config.toml
file:
baseurl = "/"
This should make Hugo generate the correct permalinks.
How can you verify locally?
Instead of using “serve” mode, you can use hugo build
to replicate what’s happening in the Netlify build process. You can open the files that pop up locally to check if the links are correct.