Reputation: 16845
I have created a simple website using Bookdown. I have a page:
---
title: Home
---
# Page title
Lorem ipsum dolor sit amet.
However, instead of Page title I wanna show a value coming from my config.toml
file.
I want to show the value of a site variable, defined in config.toml
file, so I did:
---
title: Home
---
# {{ $.Site.Params.author }}
Lorem ipsum dolor sit amet.
Having my configuration file like this:
[params]
author = "Me myself and I"
description = "My website"
However the value is not resolved. It is my understanding that I need to use a template, however, there is really no way to have a variable inside a content file?
Upvotes: 0
Views: 56
Reputation: 16845
A possible way I found to do this is via shortcodes:
layouts/shortcodes
like: myvar.html
and placed there the string I want to emitThe content file will look like:
---
title: Home
---
# {{< myvar >}}
Lorem ipsum dolor sit amet.
That worked!
Upvotes: 1