Hugo shortcode for raw HTML

Sometimes we need to add raw HTML content in markdown files. We can do it before or after, the content. And in the middle of content using shortcodes. Here is how to create your own one-line custom shortcode to make that possible.

Create html file located in /layouts/shortcodes/rawhtml.html.

 
{{.Inner}}

And then you can use the shortcode in your markdown file e.g:

{{ < rawhtml > }}
<p>Hello World!</p>
{{ < /rawhtml >}}

Originally published at https://ronaldsvilcins.com on February 15, 2022.

--

--

I drink a lot of tea and build beautiful websites. If you are looking to work together or just start a conversation 👉 https://www.ronaldsvilcins.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ronalds Vilcins

I drink a lot of tea and build beautiful websites. If you are looking to work together or just start a conversation 👉 https://www.ronaldsvilcins.com/