Sometime there’s a need to link to your own site, for instance, in one article you want to point to some other article. I’ve read about shortcodes, which can be added to layouts/shortcodes/
, and the shortcodes can substitute, for instance, the base url if you use the following code in baseurl.html
file:
{{ .Page.Site.BaseURL }}
and then in the blog post:
{{< baseurl >}}/post/whatever/
This solution indeed works, but I noticed the following in the site code:
<a href="http://localhost:1313/
/post/whatever/">...</a>
So as you can see there’s a new line between the base URL and the rest of URL. This of course doesn’t break the site, but validator.w3.org
has issues with it and reports:
**Error** : Bad value
https://site.tld↩/post/whatever/for attribute
hrefon element [
a ](https://html.spec.whatwg.org/multipage/#the-a-element): Tab, new line or carriage return found.
Is there a way to fix it?