URL collision detection

Currently, if there are two pages that share the exact same URL (one via folder structure, and the other via slug or url param in frontmatter, Hugo will simply build sequentially and overwrite the previously build page with the latest.

Is there a way to tell Hugo to error out if it detects a URL naming collision instead of overwriting?

hugo --printPathWarnings --panicOnWarning

If you always want these option you can set up a alias for it in your shell.

4 Likes

Thank you for this. For some reason I never thought about combining these flags.

This is great. My only problem is that I have a few warnings that arise which I can safely ignore, and don’t want to trigger a panic. Is there any way of “having my cake and eating it too”?

As it’s not directly related, I opened a different topic, but here’s an explanation of the warning I’m currently getting: Warning triggered by "File.TranslationBaseName" in "where" query