add support for series to blog

This commit is contained in:
a 2024-03-21 18:04:33 -05:00
parent b8c1c35ddf
commit 527f3b7892

View file

@ -23,6 +23,14 @@
</ul> </ul>
{{ end }} {{ end }}
{{- if .Params.series -}}
{{- with index (.GetTerms "series") 0 -}}
<div class="notice--info">
<p>This post is part of the <a href="{{ .Permalink }}" style="font-weight: bold">{{ .LinkTitle }}</a> series.</p>
</div>
{{- end -}}
{{- end -}}
{{ if ne .TableOfContents "<nav id=\"TableOfContents\"></nav>" }} {{ if ne .TableOfContents "<nav id=\"TableOfContents\"></nav>" }}
<p class="toc-title">Table of contents:</p> <p class="toc-title">Table of contents:</p>
{{ .TableOfContents }} {{ .TableOfContents }}
@ -31,6 +39,27 @@
<section class="content"> <section class="content">
{{ .Content }} {{ .Content }}
</section> </section>
<footer>
{{- if .Params.series -}}
<div class="post-series">
{{- $series := or (where .Site.RegularPages.ByDate ".Params.series" "intersect" .Params.series) (where .Site.RegularPages.ByDate ".Params.series" "eq" .Params.series) -}}
{{- with $series -}}
<h3 id="series">This series</h3>
<ol>
{{- range . -}}
<li>
{{- if eq .File.UniqueID $.File.UniqueID -}}
<b>{{ .Title }}</b>
{{- else -}}
<a href="{{ .Permalink }}">{{ .Title }}</a>
{{- end -}}
</li>
{{- end -}}
</ol>
{{- end -}}
</div>
{{- end -}}
</footer>
</article> </article>
</div> </div>
</main> </main>