Includes
Include shortcode can include files of different types. By specifying a language, the included file will have syntax highlighting.
{{< include file="relative/path/from/hugo/root" language="go" markdown=[false|true] >}}
Attributes:
Name | Usage | default |
---|---|---|
file | path to the included file relative to the hugo root | empty value |
language* | language for syntax highlighting | empty value |
markdown | included file is markdown | false |
options | highlighting options | linenos=table |
* if not set, the content will be rendered as plain HTML
{{< include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" >}}
|
|
Included markdown files will be rendered using the markdownify
filter.
Location of markdown files
If you include markdown files that should not get a menu entry, place them outside the content folder or exclude them otherwise.
{{< include file="static/includes/table.md.part" markdown="true" >}}
HTML content will be filtered by the safeHTML
filter and added to the rendered page output.
{{< include file="static/includes/example.html.part" >}}