docs: document how to use different type in include shortcode (#275)
parent
ab1c111fff
commit
e9a07f78d2
|
@ -8,18 +8,18 @@ Include shortcode can include files of different types. By specifying a language
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
```tpl
|
```tpl
|
||||||
{{</* include file="relative/path/from/hugo/root" language="go" markdown=[false|true] */>}}
|
{{</* include file="relative/path/from/hugo/root" language="go" */>}}
|
||||||
```
|
```
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
|
||||||
| Name | Usage | default |
|
| Name | Usage | default |
|
||||||
| -------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
| -------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
|
||||||
| file | path to the included file relative to the Hugo root | undefined |
|
| file | path to the included file relative to the Hugo root | undefined |
|
||||||
| language | language for [syntax highlighting](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages) | undefined |
|
| language | language for [syntax highlighting](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages) | undefined |
|
||||||
| type | special include type (`html,page`) | undefined |
|
| type | special include type (`html,page`) | undefined (rendered as markdown) |
|
||||||
| options | highlighting [options](https://gohugo.io/content-management/syntax-highlighting/#highlight-shortcode) | `linenos=table` |
|
| options | highlighting [options](https://gohugo.io/content-management/syntax-highlighting/#highlight-shortcode) | `linenos=table` |
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
@ -32,11 +32,10 @@ If no other options are specified, files will be rendered as Markdown using the
|
||||||
If you include markdown files that should not get a menu entry, place them outside the content folder or exclude them otherwise.
|
If you include markdown files that should not get a menu entry, place them outside the content folder or exclude them otherwise.
|
||||||
{{< /hint >}}
|
{{< /hint >}}
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore -->
|
||||||
```tpl
|
```tpl
|
||||||
{{</* include file="/static/_includes/example.md.part" */>}}
|
{{</* include file="/static/_includes/example.md.part" */>}}
|
||||||
```
|
```
|
||||||
<!-- prettier-ignore-end -->
|
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- spellchecker-disable -->
|
<!-- spellchecker-disable -->
|
||||||
|
@ -48,17 +47,16 @@ If you include markdown files that should not get a menu entry, place them outsi
|
||||||
|
|
||||||
This method can be used to include source code files and keep them automatically up to date.
|
This method can be used to include source code files and keep them automatically up to date.
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore -->
|
||||||
```tpl
|
```tpl
|
||||||
{{</* include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" */>}}
|
{{</* include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" */>}}
|
||||||
```
|
```
|
||||||
<!-- prettier-ignore-end -->
|
|
||||||
|
|
||||||
Result:
|
Result:
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- spellchecker-disable -->
|
<!-- spellchecker-disable -->
|
||||||
{{< include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100">}}
|
{{< include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" >}}
|
||||||
<!-- spellchecker-enable -->
|
<!-- spellchecker-enable -->
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
@ -68,11 +66,10 @@ Result:
|
||||||
|
|
||||||
HTML content will be filtered by the `safeHTML` filter and added to the rendered page output.
|
HTML content will be filtered by the `safeHTML` filter and added to the rendered page output.
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore -->
|
||||||
```tpl
|
```tpl
|
||||||
{{</* include file="/static/_includes/example.html.part" */>}}
|
{{</* include file="/static/_includes/example.html.part" type="html" */>}}
|
||||||
```
|
```
|
||||||
<!-- prettier-ignore-end -->
|
|
||||||
|
|
||||||
{{< include file="/static/_includes/example.html.part" type="html" >}}
|
{{< include file="/static/_includes/example.html.part" type="html" >}}
|
||||||
|
|
||||||
|
@ -93,4 +90,11 @@ _includes/
|
||||||
└── _index.md
|
└── _index.md
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Specify the page include:
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
```tpl
|
||||||
|
{{</* include file="/_includes/include-page.md" type="page" */>}}
|
||||||
|
```
|
||||||
|
|
||||||
{{< include file="/_includes/include-page.md" type="page" >}}
|
{{< include file="/_includes/include-page.md" type="page" >}}
|
||||||
|
|
Loading…
Reference in New Issue