related-content.html 661 B

1234567891011121314151617
  1. {{ range first 1 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
  2. {{ $.Scratch.Set "has_related" true }}
  3. {{ end }}
  4. {{ if $.Scratch.Get "has_related" }}
  5. <aside>
  6. <heade><strong>{{ i18n "related-content" }}</strong></header>
  7. <hr>
  8. <ul>
  9. {{ $num_to_show := .Site.Params.related_content_limit | default 7 }}
  10. {{ range first $num_to_show (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
  11. <li><a href="{{ .RelPermalink }}">{{ .Title }}</a> &ndash; {{ .ReadingTime }} {{ i18n "minutes" }}
  12. {{ end }}
  13. </ul>
  14. </aside>
  15. {{ end }}