Incorrect Link URL to Post

Hi Guys,

I’ve just started trying out Hugo.

So far so good, except for 1 issue I’m having with trailing slashes (Lack of) to posts.

So generally, the generated URLs appear like “https://www.example.com/tags/” with a trailing slash.

However post URLs are appears like “https://www.example.com/2016/11/25/hello-world” without a trailing slash.

This wouldn’t be big deal, it just means an extra redirect to add the trailing slash, but the host is sending the redirect back to the origin site, and I am running Hugo over a CDN.

I haven’t got control over this setup.

Is it something I am doing incorrectly? Or is this just how Hugo likes to generate the links?

I even tried turning on Ugly URLs, but it doesn’t seem to affect the links to the posts.

And even if I could change the hosting… It still seems inefficient having to run a redirect every time a link is clicked?

Hi. There should be a trailing slash. Which version of Hugo are you running and what is the operating system?

Thanks. I’ve figured it out. Your confirmation that there shouldn’t be a trailing slash made me dig deeper. When I installed the theme, I copied the theme config over (as it suggested) and there was a permalink setting in there.

[permalinks]
post = “/:year/:month/:day/:slug”

I just commented this out and went with the default post format and it’s now got the trailing slash.

Thank you!

1 Like