Just for the hell of it, @keauval, at the content level, you could do this as a shortcode:
<!--layouts/shortcodes/svg.html-->
{{$svg := .Get 0}}
{{ $svg | readFile | safeHTML }}
Then within the body copy/content of *.md
:
{{< svg "static/svgs/your-svg.svg" >}}
This assumes, obviously, that youāre keeping your svgs as static assets a la images.
As a matter of fact, you could do something similar if you were trying to create a sort of content āsnippetā that you want to add in content (i.e., *.md
) files using .GetPage
. The following assumes you have a content/snippets
folder.
Note: Iām doing this off the cuff and havenāt tested this like the above svg example:
<!--layouts/shortcodes/snippet.html-->
{{$snippet := .Get 0}}
{{ with .GetPage "page" "snippets" $snippet }}{{.Content}}{{end}}
Then in your content file, you could call it like:
{{< snippet "my-snippet.md" >}}
Youād have to disable the snippets
section, however, if you donāt want files in the snippets
folder to render full-blown html files. (Again, not testedā¦but if anyone tries it, let me know.)