.Site.Pages doesn't list pages

I can’t figure out how to get a list of my pages. I must have something set up incorrectly but I don’t know what even after troubleshooting for hours.

Would someone be willing to help me troubleshoot?

Examples of pages that should create a list but end up with an empty .Site.Pages range:

Many thanks,

I don’t have time to test right now, but, I have seen a lot of posts on .Site.Pages vs .Site.RegularPages in here, so, you might search for that. Or, ask the theme author.

I looked at your source earlier and have a comment. You can override by making the same files as the theme, but a level up in the repo. The point being, you can commit those changes without it being troublesome, since the theme is often just fetched from git.

Hi Rick,

I wrote the theme in question and it worked a year ago. I really don’t know what changed. The .Site.Pages variable just doesn’t contain the pages from the posts directory, even though hugo does render the individual pages.

I have also tried a couple other themes from troubleshooting purposes and I get the same results.

Any other ideas,

Thanks for your help!

Oh, and I have searched quite a bit on the forum and haven’t seen anything that addresses what I’m seeing

“Ask the theme author” d’oh! Sorry about that.

There have been many changes to Hugo in the past year so, it feels like one of those broke it.

I looked at it, and I’m not seeing any errors out of hugo server --verbose but at the same time, looking at the source there is simply nothing showing up in the body, where it should be.

One thing I noticed, that is new but that you are not doing, is to use the “baseof” style. You might try re-factoring to use that, and see if it doesn’t help you.

I refactored the following site to use that method, after it was giving errors after upgrading Hugo.

The URL is http://live.cogley.info

I was able to fix it. I started from scratch, adding parts of the repo to the new site in little pieces, until I had the whole thing working.

I wish I could report back exactly what the problem was, but I still really don’t know. Even after comparing the differences between the working version and the non-working version, I couldn’t figure it out. Perhaps it’s because there are so many permutations of template precedence that I don’t always know which files hugo is using to generate a given file.

What I do think is that I must have had something messed up somewhere and hugo was silently choking on it. Would have been nice to get an error message.

Along the way, I refactored to use baseof as you suggested, and that is cleaner.

Thanks for your help Rick!

No prob. You might try the tricks here:

1 Like