Files
hinode/layouts/header.html

82 lines
3.3 KiB
HTML

{{/* Initialize global variables */}}
{{- $size := site.Params.style.title.size | default 4 -}}
{{- $headingStyle := site.Params.style.title.headingStyle | default "display" -}}
{{- $contentStyle := site.Params.style.title.contentStyle | default "lead text-muted" -}}
{{- $padding := partial "utilities/GetPadding.html" -}}
{{/* Initialize local variables */}}
{{- $breakpoint := $.Scratch.Get "breakpoint" -}}
{{- $metadata := "full" -}}
{{ if isset .Params "metadata" }}
{{ $metadata = .Params.metadata }}
{{ else }}
{{- with (index site.Params.pages .Type ) -}}
{{ if isset . "metadata" }}{{ $metadata = (index . "metadata") }}{{ end }}
{{- end -}}
{{ end }}
{{- $supportedStates := slice "full" "original" "none" -}}
{{- if not (in $supportedStates $metadata) -}}
{{- errorf "layout [_default/page/header.html] - Invalid value for param 'metadata': %s" $metadata -}}
{{- end -}}
{{ $title := .Title }}
{{ if site.Params.main.titleCase }}{{ $title = title $title }}{{ end }}
{{/* Render breadcrumb */}}
{{ if .Site.Params.navigation.breadcrumb }}{{ partial "assets/breadcrumb.html" (dict "page" .) }}{{ end -}}
{{/* Display title and metadata */}}
{{ with $title }}<h1 id="{{ anchorize . }}" class="{{ $headingStyle }}-{{ $size }} pt-1">{{ . }}</h1>{{ end }}
{{ if ne $metadata "none" }}
<small class="text-body-secondary text-uppercase">
{{ if .Date }}
{{ $lastmodstr := (partial "utilities/date.html" (dict "date" .Lastmod "format" "long")) -}}
{{ $datestr := (partial "utilities/date.html" (dict "date" .Date "format" "long")) -}}
{{ if gt .Lastmod .Date }}
{{ $lastmodstr | i18n "lastModified" }}
{{ else }}
{{ $datestr | i18n "postedOnDate" -}}
{{ end }}
&bull;
{{ end }}
{{ .ReadingTime | lang.FormatNumber 0 }}&nbsp;{{ i18n "minutesShort" }} {{ i18n "read" }} &bull;
{{ .WordCount | lang.FormatNumber 0 }}&nbsp;{{ i18n "words" }}
</small>
{{ end }}
{{/* Render tags */}}
{{- if gt (len (.GetTerms "tags")) 0 -}}
<div class="mt-3">
<div class="d-none-dark">
<div class="hstack gap-1">
{{ range (.GetTerms "tags") -}}
{{- $url := .Page.RelPermalink -}}
{{ partial "assets/button.html" (dict "href" $url "title" .LinkTitle "color" "light" "button-size" "sm") }}
{{ end -}}
</div>
</div>
<div class="d-none-light">
<div class="hstack gap-1">
{{ range (.GetTerms "tags") -}}
{{- $url := .Page.RelPermalink -}}
{{ partial "assets/button.html" (dict "href" $url "title" .LinkTitle "color" "primary" "button-size" "sm" "outline" "true") }}
{{ end -}}
</div>
</div>
</div>
{{- end -}}
{{ partial "assets/sharing.html" (dict "page" .) }}
{{/* Display description */}}
{{ with .Description }}
<div class="{{ $contentStyle }} py-{{ $padding.y }}">{{ . | page.RenderString | safeHTML }}</div>
{{ end }}
{{/* Display TOC dropdown on smaller screens */}}
{{- if and .Site.Params.navigation.toc .Params.includeToc | default true -}}
<div class="d-{{ $breakpoint.current }}-none pb-5">{{ partial "assets/toc-dropdown.html" (dict "page" .) }}</div>
{{- end -}}