Hello Community,
i am having a little trouble removing duplicates from a map (at least i think it’s a map?)
The core of my Problem comes down to the output of this example-code:
<ul>
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
<li><a href="{{ "/" | relLangURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a>
<ul>
{{ range $key, $value := $taxonomy }}
<li> {{ $key }} </li>
<ul>
{{ range $value.Pages | uniq }}
<li><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
{{ end }}
</ul>
{{ end }}
</ul>
</li>
{{ end }}
</ul>
This is from Taxonomy methods and this should output every Post exactly once sorted under the tags and the taxonomies…
However in my case every Post is in there two times like:
taxonomy-y:
tag-a:
- asdf
- asdf
- ghjk
- ghjk
tag-b:
- Lorem
- Lorem
- Ipsum
- Ipsum
taxonomy-x:
tag-42:
- Dolor
- Dolor
- Sit
- Sit
instead of the expected:
taxonomy-y:
tag-a:
- asdf
- ghjk
tag-b:
- Lorem
- Ipsum
taxonomy-x:
tag-42:
- Dolor
- Sit
Could this have to do something with the fact that i set permalinks for the taxonomies?
I tried to apply a solution like the one on Remove duplicates from Array? but no luck until now.
Info:
- hugo v0.82.0+extended darwin/amd64 BuildDate=unknown
- macOS 10.15.7