Working on a banner system and want to fetch the right banner depending on section and tag. The static working code looks like this
{{ $dataJ := getJSON "http://banners.site.com/section-tag-top.json" }}
<a href="{{ $dataJ.target_url }}">
{{ $dataJ.html | markdownify }}
</a>
I’m trying to grab section and tag dynamically so the right banner shows up on the right page. The following obviously doesn’t work:
{{ $dataJ := getJSON "http://banners.site.com/{{ .Section }}-{{ range first 1 .Params.tags }}{{ . }}{{ end }}-top.json" }}
<a href="{{ $dataJ.target_url }}">
{{ $dataJ.html | markdownify }}
</a>
Been looking around the forum for hours, but can’t figure out the nesting. Help would be greatly appreciated.