mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-09-02 11:42:39 +00:00
34 lines
1.2 KiB
HTML
34 lines
1.2 KiB
HTML
{{- /* Related Content */ -}}
|
|
{{- /* https://gohugo.io/content-management/related/ */ -}}
|
|
{{- $params := partial "function/params.html" -}}
|
|
|
|
{{- if $params.related.enable | and (not $params.password) -}}
|
|
{{- $posts := .Scratch.Get "mainSectionPages" -}}
|
|
{{- if .Site.Params.page.hiddenFromRelated -}}
|
|
{{- $posts = where $posts "Params.hiddenfromrelated" false -}}
|
|
{{- else -}}
|
|
{{- $posts = where $posts "Params.hiddenfromrelated" "!=" true -}}
|
|
{{- end -}}
|
|
{{- $related := $posts.Related . | first ($params.related.count | default 5) -}}
|
|
{{- with $related -}}
|
|
<h2 id="see-also">{{ T "single.relatedContent" }}</h2>
|
|
<ul>
|
|
{{- range $i, $p := . -}}
|
|
<li>
|
|
<a href="{{ .RelPermalink }}" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a>
|
|
{{- with .HeadingsFiltered -}}
|
|
<ul>
|
|
{{- range . -}}
|
|
{{- $link := printf "%s#%s" $p.RelPermalink .ID | safeURL -}}
|
|
<li>
|
|
<a href="{{ $link }}" title="{{ .Title }}">{{ .Title }}</a>
|
|
</li>
|
|
{{- end -}}
|
|
</ul>
|
|
{{- end -}}
|
|
</li>
|
|
{{- end -}}
|
|
</ul>
|
|
{{- end -}}
|
|
{{- end -}}
|