Hugo: include/embed another file with a shortcode

1 · Roneo.org · March 29, 2022, 10:06 a.m.
Requirements# Support Markdown and HTML Trim the Front Matter from the included file Optionally hide included files from the post lists Method 1#Create the following file in layouts/shortcodes/include.html: {{ $file := .Get 0 }} {{ $file | readFile | safeHTML }} Call with {{% include "/content/article/included-file-name.md" %}} Results:# Markdown content is properly rendered. HTML is rendered, at least with unsafe: true. Note that Hugo must be restarted to see the HTML modifications Does not w...