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)

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

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">


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

I have search for hours but found no solution.