Content adapters: normalized paths

Hey folks,

In my hugo.yaml file I noted the configuration option
disablePathToLower: true

In my content folder I’m using the following _content.gotmpl structure:

{{ range $.Site.Data.pages }}
    {{ $page := dict
        "kind"      "page"
        "path"      .id
        "title"     .label
    }}
    {{
        $.AddPage $page
    }}
{{ end }}

The data source pages.yaml contains many records with the field of id set to a character string that contains upper and lower case characters.

However, on rendering, all resulting output file names in public are lowercased.

Am I setting the path portion of the page dictionary wrongly or is this a glitch that happens with the new Content Adapter feature?


Previously in this hugo project, I had used a nested Hugo projct to generade markdown files from the yaml data, and the resulting files names used to remain unchanged wrt character case.

I was so happy when Content Adapters were introduced, as they eliminate such a error-prone step in building the site, but I need to keep these URLs under control :slight_smile:

The path gets normalised, see Path | Hugo

You may want to look into the permalinks config and use something

Thank you @bep !
I was able to get the URLs I wanted by defining the slug key in the “virtual” front matter and using that for permalinks:

_content.gotmpl

{{ range $.Site.Data.pages }}
    {{ $page := dict
        "kind"      "page"
        "slug"      .id
        "title"     .label
    }}
    {{
        $.AddPage $page
    }}
{{ end }}

hugo.yaml

permalinks:
  page: 
    "/": "/:slug"

Funny enough, when using :filename, all pages are saved under _content.html :wink:

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