I’m currently building a theme, and I would like to be able to read a site-wide param that defines one styling option for that theme, but then use it within my individual layouts to read matching data files.
For example, if this is my config.toml
:
[params]
author = "Lorem"
description = "Lorem ipsum"
docsTheme = "docs1"
And I have a matching data file at data/docs/docs1.yaml
that contains:
logo:
image: "assets/img/someImage.png"
I want to know if it’s possible to do something like this:
{{ $docsTheme := .Site.Params.docsTheme }}
{{ .Site.Data.docs.$docsTheme.logo.image }}
or
{{ .Site.Data.docs.( .Site.Params.docsTheme ).logo.image }}
Both of these don’t work, and an easy solution would be to modify the name of the logo image to something like docs1.png
and access it that way, but I’m sure to something I will run into similar as I go along. Is this possible somehow?
Thanks.