Include

Th' include shortcode includes other planks, resources or files from yer project.

Usage

{{% include file="shortcodes/include/INCLUDE_ME.md" %}}
{{% include "shortcodes/include/INCLUDE_ME.md" %}}
{{ partial "shortcodes/include .html" (dict
  "page" .
  "file" "shortcodes/include/INCLUDE_ME.md"
)}}

Th' included files can even contain Marrrkdown an' will be taken into account when generat'n th' t'ble o' contents.

Parameter

Name Posit'n Default Notes
file 1 <empty> Th' path t' th' plank, resource or file t' be included. Plank an' resource paths adhere t' Hugo’s logical path. If not found by logical path it falls back t' Hugo’s build-in readFile funct'n
hidefirsthead'n 2 false When true an' th' included file contains head'ns, th' first head'n will be hidden. This comes 'n handy, eg. if ye include otherwise standalone Marrrkdown files.

Sett'ns

Opt'n Front Matter Ye can use include.errorlevel t' control what should happen if a local link can not be resolved t' a resource.

If not set or empty, any unresolved link be written as given into th' result'n output. If set t' warning th' same happens an' an additional warning be printed 'n th' built console. If set t' error an error message be printed an' th' build be aborted.

Please note that this can not resolve files inside o' yer static directory. Th' file must be a resource o' th' plank or th' ship.

Link warnings be also avail'ble fer images & links an' th' openapi shortcode.

[include]
  errorlevel = 'warning'
include:
  errorlevel: warning
{
   "include": {
      "errorlevel": "warning"
   }
}

Examples

Arbitrary Rrrambl'n

{{% include "shortcodes/include/INCLUDE_ME.md" %}}

Ye can add standard markdown rules:

  • multiple paragraphs
  • bullet point lists
  • emphasized, bold an' even bold emphasized text
  • links
  • etc.1
...and even source code

th' possibilities be endless (almost - includ'n other shorrrtcodes may or may not work) (almost - includ'n other shorrrtcodes may or may not work)


  1. Et Cetera (English: /ɛtˈsɛtərə/), abbreviated t' etc., etc, et cet., be a Latin expression that be used 'n English t' mean “and other similar things”, or “and so forth” ↩︎