Writing & Markdown

TOC & Include

Insert an inline table of contents or include reusable content from other files using Hugo shortcodes.

TOC Shortcode

Insert a table of contents anywhere in your content:

{{</* toc */>}}

This renders an auto-generated list of all headings on the page. Useful when you want the TOC in a specific location rather than the default sidebar position.

The sidebar TOC is controlled by the toc front matter parameter (see Page Features). The {{</* toc */>}} shortcode inserts an inline TOC within the content body.

Include Shortcode

Include the content of another file into your page:

{{</* include "shared/disclaimer.md" */>}}

Parameters

ParameterTypeDescription
First positionalstringRequired. Path to the file to include

Use Cases

  • Shared content — Include a standard disclaimer, license, or notice across multiple pages
  • Modular writing — Break long documents into separate files and compose them
  • Reusable snippets — Keep common code examples or instructions in one place

Example

## License

{{</* include "partials/mit-license.md" */>}}

Included files are processed as Markdown, so they support all formatting features and even other shortcodes.

Was this page helpful?

From the makers of

© 2026 Lore Labs.

On this page