Adding _index.md to sections removes their pages from section's .Data.Pages

Hey there, maybe someone has a quick answer to this.
This the folder structure under content

animals
-- dogs
---- _index.md
---- rotweiler.md
---- bulldog.md
-- cats
---- siames.md
---- ragdoll.md

If, from layout/animals/list.html I use range .Date.Pages only the markdown under cats will be included, those under dogs will not.

If I remove the _index.md from dog, then, its items are added to the range.

Anybody knows what I am doing wrong ?

  • Only the first level is auto-assigned a section
  • “dogs” is in its own section
  • “cats” is in the animals section
  • If you put an “_index.md” inside cats, that will also get its own section

If you put an “_index.md” inside cats, that will also get its own section

And so it is not a regular page anymore and out of .Data.Pages…

Thanks you answered my question! I have a follow up you might want to indulge with yourself or not :slight_smile:

does this mean my only alternative from within this template is
range where .Site.Pages "Type" "Animal"

or is there something better to do in order for me to range on every animals regardless of them being part of subsection or not?

1 Like