Page variable, 2 types

Hey guys,

On this page:
I find the explanation quite confusing; there are two examples:

<h3><a href={{ printf "%s" $.Params.affiliatelink }}>Buy this book</a></h3>
<p>It was recommended by {{ .Params.recommendedby }}.</p>

So, when do I use the first example and when do I use the second? Can I not rewrite the first example as:

<a href="{{Params.affiliatelink }}">Buy this book</a>



This page in the docs might help: especially #2.

Thanks, that gets me half-way there. But, why do we need to use printf “%s” in this case?

In this specific case, we probably don’t need to. Sometimes it is useful, for example when constructing strings: {{ printf "%s | %s" .Title .Date }} Hello | Jan 01 2000.