Pages visible in server but not generated

Hi, first post and pretty new to Hugo. I’ve been reading the docs and support forums but can’t figure this out.

I’m running into an issue where I’ve created sections with an _index.md that don’t get created as html under the public folder when running the hugo command. Only the main index.md gets turned into an index.html. All other pages are missing.

When running hugo server (both with and without the -D flag) it’s prints the stats and shows I have 12 pages. When accessing the local webserver the urls are not showing the pages but the generic 404 page. When pressing the save button (without any changes made to the file) the saved page loads instantly.

file structure looks like this

content\
  about\
     _index.md
  contact\
    _index.md
index.md

the _index.md files all look like this, where page_name is either about or contact:

---
title: "page_name"
draft: false
url: /page_name/
---
some lines of text
without specific markdown features
just plain text 

I’ve tried adding layout: page or layout: single to see if that resulted into the pages being generated into html but to no avail.

All the sections have been added to config.toml as follows (weight value differs per item):

[menu]
[[menu.main]]
  identifier = 'page_name'
  name = 'page_name''
  url = 'page_url'
  weight = '-90'

I’m probably doing something wrong or missing a configuration option but I’ve been trying to figure it out for a day or 2 and am running out of ideas. Thanks for taking a look at the issue!

Seems like you’re doing it the other way round.

content\
  about\
     index.md
  contact\
    index.md
  _index.md

should work. _index.md is required for a section, index.md for a normal page.

Read more about it here

1 Like

Thanks, that did the trick. I did read the page you linked but apparently completely misunderstood how it’s supposed to work. In my mind I was supposed to use _index.md for single pages in any section.

Much appreciated!

We’ve all been there.

1 Like

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