Includes

Include shortcode can include files of different types. By specifying a language, the included file will have syntax highlighting.

Shortcode

{{< 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 *.yml file with options

{{< include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" >}}
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
baseURL: https://geekdocs.de/
title: Geekdocs
theme: hugo-geekdoc
pygmentsUseClasses: true
pygmentsCodeFences: true

# Geekdoc configuration
disablePathToLower: true
enableGitInfo: true

# Needed for mermaid shortcodes
markup:
  goldmark:
    renderer:
      unsafe: true
  tableOfContents:
    startLevel: 1
    endLevel: 9

params:
  geekdocToC: 3

  geekdocRepo: https://github.com/thegeeklab/hugo-geekdoc
  geekdocEditPath: edit/master/exampleSite/content

  geekdocSearch: true

  geekdocLegalNotice: https://thegeeklab.de/legal-notice/#contact-information
  geekdocPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy

Include *.md file

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" >}}

Test Table

Head 1 Head 2 Head 3
1 2 3

Include *.html file

HTML content will be filtered by the safeHTML filter and added to the rendered page output.

{{< include file="static/includes/example.html.part" >}}

This is heading 1

This is heading 2

This is heading 3

This is heading 4

This is heading 5
This is heading 6