Front matter URL: two dashes get parsed into one -


I discovered the following problem:
In my front matter I define a URL, let’s say:

url: my--test

What I would expect from to be the output of this would be a file called “my–test.html”.
Surprisingly the output is: "my**-**test.html.
Two dashes get turned into one, which is not what I would expect and need.
How I can prevent this from happening?

I run Hugo at version:
Hugo Static Site Generator v0.54.0/extended windows/amd64
and configured it to use

canonifyURLs: true

Thanks for your help and best wishes,

1 Like

This looks like a bug. I can reproduce with 0.55.5

Strangely enough this happens with double dashes -- but not with double underscores __

Please open a GitHub issue over here:


Thanks for the reply.

I opend a new issue:

1 Like

Any news on this issue?

I tried to work around this by naming the content file and then setting config file permalinks to /:filename/ but it still reduces it to one dash.

This is how Hugo normalizes file paths and it has been like this since Hugo 0.05 or something, i.e. always. @spf13 may tell us why, but I like how it behaves and I believe this is the first time I have seen someone raise this as an issue.

We cannot change the default behaviour. We may add a config option or something, but for me to consider that there have to be more than a handful people wanting it.

1 Like

Hi @bep,

thanks for your reply.
For me it is strange that we only encounter this “problem” now, when try building our content with Hugo 0.5x.x, especially when you say, that the normalization behaviour hasn’t changed since 0.05.
We are currently running a project using
and with this version we can create pages with two dashes in the url.
I can even give you a real world example where it is working for us with version 0.37.1 but not with 0.5x.x: we have content where in the frontmatter we define:
url: zeeland/nieuw--en-sint-joosland/
name: 'Nieuw- en Sint Joosland' (we get two dashes in the url because we escape whitespaces with dashes)
When we render that page the resulting output is (as we expect): (as you can see two dashes).
So for us it would be great if we could somehow configure Hugo to keep the two dashes.

Thanks for your time and effort,

I take all of this from memory, which isn’t always perfect. But I notice there is a GitHub issue to remind us about it. I vaguely remember we changed the “dash behaviour” at some point, probably to avoid many repeating dashes.


any update on this issue?


I also would like to be able to use URLs that contain --. For example, I wanted to use the URL but since that got changed by Hugo to, I’m using the URL instead. The good news is that an alias with -- is not munged so the first and third links in this message should work. In case you’re interested, here is part of the YAML front matter of my hugo-cli article:

  - /hugo-h/
  - /hugo--help/

(I originally used the URL hugo-h but changed it because I decided that wasn’t very SE Optimized.)

For people who might stumble upon this thread or have been affected by this bug.

The issue was fixed in and it will be available in Hugo 0.79.0