I have a set of pages and related content defined by tags, some of which include spaces.
So I have been trying to get a list of these pages using variants of the following:
{{ $contentWithTag := where $.Site.RegularPages "Tag" "Bruno Amaral" }}
and a where statement using .Site.Taxonomies.tags
.
The process is harder, because I get the needed tag from the params of the current page. Using a printf statement might help, but how would I fetch a tag that includes spaces and caps?
This looks like a ugly way to do it, but it works:
{{ $posts := slice }}
{{ range where .Site.RegularPages "Type" "post" }}
{{ if in .Params.tags $name }}
{{ $posts = $posts | append . }}
{{ end }}
{{ end }}
{{ $mentions := $posts | symdiff .Data.Pages }}
{{ with $mentions }}
<h5 class="text-center title">{{ i18n "mentions" }}</h5>
<div class="row">
{{ range $mentions }}
{{ .Render "summary" }}
{{ end }}
</div>
{{ end }}
Is there any way I can avoid having to range over the posts and appending to the slice?