- Last Updated: [[2020-12-13]]
- What is a shortcode?
- A shortcode is a template that can be used to provide functionality to [[obsidian-playbook/Using Obsidian/02 Making Notes in Obsidian/Markdown]] content in [[Hugo]] so as to maintain the cleanliness of Markdown text and prevent users from resorting to HTML.
- The objections laid out by Hugo about using HTML in Markdown seem to be aesthetic at first glance, but I think there's some wisdom in gatekeeping what goes into Markdown files. With HTML, Markdown could quickly become cluttered, which goes directly against its purpose.
- ### Using shortcodes for canonical tags
- Add shortcode template in `layouts/shortcodes/rawhtml.html`
- ```javascript
<!-- raw html -->
{{.Inner}}```
- To use this shortcode in [[Markdown]]:
- ```javascript
{{< rawhtml >}}
<p class="speshal-fancy-custom">
This is <strong>raw HTML</strong>, inside Markdown.
</p>
{{< /rawhtml >}}```
- References
- [[Simple Shortcode to Insert Raw HTML in Hugo]]