[SOLVED] Tag list pages work locally but are 404 in production

#1

I have a blog with the Cactus theme and I recently added tags to all my posts. When I serve my site locally with hugo serve, everything works fine. But when I deploy to production (site is hosted in Github pages) all tag related URLs (/tags and /tags/<example>) return a 404. Any idea of where should I start looking in order to fix that?

Thanks!

#2

Might have to do with your baseURL in the config.toml. You can look at the source of the page that links to those addresses that give 404s in a web browser on github pages. See what hugo is setting for a URL for those links. That should make it clear. If the URL seems appropriate and the files/directory structure isn’t there, that’s some other problem. You can also do the hugo build command hugo and look at the output of the public directory that gets created. The URL you inspected in the viewsource before in the browser should match (relatively) the structure of the public folder. If there is a mismatch that’ll tell you where the problem is.

#3

Look at the output of however you are building it. It should show you how the site is being built at deployment.

Just guessing: are the changes you made to your templates at the correct place in the template lookup order? Are you editing a copy of the theme that isn’t being used for deployment?

Please read Requesting Help and share more and you’ll get help. :slight_smile:

#4

Thank you guys, I’ve been following your advice and double-checking every step. I’ve executed my deploy script step by step and I realized what the issue was. It ended up being nothing related to Hugo. My global .gitignore included tags! So, of course, they worked locally because they were correctly generated but they never made it to my gh-pages branch! :man_facepalming:

Thanks again and sorry for the inconveniences!

2 Likes