So the title may be confusing, but I’ll try to explain it the best way that I can.
Goal:
I’m trying to access front-matter in /content/<PARENT DIRECTORY>/<TAXONOMY>/<TERM>/_index.md
and have it still render a list for all items with that and preferably without the content files not in that sub directory - strictly use it for front-matter.
In my config I have…
[taxonomies]
"partners/tag" = "partners/tags"
"partners/category" = "partners/categories"
My content structure
content
|__ partners
|__ _index.md
|__ partner1.md
|__ partner2.md
|__ partner3.md
Let’s say partner1.md
& partner2.md
have Front-matter:
partners/categories: [
"cat1"
]
The layout structure
layouts
|__ partners
|__ list.html
|__ li.html
|__ single.html
List renders li using…
{{ range $index, $page := (.Paginate (where .Data.Pages "Type" "partners") 20).Pages }}
{{ .Render "li" }}
{{ end }}
Everything up to this point renders and works as it should, specifically, the listing of the category terms.
But now I need the taxonomy categories to have it’s own layout - I’m choosing not to use the _default directory since I need multiple taxonomy layouts.
So I created…
taxonomy
|__ partners
|__ category.html
Everything still works. I see partner1.md
& partner2.md
on /partners/categories/cat1/
with the layout that I want. But now I need to declare some front matter to the list for some styling changes.
So I added…
content
|__ partners
|__ categories
|__ cat1
|__ _index.md
This is where things break. Once I add _index.md
I no longer see partner1.md
or partner2.md
in the list rendering – it’s blank… But I’m able to access the front matter I want. So then I moved partner1 & 2 to the cat1 directory which renders them in the list, but then it is no longer visible in /partners/
listing page.
Is there some catch-all I can use on range $index, $page := (.Paginate (where .Data.Pages "Type" "partners") 20).Pages
to render all the content files even those within a sub directory?
Or maybe I’m approaching this wrong?