samrich
February 15, 2016, 7:29am
1
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.
bep
February 15, 2016, 9:48am
2
Just replace “Short Description” with .Title
samrich
February 15, 2016, 4:37pm
3
I’m so friggin stupid, I tried that but with the quotes. Thank you @bep you the man
/For other noobs like me, remove | markdownify from code to get it working
samrich
February 16, 2016, 5:29pm
4
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 }}
samrich
February 16, 2016, 5:46pm
5
Sorry guys, I got it
Replace {{ index $.Site.Data.TagDesc "INTHERE" }}
With {{ (index $.Site.Data.TagDesc $name) }}