Modified render-link.html (to open links in new tab) leads to space after link

My modified render-link.html causes a space after links (see https://perennialhousingcoop.uk/) and I can’t work out why.

Any tips/suggestions?

You need to remove the newline at the end of the file. See:
https://gohugo.io/templates/introduction/#whitespace

You can add this empty comment at the end: {{- /**/ -}}

1 Like

I would delete the second blank line and the returns, so all is in one line

Thanks both. Did both and now working.

Discourse just showed me this other post, which this seems to be a duplicate of: Extra newline after every link due to render-link.html

Wow there’s loads of these issues…

- https://discourse.gohugo.io/t/extra-newline-after-every-link-due-to-render-link-html/45562
- https://discourse.gohugo.io/t/another-extra-space-after-link-issue/51392
- https://discourse.gohugo.io/t/white-space-issue-in-markdown/25258
- https://discourse.gohugo.io/t/space-in-markdown-links/41745

(Made it code because “new users can only add 2 links”)

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.