mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
Add related_posts in page frontmatter
These take priority over any derived by Hugo by its related posts algorithm.
This commit is contained in:
parent
4272da7ee4
commit
bdaec8454a
@ -1,4 +1,8 @@
|
|||||||
{{ $related := (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | first 5 }}
|
{{ $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 }}
|
{{ with $related }}
|
||||||
<aside class="related-content--wrapper">
|
<aside class="related-content--wrapper">
|
||||||
<h2 class="section-title">{{ T "article.relatedContent" }}</h2>
|
<h2 class="section-title">{{ T "article.relatedContent" }}</h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user