Browse templating


I am using the browse functionality and I try to write a template for my own usage. But I do not succeed to retrieve a parameter within a loop Here is the sample of template I want to perform:

{{range .Items }}
<a href="{{html .URL}}?token={{.URL.Query.Get "token" }}>

I can access from everywhere to .URL.Query.Get but not in the loop. I think it is due to the variable scope, so here is my question, how could I access to this parameter in my loop?

Thank in advance,

Ps: A new caddy lover.

The $ variable will get you the global/original context:


See template package - text/template - for a full description of how templating works. That should help!

Thank it works like a charm. I think I need to dig a bit more in go template documentation. Thanks for the quick answer.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.