nikOx
1
Hi.
I have structure:
content
–catalog
----_index.md
----subcatalog1
------_index.md
------product1.md
------product2.md
----subcatalog2
------_index.md
------product2.md
I added tags to subcatalog1/_index.md, subcatalog2/_index.md
tags: [‘tag1’]…
How to display them on catalog/_index.md?
ju52
2
Add tags to your config
[taxonomies]
tag = "tags"
and put this into your index-template
{{range site.Taxonomies.tags.Alphabetical -}}
<a href={{ .Page.RelPermalink }} >{{.Page.Title}}</a>
{{- end}}
1 Like
nikOx
3
Thanks.
But I want use taxonomy for filtration on each section and filter only this section:
catalog/tagname
–subcatalog1/tagname
–subcatalog2/tagname
Is it possible?
ju52
4
if you have only two sections - there is an easy way, take different tags
[taxonomies]
tag = "tags"
tag1 = "tag1s"
tag2 = "tag2s"
1 Like
nikOx
5
Thanks. But I have many nested sections. And tags which used in sections (subcatalogX/_index.md) does`t show
I tried to create filter page
catalog/filter.md
And use separate layout with “where” filter for them to display sections :
but
I have error
Failed to render pages: render of “page” failed: “C:\projects\testsite\layouts\list\testlist.html:4:12”: execute of template failed: template: list\test.html:4:12: executing “content” at <$ps.Pages>: error calling Pages: runtime error: invalid memory address or nil pointer dereference
I use this layout
{{ $ps := .Paginate .Sections }}
{{ range $ps.Pages }}
{{ .Title }}
{{ end }}
This template works with _index.md, but not works with test.md -
Can I create separate list page for sections filtration?
nikOx
6
Yeahh… I did it what I want!
I created -
catalog/filtername/_index.md
{{ $ps := .Paginate .Parent.Sections }}
{{ range where $ps.Pages “Params.test” “test” }}
{{ .Title }}
{{ end }}
Now I can filter every level with level`s own params
ju52
7
perfect
you can try
{{ range where $ps.Pages “CurrentSection” “test” }}
to drop the test parameter