.Data.Pages vs. .Site.Pages

Continuing the discussion from .Data Variables not available in partial template:

The Variables docs don’t mention .Data.Pages - what’s the difference between .Data.Pages and .Sites.Pages? Should .Data.Pages ever be used?

.Site.Pages = All pages in site.
.Data.Pages = All pages in “selection”, used in taxonomies, sections etc.
.Paginator.Pages can also be used in place of .Data.Pages to enable pagination.

Hi

This is a very old post but I have exactly the same question.
Could you please be more precise about what “selection” mean ?

I do a loop such as:

{{ range $index, $element := where .XXXX.Pages "Section" "post" }}

If XXXX is Site, I obtain all posts in the post/ folder, plus an additional empty post (with title “Posts”).

If XXXX is Data I obtain only posts in the post/ folder that is what I want.

Thus where does this additional page with “Posts” title come from ?

Thanks

This is a 4 years old thread and Hugo has changed since then quite a lot.

Please have a look at the rewritten Pages Variables doc:

If you still have questions then please ask in a new topic.

Thank you.