mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-10 01:52:19 +00:00
add related posts to sidebar
This commit is contained in:
parent
b84d0c918c
commit
e768c48c05
2 changed files with 20 additions and 0 deletions
|
@ -4,6 +4,7 @@ description = "while (true) { bugs++; }"
|
||||||
mainSections = ["posts"]
|
mainSections = ["posts"]
|
||||||
fallBackOgImage = "images/broken-computer.svg"
|
fallBackOgImage = "images/broken-computer.svg"
|
||||||
numberOfFeaturedPosts = 5
|
numberOfFeaturedPosts = 5
|
||||||
|
numberOfRelatedPosts = 5
|
||||||
author = "codesplice"
|
author = "codesplice"
|
||||||
|
|
||||||
indexTitle = ".-. ..- -. - .. -- . - . .-. .-. --- .-."
|
indexTitle = ".-. ..- -. - .. -- . - . .-. .-. --- .-."
|
||||||
|
|
|
@ -22,6 +22,25 @@
|
||||||
<hr>
|
<hr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if isset .Params "series" }}
|
||||||
|
{{$related := where .Site.RegularPages ".Params.series" "eq" .Params.series }}
|
||||||
|
{{- $relatedLimit := default 8 .Site.Params.numberOfRelatedPosts }}
|
||||||
|
<h2>More {{ .Params.series }}</h2>
|
||||||
|
<ul>
|
||||||
|
{{- range first $relatedLimit $related }}
|
||||||
|
<li>
|
||||||
|
<a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title | markdownify }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ if gt (len $related) $relatedLimit }}
|
||||||
|
<li>
|
||||||
|
<a href="/series/{{ lower .Params.series }}/"><i>See all {{ .Params.series }}</i></a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{- $posts := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
{{- $posts := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||||
{{- $featured := default 8 .Site.Params.numberOfFeaturedPosts }}
|
{{- $featured := default 8 .Site.Params.numberOfFeaturedPosts }}
|
||||||
{{- $featuredPosts := first $featured (where $posts "Params.featured" true)}}
|
{{- $featuredPosts := first $featured (where $posts "Params.featured" true)}}
|
||||||
|
|
Loading…
Reference in a new issue