Hugo does not render identical URLs with different letter case when disablePathToLower = true

Given disablePathToLower = true in env config.

And a Page Bundle with two similarly named files:

_PENTIUM.NFO.md
_pentium.nfo.md

Where each file includes an explicit url setting:

linktitle = "_pentium.nfo"
title = "_pentium.nfo"
url = "piracy/NFO/_pentium.nfo.html"
linktitle = "_PENTIUM.NFO"
title = "_PENTIUM.NFO"
url = "piracy/NFO/_PENTIUM.NFO.html"

Hugo does not render a page for _PENTIUM.NFO as expected and attempting to coerce page rendering using the render = true build option results in the same result.

Given disablePathToLower = true in config Hugo should render one page for each of _pentium.nfo.md and _PENTIUM.NFO.MD. Unexpected behavior exists for both hugo and hugo server commands. Tested with Hugo 0.70.

Hugo by default outputs HTML and an RSS feed.

Accepted content file formats are .md and .html

You probably need to create a Custom Output Format for .nfo. See:

P.S. The original topic title 404 errors with case-insensitive URLs seems irrelevant to the post above, so I renamed it.

Thanks for your reply.

Please note NFO files are linked from the HTML pages rendered by the markdown files mentioned in OP. The MIME type for those is text/plain backed by an HTML file as shown here. So long as the names aren’t the same from a case-insensitive standpoint the files render fine. However, I’d still expect hugo to render case-sensitive pages when disablePathToLower is enabled.

Oh I see, pardon the misunderstanding. I updated the topic title again.

So basically you are expecting to output both

piracy/NFO/_pentium.nfo.html
AND
piracy/NFO/_PENTIUM.NFO.html

WITH

disablePathToLower = true

You surely must be aware that search engine results are not case aware and your site would probably throw duplicate content warnings.

Regarding Hugo I am not in a position to know 100% but I wouldn’t be surprised if what you asked caused what is known as a race condition meaning Hugo wouldn’t know which page with the identical (yet with different case) URL would need to be rendered first.

That is for someone else to answer.

1 Like

Yes, that’s an excellent summary. I got lucky with the data set I’m working with (57,000 files) in that there are very few of the above scenarios present in the codebase. But it is a gotcha I wanted to call out here in case someone in the future has this same issue. Thanks again.