Include

The include helper can be used to include files into your pages; normally it is used for examples but can also be useful to embed assets. Relative paths are resolved from the file calling the include helper unless they start with a / which resolves the path from the site folder.

It is an error attempting to include a file outside the site source folder.

info

Use the includes folder conventions to automatically ignore included files.

warn

If you use this helper inside a partial loaded from a plugin relative paths are resolved from the plugin partial file which is probably not what you want; instead use an absolute path to resolve from the project site folder.

Arguments

Parameters

Example

Use an absolute path to resolve from the site folder:

{{include /assets/svg/menu.svg}}

Use a quoted string to include characters disallowed in paths:

{{include "%file.txt"}}

A common technique for examples is to put the include inside a fenced code block:

```markdown
{{include ../../../includes/uwe/new.txt~}}
```

Embed an SVG file using a data: URI:

<img src="data:image/svg+xml;base64,{{include /assets/svg/menu.svg base64=true}}" />

Use the binary parameter to embed a PNG file:

<img src="data:image/png;base64,{{include /assets/icon.png base64=true binary=true}}" />

Back to Helpers