I notice that you keep sending people to the documentation and seem annoyed by people asking. No offense, but if people keep asking about it is because the documentation is really not straightforward about it. We appreciate the help though.
For example, I have a type of content which is called report and in a new “report” frontmatter, say “energy.md”, I want to have:
---
pdf: "energy.pdf"
---
and then on the template have an “a” element:
<a href="/doc/{{ .Params.pdf }}" > Download PDF </a>
and have hugo render:
<a href="/doc/energy.pdf" > Download PDF </a>
To download the thing from one of the static folders.
But that doesn’t work, and as much as I have gone through the Variables section in the documentation I just can’t put two and two together. For the rest, Hugo is just awesome.
Edit: From various sources here I was able to figure it out, but only after a lot of poking around. I feel it would do a lot of good to a lot of people if it were right at the top of the “Variables” section of the documentation, or the tutorial on themes (templates). The answer was:
On the /content/report/energy.md
---
pdf: "energy.pdf"
---
and on the single.html template in the layouts/report/single.html
<a href={{ printf "/doc/%s" $.Params.pdf }}> Download PDF </a>
which correctly renders:
<a href="/doc/energy.pdf"> Download PDF </a>
And the end result:
http://seeagt.github.io/report/energy/