Shortcode to read content from page resources, site resources or project files, it's useful to reuse the content, such as the code snippets.
Become a backer or sponsor to support our work.
1{{< file-content "/path/to/file" >}}
name
Position | Name | Type | Required | Default | Since | Example |
---|---|---|---|---|---|---|
#0 | name | string | ✓ | - | - | - |
The filename.
1{{< file-content "data/foo.txt" >}}
1console.log('Hello world!')
1{{< file-content "data/hello.js" >}}
1google.com, pub-7827859788508375, DIRECT, f08c47fec0942fa0
1{{< file-content "static/ads.txt" >}}
1{{< file-content "static/invalid.txt" >}}
Take Bootstrap config toggle as an example.
1title: Site Title
1{{< bs/config-toggle hugo >}}
2{{< file-content "data/hugo.yaml" >}}
3{{< /bs/config-toggle >}}
hugo.yaml
1title: Site Title
hugo.toml
1title = 'Site Title'
hugo.json
1{
2 "title": "Site Title"
3}