hugo-theme-relearn/layouts/partials/shortcodes/term.html

30 lines
No EOL
1.1 KiB
HTML

{{- $term := .term }}
{{- if eq "string" (printf "%T" $term) }}
{{- $term = .page.GetPage $term }}
{{- end }}
{{- $headingstyle := .headingstyle | default "h2" }}
{{- with $term }}
{{- .Content }}
{{- $lastCapital := "" }}
{{- $pages := partialCached "partials/_relearn/pagesTerm.gotmpl" . .Path }}
{{- range $pages }}
{{- $capital := substr .Title 0 1 | upper }}
{{- if ne $lastCapital $capital }}
{{- if ne $lastCapital "" }}
</ul>
{{- end }}
{{ (printf `<%s id="%s">%s</%s>` $headingstyle ($capital | plainify | anchorize) $capital $headingstyle) | safeHTML }}
<ul class="columnize">
{{- end }}
{{- /* display pages of a term */}}
{{- $breadcrumb := "" }}
{{- if (ne .Page.Site.Params.disableTermBreadcrumbs true) }}
{{- $breadcrumb = trim (partial "breadcrumbs.html" (dict "page" .Page "dirOnly" true) | plainify | htmlUnescape) "\n\r\t " }}
{{- end }}
<li><a href="{{ partial "permalink.gotmpl" (dict "to" .Page) }}">{{ .Title }}</a>{{ with $breadcrumb }}<div class="breadcrumbs highlightable" title="{{ . }}">{{ . }}</div>{{ end }}</li>
{{- $lastCapital = $capital }}
{{- end }}
{{- if ne $lastCapital "" }}
</ul>
{{- end }}
{{- end }}