Humanize function turns random strings to uppercase

Hi there,

running {{ humanize "random-strings-containing-the-word-des-inside" }} suprinsingly turn the word “des”, and only this one, into uppercase.

How to reproduce:

  • run hugo extended, version 0.115.4 or 0.104.3 (only these versions was tested)
  • put the following string in a template file: {{ humanize "random-strings-containing-the-word-des-inside" }}


Output is Random strings containing the word DES inside.
(See how the word “DES” is uppercase)

Expected result

Output should be Random strings containing the word des inside
(With the word “des” in lowercase)

humanize function using GitHub - gobuffalo/flect: An inflection engine for golang

the word “des” treated as acronym.

1 Like

Thanks a lot @pamubay!

With your help my issue was fixed by replacing

{{ humanize "random-strings-containing-the-word-des-inside" }}


{{ replace "random-strings-containing-the-word-des-inside" "-" " " | strings.FirstUpper }}

(Note to my future self: fixing uppercase stuff could also be handled with CSS)

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