About problem with canonifyurls

Yes, but only if the link destination begins with /.

No, it does not prepend anything. To verify, run hugo and look at the HTML file. When you hover your cursor over a relative link in the browser window, the browser prepends the current base URL.

Also, please read:
https://discourse.gohugo.io/t/sharing-code-in-the-forums/8968

Thanks.