Hello community,
i have an json file like this:
{"style.css":"style-23d5d764.css","main.js":"main-84eed07d.js","main-debug.js":"main-debug-bbdd6327.js"}
and i want to get the data like this
<link rel="stylesheet" href="/css/{{ .Site.Data.hash.style.css }}" />
But that doesnt work. Any help here?
Thank you very much.
Hi Daniel. This appears to be because of the dot in ‘style.css’ - it’s resulting in a lookup within ‘style’ for a ‘css’ object, if you see what I mean.
I changed it to:
{"style":"style-23d5d764.css","main":"main-84eed07d.js","main-debug":"main-debug-bbdd6327.js"}
and
<link rel="stylesheet" href="/css/{{ .Site.Data.hash.style }}" />
And it worked fine. Hope that helps!
Tom
Hi and thanks for your help.
i find out that this solution worked:
<link rel="stylesheet" href="/css/{{ index .Site.Data.hash "style.css" }}" />