Values being lowercased?

I’m trying to use hugo to build up a corpus of recipes. Here’s an example recipe:

name: Tom Collins
   Club Soda: 4oz
   Gin: 2oz
   Lemon Juice: 1oz
   Simple Syrup: 1tsp

Here’s the template fragment to render it:

<h1><a href="{{ .RelPermalink }}">{{ }}</a></h1>

{{ range $ingr, $amount := .Params.ingredients }}
   <li>{{ $amount }} {{ $ingr }}</li>
{{ end }}

Bizarrely, when it is rendered, the ingredients get lowercased:

                     <h1><a href="/cocktails/drinks/tom-collins/">Tom Collins</a></h1>


   <li>4oz club soda</li>

   <li>2oz gin</li>

   <li>1oz lemon juice</li>

   <li>1tsp simple syrup</li>


Is there something about dictionaries in hugo that force them to be lowercased? Is there a way for me to opt out of this behavior, other than finding the relevant code, replacing it, and having a fork of hugo?

try his way - hope this helps

preserveTaxonomyNames: true seemed to have no effect. The title function works, but is sortav a hack (since I really just want to leave the data alone, not lowercase then title case.) I’m ok with the title function though.

Does hugo lowercase all data by default or something? These aren’t even configured as a taxonomy field

This could have something to do with that (I’m speculating only):

Page-level .Params are only accessible in lowercase.

You could reorganise your ingredients like

  - ingredient: Club Soda
    amount: 4oz
  - ingredient: Gin
    amount: 2oz
  - ingredient: Lemon Juice
    amount: 1oz
  - ingredient: Simple Syrup
    amount: 1tsp


{{ range .Params.ingredients }}
 {{ .ingredient }} {{ .amount }}
{{ end }}

should keep the original casing

1 Like