mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-28 19:43:31 +08:00
Frontmatter variable now called related
for any related content
Now needs full path to content
This commit is contained in:
parent
bdaec8454a
commit
2388e11525
@ -1,8 +1,8 @@
|
||||
{{ $related_posts := slice -}}
|
||||
{{ range .Params.related_posts -}}
|
||||
{{ $related_posts = $related_posts | append ($.Site.GetPage (printf "/post/%s" .)) -}}
|
||||
{{ $explicitly_related := slice -}}
|
||||
{{ range .Params.related -}}
|
||||
{{ $explicitly_related = $explicitly_related | append ($.Site.GetPage . ) -}}
|
||||
{{ end -}}
|
||||
{{ $related := $related_posts | append (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | uniq | first 5 }}
|
||||
{{ $related := $explicitly_related | 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>
|
||||
@ -14,4 +14,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user