Files
FixIt/layouts/partials/single/related.html
T

36 lines
1.3 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 -}}
<hr class="awesome-hr" />
<h2 id="see-also">{{ T "single.relatedContent" }}</h2>
<ul>
{{- range $i, $p := . -}}
{{- $title := cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}}
<li>
<a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</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 -}}