mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
82ba045702
for better modularization by keeping their whole functionality DOMwise in one place
219 lines
No EOL
10 KiB
HTML
219 lines
No EOL
10 KiB
HTML
<!DOCTYPE html>
|
|
{{- $format := partial "get-format.hugo" . }}
|
|
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
|
{{- $basename := "index" }}
|
|
{{- if eq $outputFormat "searchpage" }}
|
|
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
|
|
{{- end }}
|
|
<html lang="{{ .Page.Language | default "en" }}" dir="{{ T "Reading-direction" | default "ltr" }}">
|
|
<head>
|
|
{{- partial "meta.html" . }}
|
|
{{- $page := . }}
|
|
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
|
|
{{- $title := .Title }}
|
|
{{- if eq $outputFormat "searchpage" }}
|
|
{{- $title = T "Search" }}
|
|
{{- else if eq .Kind "taxonomy" }}
|
|
{{- $title = i18n .Data.Plural }}
|
|
{{- if not $title }}
|
|
{{- $title = .Data.Plural }}
|
|
{{- end }}
|
|
{{- else if eq .Kind "term" }}
|
|
{{- $title = i18n .Data.Singular }}
|
|
{{- if not $title }}
|
|
{{- $title = .Data.Singular }}
|
|
{{- end }}
|
|
{{- $title = printf "%s %s %s" .Title (default "::" .Site.Params.titleSeparator) $title }}
|
|
{{- end }}
|
|
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
|
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
|
{{- end }}
|
|
<title>{{ $title }}</title>
|
|
|
|
{{- if .IsTranslated -}}
|
|
{{- range $index, $trans := .AllTranslations }}
|
|
{{- if eq $index 0 }}
|
|
<link href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename) }}" rel="alternate" hreflang="x-default">
|
|
{{- end }}
|
|
<link href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename) }}" rel="alternate" hreflang="{{ .Language.Lang }}">
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}
|
|
{{- else }}
|
|
{{- range .AlternativeOutputFormats }}
|
|
{{- if eq .Rel "canonical" }}
|
|
{{ (printf $link (partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
|
|
{{- else if eq $outputFormat "searchpage" }}
|
|
{{- else if eq .Name "SEARCHPAGE" }}
|
|
{{- else if and (ne .Name "JSON") (ne .Name "SEARCH") }}
|
|
{{ (printf $link (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- if and (ne .Site.Params.disableSeoHiddenPages true) (ne .Site.Params.disableSearchHiddenPages true) }}
|
|
{{- range .AlternativeOutputFormats }}
|
|
{{- if eq .Name "SEARCHPAGE" }}
|
|
{{- else if eq .Name "JSON" }}
|
|
{{ (printf $link (.Permalink | relURL) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- partialCached "favicon.html" . }}
|
|
{{- partialCached "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) $outputFormat }}
|
|
{{- partial "custom-header.html" . }}
|
|
</head>
|
|
<body class="mobile-support {{ $outputFormat }}{{- if .Site.Params.disableInlineCopyToClipBoard }} disableInlineCopyToClipboard{{ end }}{{- if .Site.Params.disableHoverBlockCopyToClipBoard }} disableHoverBlockCopyToClipBoard{{ end }}" data-url="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">
|
|
<div id="body" class="default-animation">
|
|
<nav id="topbar">
|
|
<div>
|
|
<div class="topbar-sidebar-divider"></div>
|
|
<div class="topbar-left">
|
|
{{- partial "topbar-button.html" (dict
|
|
"page" $page
|
|
"class" "topbar-sidebar"
|
|
"href" "javascript:showNav()"
|
|
"icon" "bars"
|
|
"title" (printf "%s (CTRL+ALT+n)" (T "Navigation-toggle"))
|
|
)}}
|
|
<div id="sidebar-overlay"></div>
|
|
{{- $defaultDisableToc := .Site.Params.disableToc | default false }}
|
|
{{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }}
|
|
{{- $toc_content := partial "toc.html" . }}
|
|
{{- $hastoc := not (eq 0 (int (len (trim ($toc_content | plainify) "\n\t ")))) }}
|
|
{{- $toc := and $hastoc (not $currentDisableToc) (eq $outputFormat "html") }}
|
|
{{- if $toc }}
|
|
{{- partial "topbar-button.html" (dict
|
|
"page" $page
|
|
"class" "topbar-toc"
|
|
"href" "javascript:showToc()"
|
|
"icon" "list-alt"
|
|
"title" (printf "%s (CTRL+ALT+t)" (T "Toc-toggle"))
|
|
)}}
|
|
{{ $toc_content }}
|
|
<div id="toc-overlay"></div>
|
|
{{- end }}
|
|
</div>
|
|
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
|
|
{{- if $showBreadcrumb }}
|
|
<ol class="topbar-breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList">
|
|
{{- template "breadcrumb" dict "page" . "to" . }}
|
|
</ol>
|
|
{{- else }}
|
|
<span class="topbar-breadcrumbs highlightable">
|
|
{{ .Title }}
|
|
</span>
|
|
{{- end }}
|
|
<div class="topbar-right">
|
|
{{- with and (eq $outputFormat "html") .Site.Params.editURL $.File }}
|
|
{{- partial "topbar-button.html" (dict
|
|
"page" $page
|
|
"class" "topbar-edit"
|
|
"href" (printf "%s%s%s" $.Site.Params.editURL (strings.TrimLeft "/" (replace .Dir "\\" "/")) .LogicalName)
|
|
"icon" "pen"
|
|
"title" (printf "%s (CTRL+ALT+w)" (T "Edit-this-page"))
|
|
)}}
|
|
{{- end }}
|
|
{{- with and (eq $outputFormat "html") (.OutputFormats.Get "PRINT") }}
|
|
{{- partial "topbar-button.html" (dict
|
|
"page" $page
|
|
"class" "topbar-print"
|
|
"href" .RelPermalink
|
|
"icon" "print"
|
|
"title" (printf "%s (CTRL+ALT+p)" (T "Print-this-chapter"))
|
|
)}}
|
|
{{- end -}}
|
|
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
|
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
|
|
{{- $startarrow := "🡐" }}
|
|
{{- $endarrow := "🡒" }}
|
|
{{- if eq (T "Reading-direction" | default "ltr") "rtl" }}
|
|
{{- $startarrow = "🡒" }}
|
|
{{- $endarrow = "🡐" }}
|
|
{{- end }}
|
|
{{- $ispublished := true }}
|
|
{{- with .Parent }}
|
|
{{- $ispublished = gt (int (len .Permalink)) 0 }}
|
|
{{- end }}
|
|
{{- $prev := "" }}
|
|
{{- if and (eq .RelPermalink .Site.Home.RelPermalink) (eq $outputFormat "html") }}
|
|
{{- else if or (ne $outputFormat "html") (not (and $ispublished ($.Scratch.Get "relearnPrevPage"))) (eq .Page.Kind "taxonomy") (eq .Page.Kind "term") }}
|
|
{{- $prev = .Site.Home }}
|
|
{{- else }}
|
|
{{- $prev = $.Scratch.Get "relearnPrevPage" }}
|
|
{{- end}}
|
|
{{- partial "topbar-button.html" (dict
|
|
"page" $page
|
|
"class" "topbar-prev"
|
|
"href" (partial "relLangPrettyUglyURL.hugo" (dict "to" $prev))
|
|
"icon" "chevron-left"
|
|
"title" (printf "%s (%s)" ($prev | default $page).Title ($startarrow | safeHTML))
|
|
)}}
|
|
{{- $next := "" }}
|
|
{{- if or (ne $outputFormat "html") (not (and $ispublished ($.Scratch.Get "relearnNextPage"))) }}
|
|
{{- else }}
|
|
{{- $next = $.Scratch.Get "relearnNextPage" }}
|
|
{{- end }}
|
|
{{- partial "topbar-button.html" (dict
|
|
"page" $page
|
|
"class" "topbar-next"
|
|
"href" (partial "relLangPrettyUglyURL.hugo" (dict "to" $next))
|
|
"icon" "chevron-right"
|
|
"title" (printf "%s (%s)" ($next | default $page).Title ($endarrow | safeHTML))
|
|
)}}
|
|
{{- end }}
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
{{- $hook := "styleclass" }}
|
|
<main id="body-inner" class="highlightable {{ partialCached "archetype.hugo" (dict "hook" $hook "page" . "parameter" . "outputFormat" $outputFormat) .RelPermalink $outputFormat $hook }}" tabindex="-1">
|
|
<div class="flex-block-wrapper">
|
|
{{- define "breadcrumb" }}
|
|
{{- $breadcrumb := slice }}
|
|
{{- $page := .page }}
|
|
{{- $to := .to }}
|
|
{{- $breadcrumb = $breadcrumb | append $to }}
|
|
{{- $depth := int (partial "get-page-depth.hugo" (dict "page" $page)) }}
|
|
{{- range seq $depth }}
|
|
{{- $to = $to.Parent }}
|
|
{{- if $to }}
|
|
{{- $breadcrumb = $breadcrumb | append $to }}
|
|
{{- else }}
|
|
{{- break }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- $len := len $breadcrumb -}}
|
|
{{- $breadcrumbReversed := slice }}
|
|
{{- range seq $len }}
|
|
{{- $breadcrumbReversed = $breadcrumbReversed | append (index $breadcrumb (sub $len .)) }}
|
|
{{- end }}
|
|
{{- $remaining := $len }}
|
|
{{- $depth := 0 }}
|
|
{{- range $i, $e := $breadcrumbReversed }}
|
|
{{- $to := $e }}
|
|
{{- $ispublished := gt (int (len $to.Permalink)) 0 }}
|
|
{{- $remaining = sub $remaining 1 }}
|
|
{{- if $ispublished }}
|
|
{{- $depth = add $depth 1 }}
|
|
{{- $title := $to.Title }}
|
|
{{- if eq .Kind "taxonomy" }}
|
|
{{- $title = i18n $to.Data.Plural }}
|
|
{{- if not $title }}
|
|
{{- $title = $to.Data.Plural }}
|
|
{{- end }}
|
|
{{- else if eq .Kind "term" }}
|
|
{{- $title = i18n $to.Data.Singular }}
|
|
{{- if not $title }}
|
|
{{- $title = $to.Data.Singular }}
|
|
{{- end }}
|
|
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) $to.Title }}
|
|
{{- end }}
|
|
{{- if not $title }}
|
|
{{- $title = $to.Site.Title }}
|
|
{{- end }}
|
|
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $remaining }}<a itemprop="item" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{end}}<span itemprop="name">{{ $title }}</span>{{ if $remaining }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if $remaining }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}</li>
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }} |