Category pages 404 on live but OK on localhost

I have a website with some pages and some blog posts. Posts are assigned one or more categories. This has been running fine live on Cloudflare for several years.

Recently, all the category pages, e.g. https://www.attractmore.uk/categories/sustainability/ return 404 on live. When I build the site locally, all is fine and the category pages correctly show a list of all posts in that category.

So, my immediate thought was that there must be some difference in the build environment on live vs. test and there is, but it’s very minor.

Both environments are running HUGO 0.148.2, but locally I have Node 24.7.0 and Go 1.24.0 (according to hugo env command). Cloudflare has Node 22.16.0 and Go 1.24.3

Could these differences explain the problem I’m having??

Any suggestions around this would be very gratefully received!

Repo below.

Thanks

hugo server

WARN  found no layout file for "html" for kind "term": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

You need to add a term.html file inside /layouts/categories/. Hugo implemented a new template system in v0.146.0. New template system in Hugo v0.146.0 and one change is that you need individual taxonomy.html and term.html files to render /categories/ and categories/sustainability/ respectively. Check what changed and adjust your templates accordingly.

1 Like

Hi @tifenak . Thank you - I wasn’t aware of that change at all. I’m still confused though about why my code works on localhost when the build uses HUGO 0.148.2. Any ideas?

Roger

I guess that you didn’t clean out your public directory before running Hugo locally.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.