Original post

A web page should hav a canonical address (www points to url without www etc)

By placing this in the of the page (each and every page)

<head>
    <link href="https://gowebstatic.tk/why/" rel="canonical">
</head>

I guess that w.Header is not exactly the same, but maybe related.

w.Header().Set("Content-Type", "text/html")

The difference is that “Header” takes key-value pair so I cannot set the “dynamically. Correct?

So my question is if there is a solution that I can set the path by sending a parameter or similar to the . Other than the usual {{.}} in the template?

<link href="path" rel="canonical">

or

w.Head().Set("link", path, 'rel="canonical")

I have search for hours but found no solution.

TIA