Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation inaccurate about .Pages on homepage #6510

Closed
look opened this issue Nov 17, 2019 · 1 comment
Closed

Documentation inaccurate about .Pages on homepage #6510

look opened this issue Nov 17, 2019 · 1 comment
Labels

Comments

@look
Copy link
Contributor

look commented Nov 17, 2019

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.60.0-DEV darwin/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

I'm using a pre-release build, but this is also present with the released version, hugo 0.59.


In the documentation, it says that:

.Pages on the Homepage

In addition to the standard page variables, the homepage template has access to all site content via .Pages.

However, I'm not seeing this. I have this template:

{{ range .Pages }}
  {{ . }} <br>
  Kind: {{ .Kind }} <br>
  Type: {{ .Type }} <br>
{{ end }}

And the output shows only my top-level section pages:

Page(/posts)
Kind: section
Type: posts
Page(/pages)
Kind: section
Type: pages

If I use .Site.Pages I get all the pages on the site. I ended up adjusting my template like this to get just the posts:

{{ range where .Pages "Section" "posts" }}
  {{ range first 10 .Pages }}
    {{ . }} <br>
    Kind: {{ .Kind }} <br>
    Type: {{ .Type }} <br>
  {{ end }}
{{ end }}

I'm not sure if this is a bug in Hugo or the documentation.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant