hugo-theme-stack/layouts/partials/article/components/related-content.html
Simon Guest bdaec8454a Add related_posts in page frontmatter
These take priority over any derived by Hugo by its related posts algorithm.
2023-02-01 20:05:48 +13:00

17 lines
696 B
HTML

{{ $related_posts := slice -}}
{{ range .Params.related_posts -}}
{{ $related_posts = $related_posts | append ($.Site.GetPage (printf "/post/%s" .)) -}}
{{ end -}}
{{ $related := $related_posts | append (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | uniq | first 5 }}
{{ with $related }}
<aside class="related-content--wrapper">
<h2 class="section-title">{{ T "article.relatedContent" }}</h2>
<div class="related-content">
<div class="flex article-list--tile">
{{ range . }}
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "articleList") }}
{{ end }}
</div>
</div>
</aside>
{{ end }}