After 'hugo server' I get 404 unless I re-save a file

Hugo 0.55.6-A5D4C82D linux/386

This is truly odd. Started up a new site locally, things were working fine for awhile. But now all pages (except for a bare home page) go 404 until I re-save them, including posts. I really don’t understand what changed…

I have closed my terminal window and re-opened it just to make sure but it resolved nothing.

Any ideas?

when using just ‘hugo’ to build the public folder, that folder does not contain any posts.

UPDATE: removing an ‘index.md’ file from the root content directory fixed some things. But now my blog posts show on the home page. I need to specify a different page for my home page. Searching for that answer now…

We’re in the dark. But if you share your code, we can try to help.

Which code? All I can tell you is that I’m using the Indigo theme. I guess I should just delete everything and start over. I can’t remember what I’ve changed.

I keep forgetting this is truly not designed for end-users.

Please see requesting help.

yeah, this site isn’t up on any repo yet, just on my local machine. I think I got it back to where it was before I screwed something up. I really do need to dive deeper into the docs re: the processing order. That part’s not firmly in my mind yet, and this theme is more bare-bones than the others I’ve used.

Marking this as solved, although it’s not really much of a solution to say “just start over from scratch” – but that is how I solved this particular issue. I should have just done that first as this issue doesn’t meet the basic criteria in the ‘requesting help’ FAQ section.

Hi @dixonge - hard to say what caused your 404. I have seen that when I had enabled gitinfo in the config, but hadn’t yet committed the project to git. Another time was, I changed how the permalinks were being generated in config.toml, and that caused trouble. I got a bunch of 404s because my links all got broken and were kind of half cached. Restarting hugo and the browser fixed that particular one. It’s just hard to say what happened on your machine, though.

Sometimes, posts/pages won’t show or be generated, if draft is set to true, in frontmatter.

As for index.md vs _index.md please see:

As for sharing your code, besides a git repo, you can also zip your project up and share it via Google Drive or Dropbox etc, if you are not used to git yet. The point being, it’s simple for anyone to run hugo server on an already built project, than it is to try to recreate by guessing.

Also you can use the verbose switch to get more info, like:

 hugo server --verbose

In the end, I just switched away from that particular theme. I then spent a few days (again) exploring alternatives to Hugo. The problem isn’t Hugo, it’s the lack of theming standards which kills portability. Once you have a certain set of front matter, switching it over to another set of parameters is a big pain. This is why I now have a lot of posts with more front matter than content. Well, that, plus trying to do a WordPress export from a highly-‘indiewebified’ WordPress theme/install. I’m drowning in metadata.

Any way, going back to casper-two theme resolved most of the 404/error page issues.

For anyone that still face this issue and got here from google:
Solution to this issue is renaming top level index.md to _index.md: