I’ve been looking for a way to range the tags used on the pages within a given section.
So for section food
| content
| | food
I want to range only the tags used in /food/
.
I know this will range all tags, but could I possibly add a filter for those of a specific section?
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
<a href="{{ .Permalink }}">{{ $name }}</a>
{{ end }}
I have done similar using {{range where}} you can then tell it what to range over. Look through your front matter say under title and probably use a custom tag as well I’d bet.
zwbetz
December 20, 2018, 3:12am
3
@theverylastjuan Try placing your template under a folder that has the same name as the section. For example:
layouts/food/list.html
(Note, this is untested)
ohlser
January 22, 2019, 8:24pm
4
Hi there, did you ever get this to work? I’ve been on this for the past hours.
I’ve come this far:
{{ range $taxonomyname , $taxonomy := .Site.Taxonomies.tags }}
{{ range where .Pages "Type" "blogg" }}
<li><a href="{{ "/tags/" | relLangURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a>
{{ end }}
{{ end }}
There must be some better way to do this? In the above example i am getting duplicates for every tag…