Page.Pages no longer returning data

Content Directory


And the following layout structure in the theme


index.html.html is the homepage which should render the various pages from /homepage and blog/list.html should obviously list the blog posts.

The problem is .Pages is returning empty in both template files. I should be able to do:

{{ range .Pages }}
    {{ .Title }} - {{ .Summary }}
{{ end }}

But I am having to do {{ $pages := .Site.RegularPages "Section" "blog" }} to actually get data.

I can’t figure out why .Pages is returning empty

Your title implies it had worked before.
So what did you change?

Might be a context problem or …
Hard to guess without sources of and your layout files.

Maybe sharing the repo might help us

Here’s a link to the repo. Yes, things have changed - previously we had hardcoded a lot of the homepage into the theme. We are now trying to abstract all the content out and into a better structure. Previously, there was no in content/ (or in blog/, or modules).

In your site config…

  tag: ""
  category: ""

Don’t do that. It causes indeterminate output due to page collisions when using v0.122.0 and earlier. I have no idea what problems this might cause with v0.123.0 and later… just don’t do it.

If you don’t want to render taxonomy or term pages, do this in your site configuration:

  - taxonomy
  - term

But you’ve got other problems too… lots of page collisions.

hugo --printPathWarnings

WARN Duplicate target paths: /chat/index.html (2), /chat/index.xml (2), /demo/index.html (2), /demo/index.xml (2), /donate/cancel/index.html (2), /donate/index.html (2), /donate/index.xml (2), /foundation/index.html (2), /foundation/index.xml (2), /general-survey-follow-up/index.html (2), /general-survey-follow-up/index.xml (2), /privacy/index.html (2), /privacy/index.xml (2), /year-in-review/index.html (2), /year-in-review/index.xml (2), /year-in-review/year_in_review.png (2), give/index.html (2)

For example, the first collision (chat) occurs because you have set url: chat in front matter in two different content pages.

This is a bit of a mess.

The disableKinds suggestion seems to have done the trick.

I know it’s a mess - it was a combination of not understanding Hugo very well and taking shortcuts. I’ll get it sorted though!

Edit - content/post isn’t actually in production right now, this was more trialing of organization that shouldn’t have been committed yet but slipped through while trying to get this branch up so there was a reference while asking this question.

Thank you for the assistance.

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