I have a data file that I can use to optionally specify an image and header color that should be used on a template page (the tag taxonomy page, specifically). Here’s the code that resembles what I want to do:
{{ $config := index .Site.Data.tag_headers (.Title | urlize) }}
{{ $image := index $config "image" }}
{{ $color := index $config "color" }}
The only problem is that it doesn’t work. The second and third lines fail. What’s the best way to go about what I’m trying to do? Specifically, I want to retrieve a map from a data file and then inspect its children. Note that the map may not exist.
Cheers,
Eric