Canonical cross domain alias

Hello
I am trying to add a canonical cross domain alias but I receive the error Error building site: Only relative aliases are supported

I have published a post on Medium and I’d like to republish it on my website adding the <link rel="canonical" href="https://medium.com..." tag in the header.
If not with aliases, how could I achieve this?

Thank you!

How did you try adding the alias in the first place? The one that caused the error?

I added a parameter in the Front Matter like this:

But I just realized that the template I am using is adding this in the head:

<link rel='canonical' href='{{ .Permalink }}'>

I thought it was Hugo that was adding the canonical.
I will add a custom Front Matter parameter to either put an absolute external href link or the one above (.Permalink). Unless there is a better option of course :slight_smile:

@sebelga - Did you work this out in the end? I’d like to do the same and would be grateful for the code snippet.

@apolaine I simply updated my head.html partial with this

{{ if .Params.canonicalCrossDomain }}
<link rel='canonical' href='{{ .Params.canonicalCrossDomain }}'>
<meta name="robots" content="noindex,follow">
{{ else }}
<link rel='canonical' href='{{ .Permalink }}'>
{{ end }}

Thank you, that’s very helpful. Just to be clear, the canonicalCrossDomain param is in the front matter TOML/YAML of the post? As in:

canonicalCrossDomain: http://medium.etc.