preserveTaxonomyNames being sporadic?

#1

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?

#2

Please read Requesting Help and share a repo that we can clone and reproduce your issue.

#3

Thanks! Will do!

#4

I don’t know the solution to your question, but whatever the solution is, it probably does not involve preserveTaxonomyNames because that has been deprecated. I asked about deprecated things in general in this question:

I’m still interested in the answer to my question. And your question too!

#5

Deprecated means slated for removal, and that has to do with command-line arguments. The config option is valid.

This topic is not related to the command-line arguments. We need to wait for @eve_crabb to share the code, and then we can troubleshoot. :slight_smile: