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:

NameUsagedefault
filepath to the included file relative to the hugo rootempty value
language*language for syntax highlightingempty value
markdownincluded file is markdownfalse
optionshighlighting optionslinenos=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
130
131
132
133
# See https://geekdocs.de/usage/configuration/
# for more information on how to configure this file

---
baseURL: https://jlumbroso.github.io/hugo-geekdoc-github-example
title: Hugo Geekdoc Example
theme: hugo-geekdoc
pygmentsUseClasses: true
pygmentsCodeFences: true
timeout: 180000

# Geekdoc configuration
disablePathToLower: true
enableGitInfo: true

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

params:
#  geekdocMenuBundle: true
  geekdocToC: 3

  geekdocRepo: https://github.com/jlumbroso/hugo-geekdoc-github-example
  geekdocEditPath: edit/main/content

  geekdocSearch: true
  geekdocSearchShowParent: true

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 1Head 2Head 3
123

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