Skip to content

Instantly share code, notes, and snippets.

@noah-de
Last active March 23, 2020 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noah-de/0d2ef76090628592bf90908bf9964ec3 to your computer and use it in GitHub Desktop.
Save noah-de/0d2ef76090628592bf90908bf9964ec3 to your computer and use it in GitHub Desktop.
Hugo filter a groupby
{{ define "title" }}People{{ end }}
{{- range .Pages.GroupByParam "rank_id" }}
{{/* Need to Substr the Key because we have numerical prefix for sorting */}}
<h3>{{ substr .Key 2 }}</h3>
<div class="container">
{{- range .Pages.ByParam "affiliation" }}
{{ if eq .Params.current 1 }}
<div class="col-md-3" style="text-align: center;">
<div class="caption">
{{ .Title }}
</div><!-- end caption -->
</div><!-- end col --->
{{ end }}
{{- end }}
</div>
{{- end }}
{{ end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment