Nullaetnequecursusliberotristiquelaoreetnecaligula.Fuscesit"{{<amet>}}" scelerisque erat. Quisque lorem lectus, lobortis vitae mattis non, tincidunt sed felis. Donec sit "{{<amet>}}"eratnibh.
Pretty easy. However Hugo by default does a little bit too much: while generating the static content, it adds a line break. Which in the browser results in:
There is a nasty little space between the word and the quotation mark. The generated HTML source shows the problem:
1
2
3
4
<p>Nunc in odio id magna molestie congue. Donec erat nulla, pulvinar eget volutpat non, molestie at nisi. Curabitur nec tristique felis. Cras imperdiet, ante et vestibulum iaculis, tellus ipsum pulvinar felis, at viverra est tellus et eros. In nec dignissim lectus, bibendum hendrerit ex. Praesent lobortis eget justo non vehicula.</p><p>Nulla et neque cursus libero tristique laoreet nec a ligula. Fusce sit “<ahref="https://www.lipsum.com/feed/html">amet</a>” scelerisque erat. Quisque lorem lectus, lobortis vitae mattis non, tincidunt sed felis. Donec sit “<ahref="https://www.lipsum.com/feed/html">amet</a>” erat nibh.</p>
Usually a line break in HTML is not a big deal, the browsers deal with that. But here an unnecessary space is added while rendering the content. Hugo makes it complicated to avoid this problem. There is no default setting to turn this off, however the shortcode can have an extra Hugo tag to avoid the training linebreak:
By adding the {{- -}}, the training line break is not included in the final HTML output, and the quotation mark comes right after the shortcode content.
What is Hugo
Hugo is a popular and open source static website generator. This blog is created using Hugo.
Development started around 2013, and the software is written in Go. The content of the website is written in Markdown, and then compiled into a website using the pre-defined layout. During development of new content, Hugo offers a life preview using the built-in server. It is very flexible, and offers a wide range of available themes and shortcuts.