Get variable in order to access named values in datafile

Hello,

I’ve made the following example from Data Files documentation work for me:

<div>Edited to avoid misunderstanding {{.Site.Data.User0123.Name}}: <p>{{ index .Site.Data.User0123 "Short Description" | markdownify }}</p></div>

The question is, how do I swap “Short Description” for a variable such as .Title?

//Possible usage areas include: customizing information on taxonomylists by fetching data from datafiles.

Just replace “Short Description” with .Title

I’m so friggin stupid, I tried that but with the quotes. Thank you @bep you the man :sunglasses:

/For other noobs like me, remove | markdownify from code to get it working

Maybe you can help me with this one, how to put $name INTHERE. I know the base works since it outputs correctly if i put a static value INTHERE. TagDesc is a datafile with descriptions of different tags.

{{ range $name, $taxonomy := .Site.Taxonomies.tags }} <a href="{{$.Site.BaseURL }}tags/{{ $name }}"> <div> <h2>{{ $name }}</h2> <div><img src="http://www.imagehost.com/cdn/{{ $name | urlize }}.jpg" /></div> <div>{{ index $.Site.Data.TagDesc "INTHERE" }}<p></div> </div> </a> {{ end }}

Sorry guys, I got it

Replace {{ index $.Site.Data.TagDesc "INTHERE" }}
With {{ (index $.Site.Data.TagDesc $name) }}