canonifyUrls, relURL and baseurl

Hello dear Hugo lovers,

I don’t know if here is the right place to discuss it. Tell me if inappropriate.

I have remarked that when canonifyUrls is set to true, the relURL pipe strips the path url (leaves only the domain), whereas it should prepend the baseurl path after the first slash alone.

Here are my settings:

baseurl: "http://www.domain.com/new"
canonifyURLs: true

In the post, I set

featured: "img/adrien/adrien01.jpg"

And here is the template:

{{- if .Params.featured -}}  
  <img src="{{ (.Params.featured | relURL) | safeCSS }}" />
{{- end -}}

Here are the behaviours:

  • With the settings above, I get <img src="/img/adrien/adrien01.jpg" />, whereas relURL should prepend /new/ to the url.
    If I comment the canonifyURLs line, I get <img src="/new/img/adrien/adrien01.jpg" />, which is the expected behaviour.

The markdown links generated with blackfriday are well formed with canonifyURLs: true, though.

I personnally need canonifyUrls to be set to true to have the links inside posts to point to the right locations. For now I get template URLS right XOR post urls right, but not both.

What do you think of it? Is this a bug?

Polite bump.