Hey all,
Apologies in advance for the long post, and also if this issue has already been discussed, but I have been unable to find any help on this yet!
**The issue: **
preserveTaxonomyNames seems to be sporadic; that is, it’s only working on some pages, and not in others. For no reason?
The code and background
Our category params in our blog have been humanised, but there are some terms that have to be in their original format (i.e. SIM rather than Sim).
We have this little snip of code that loops through our cats, compares them to the JSON list of terms (called Site.Data.ignoreformats) we want excluded, and then humanizes them (if they don’t match any terms in the JSON).
This code has also been applied to Tags, and the tags work perfectly.
{{ .Scratch.Set "dontHumanizeCats" (intersect .Params.categories $.Site.Data.ignoreformats) }}
{{ if .Params.categories }}
<p class="screen-reader-only">Categories</p>
<ul class="categories txt--caption">
{{ range .Params.categories }}
<li class="categories__item">
<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}" class="categories__link">
{{ $tag:= . }}
{{ $dnhumanize:= $.Scratch.Get "dontHumanizeCats" }}
{{ with not (in $dnhumanize . ) }}
{{ else }}
{{- . -}}
{{ end }}
{{ with (in $dnhumanize . ) }}
{{ else }}
{{ . | humanize }}
{{ end }}
</a>
</li>
{{ end }}
</ul>
{{ end }}
We’ve set preserveTaxonomyNames = true
in our config.
The result
A category in one page (rendering not being applied):
- Ios
The same category in another page (rendering working!):
- iOS
I’ve found that by removing the space between the equal sign and true seems to work sometimes, but then, once it’s working, it will suddenly stop working for no reason (i.e. no code changes made).
Does anyone have any experience with this sort of issue?
Or is there a known bug with preserveTaxonomyNames?