"hugo server" serves content pages, but "hugo" (build) doesn't build them

Here’s my directory structure:

  • content/index.html
  • content/contact/index.html
  • layouts/_default/baseof.html
  • layouts/_default/single.html

single.html consists of simply:

{{ define "main" }}
  {{ .Content }}
{{ end }}

Both /index.html and /contact/index.html work when I’m running hugo server, but when I actually build the site (or netlify builds it, where I’m hosting), it only builds the index. This is a simple setup – I’ve even copied the hugoBasicExample repo and it’s behaving the same way, the content page (about.md) doesn’t get built. I’m on macOS using Hugo 0.52, I’ve tried on Netlify with both .50 and .52. What am I doing wrong?

While I have anyone that can help, I have one other semantic question. How do we refer to “standalone pages” in Hugo? The docs are somewhat overwhelming when it comes to layouts, singles vs lists, and content types like posts, but there’s no super clear definition of just a “single page type”, at least to my eyes.

Please read and follow the advice at Requesting Help, and share a project with us. We can’t figure it out unless we can see the site, and the easiest way to get online volunteers to help you is to make it easy to clone the project. If you can’t share your project, create a testing project that reproduces the issue.

In CMS verbiage a “post” is often a chronological significant piece of content, and the entire system is geared towards that. And then they make a “page” type separate. In Hugo, all single pages are the same, it is up to your templates to connect them in a meaningful way (such as linking to the “next” post in time, for instance).

So your latest blog post and your about page and your landing page are all the “page” kind. You can see them all at Section page templates | Hugo.

For something like a paginated archive page of posts, those are listings, and that is the main concern: single and lists templates. :slight_smile:

Thanks for the notes, “Page Kinds” is helpful and I must have blown past it. I included a link to a sample repo where the issue is occurring as described. I believe the issue is somehow related to layout files, so I’m continuing to barrel through. It would be nice for someone like me (a lot of experience with Jekyll and other static site generators) to be able to see a repo that has several static pages along with more traditional (n-number) content types like blog posts, products, or widgets.

The only link I see is GitHub - gohugoio/hugoBasicExample: Example site to use with Hugo & Hugo Themes. Are you saying there is an error in the example repo? Because that repo is for theme developers to build against as a checklist, and from the description of your original post, you are using custom layouts or a theme.

I’m confused, so before proceeding, please read that requesting help link and share your site project, or a project that reproduces the issue. That example repo is just content, it can not reproduce a template error.

It looks like the repo I linked to doesn’t work out of the box without installing an additional theme. I didn’t realize that, I was thinking it was a self contained repo that would build as-is, like a little “hello world” example site for Hugo.

My problem is/was related. By having a content/index.html file present (as opposed to layout/index.html), my sub-pages are rendering during hugo server but not during hugo. Dropping content/index.html and simply moving that markup into layout/index.html for the home page resolves the issue, the site is rendering the home page and other pages during both hugo server and the full site build.

The theme has a section on usage, and if you need a theme to test, we also have a directory of those. The benefit of this set up is you can follow the instructions for a theme with that content repo, and then compare it to the demo page for any given theme, and see how they compare (presumably they will be similar!).

I don’t use Jekyll, so I’m reaching here: in the Hugo support forums we need code to troubleshoot. Sometimes we don’t, but 90% we do, and anything else is just guessing. There is no Hugo internals that is causing your issue, it’s templates all the way down.

I thought we could knock this out, but I’m out of energy. My suggestion is to create a test project in a public repo and try things out there so you can easily point out what you are doing when seeking assistance. :slight_smile:

I’m fairly active on stackoverflow and such and completely understand needing to provide a full example along with a clear question. I had hoped that by keeping the folder structure as lean as possible in my original post, it would allow someone with more experience to see where I stumbled. Good to know that it’s really about templates all the way down – that was where my problem lied! I posted above about it – it’s all working now by removing content/index.html and using a home page layout. Thanks again for your help!