I have the following two folders:
- content/guides/chapter-one
- content/guides/chapter-two
I want to write a partial that traverses content/guides
and creates a TOC like this:
- Chapter one
– first md file incontent/guides/chapter-one
– second md file incontent/guides/chapter-one
– etc. - Chapter two
– first md file incontent/guides/chapter-two
– second md file incontent/guides/chapter-two
– etc.
Every item in the above list would link to their corresponding .md file. That includes, “Chapter one” and “Chapter two” which serve as ‘homepages’ for each chapter and I am guessing they would need to be index.md files.
I am also aware I will need to use front matter to weight the individual files and control their order.
If someone could help me understand how I need to approach this to begin to bring it all together that would be very helpful. I think my file structure is the right way to approach it but I’m not really making progress.
As for the partial, I’ve played around with:
{{- range where .Site.RegularPages "Type" "guides" -}}
but can’t figure out how to traverse the files properly.
Thanks