Skip to main content

Insert File Shortcode

·1 min

Insert another file into a content file #

Note to self:

Here’s an example shortcode to insert the contents of one file into another.

In /layouts/shortcodes/ create a file with the code

{{ readFile “file-to-insert” }}

Name the shortcut file with the .html extension.

In the body of the content file call the shortcode with the code

{{% myshortcode %}}

See more at the Hugo documentation website here.