Content Doesn't Render Until Change

I’m just getting started with Hugo so sorry if I’m missing something simple. I’ve been through the docs multiple times and I haven’t had any luck reading through the posts here.

Here’s the problem - When I create a new content file (other than content/index.md) and run the server navigating to the page gives a 404 until a change is made to the file, after that it renders just find.

I’m using version 0.38.2 and I’ve tested on both Mac and Linux with the same results. Here are the steps to reproduces.

  1. Run “hugo new site testhugo” and “cd testhugo”.
  2. Clone the hogo-bootstrap them into the themes directory.
  3. Run “hugo new index.md” and “hugo new test.md”.
  4. Edit both index.md and test.md and add some text.
  5. Run “hugo server -t hugo-bootstrap -D”
  6. Navigate to “http://localhost:1313/” and the content in index.md shows up just fine.
  7. Navigate to the “/test/” page and I get a 404.
  8. Edit test.md and save the file.
  9. Navigate to the “/test/” page and now the content in test.md shows up just fine.

I’ve tried all kinds of command line options, etc. with no luck so I’m assuming I’m just missing something simple.

Does the issue go away with --disableFastRender switch added to hugo server?

No, same behavior. I’ve tried that switch as well as --ignoreCache and --gc.

In Development Mode I use --noHTTPCache as well:

HUGO_ENV=development Hugo server -d ./build/dev -D -F --navigateToChanged --noHTTPCache

In this command Hugo starts with the environment “development”, writes dev files to disk, shows Drafts and Futures, navigates to the changed page and disables the HTTP-Cache in the Browser.

Of course you can use --disableFastRender in addition.

Hope this helps.

Thanks for the suggestion Leo but unfortunately it displayed the same behavior I’ve been seeing. The specific command that I ran was:

HUGO_ENV=development hugo server -d ./build/dev -t hugo-bootstrap -D -F --navigateToChanged --noHTTPCache

I also forgot to mention that I’m seeing the same behavior when I try to generate the static site (not running the server) - the only page that’s generated in the homepage.

Hmmm that‘s wierd. I‘ll try on my Mac and let you know.

I finally figured it out. The problem was that my homepage content was in content/index.md instead of content/_index.md. Kinda wish that was more obvious in the docs.

Thanks to the folks that responded with suggestions!

3 Likes