HUGO

Ignore case sensitivity "where" slice / force caps sensitivity for taxonomies

Hi,

is it possible to ignore case sensitivity for a slice like this one with the “where” op?

{{ $activeComponentIssues := where $active "Params.affected" "intersect" (slice .name) }}

Full file/context: cstate/components.html at master · cstate/cstate · GitHub

What that highlighted line is supposed to do is get posts that:

  • have a position boolean (affected: true)
  • and see if there is a match of the category in that kind of file

If not, is there a case sensitivity config option for taxonomies specifically or something?

Thanks so much!

Do you think the lower function might help? I am having problems understanding a concrete case, but if you lowercase two parameters that get compared it might help?

And no, there is no such config option that lowercases everything that I know of… would be nice for simple compares.

{{ $set := slice "Apple" "Banana" "Peach" }}
{{ $item := "aPPlE" }}
{{ if in (apply $set "lower" "." ) (lower $item) }}
  <p>"apple" is in ["apple", "banana", "peach"]</p>
{{ end }}
1 Like

This is outside the scope of this support issue, but perhaps there should be a feature request for it? You can make APIs with Hugo, this would be useful for some

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.