hugo-theme-relearn/layouts/partials/header.html
2021-09-04 00:17:47 +02:00

162 lines
7.5 KiB
HTML

<!DOCTYPE html>
<html lang="{{ .Page.Language | default "en" }}" class="js csstransforms3d">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ hugo.Generator }}
{{ partial "meta.html" . }}
{{ partial "favicon.html" . }}
<title>{{ .Title }} {{ default "::" .Site.Params.titleSeparator }} {{ .Site.Title }}</title>
{{ $assetBusting := not .Site.Params.disableAssetsBusting }}
<link href="{{"css/nucleus.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
<link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
<link href="{{"css/featherlight.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
<link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
<link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
<link href="{{"css/theme.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
<link href="{{"css/tabs.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
<link href="{{"css/hugo-theme.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
{{with .Site.Params.themeVariant}}
<link href="{{(printf "css/theme-%s.css" .) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
{{end}}
{{ range .Site.Params.custom_css -}}
<link href="{{(printf "%s" .) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
{{- end }}
<script src="{{"js/jquery.min.js"| relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
<style>
:root #header + #content > #left > #rlblock_left{
display:none !important;
}
{{ if .Site.Params.disableInlineCopyToClipBoard }}
:not(pre) > code + span.copy-to-clipboard {
display: none;
}
{{ end }}
</style>
{{ partial "custom-header.html" . }}
</head>
{{- $currentNode := . }}
{{- $currentNode.Scratch.Set "relearnIsSelfFound" nil }}
{{- $currentNode.Scratch.Set "relearnPrevPage" nil }}
{{- $currentNode.Scratch.Set "relearnNextPage" nil }}
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hidden" false }}
{{- define "relearn-structure" }}
{{- $currentNode := .currentnode }}
{{- $isSelf := eq $currentNode.RelPermalink .node.RelPermalink }}
{{- $isDescendant := and (not $isSelf) (.node.IsDescendant $currentNode) }}
{{- $isAncestor := and (not $isSelf) (.node.IsAncestor $currentNode) }}
{{- $isOther := and (not $isDescendant) (not $isSelf) (not $isAncestor) }}
{{- if $isSelf }}
{{- $currentNode.Scratch.Set "relearnIsSelfFound" true }}
{{- end}}
{{- $isSelfFound := eq ($currentNode.Scratch.Get "relearnIsSelfFound") true }}
{{- $isPreSelf := and (not $isSelfFound) (not $isSelf) }}
{{- $isPostSelf := and ($isSelfFound) (not $isSelf) }}
{{- $hidden_node := or (.node.Params.hidden) (eq .node.Title "") }}
{{- $hidden_stem:= or $hidden_node .hidden }}
{{- $hidden_from_current := or (and $hidden_node (not $isAncestor) (not $isSelf) ) (and .hidden (or $isPreSelf $isPostSelf $isDescendant) ) }}
{{- .node.Scratch.Set "relearnIsHiddenNode" $hidden_node}}
{{- .node.Scratch.Set "relearnIsHiddenStem" $hidden_stem}}
{{- if not $hidden_from_current }}
{{- if $isPreSelf }}
{{- $currentNode.Scratch.Set "relearnPrevPage" .node }}
{{- else if and $isPostSelf (eq ($currentNode.Scratch.Get "relearnNextPage") nil) }}
{{- $currentNode.Scratch.Set "relearnNextPage" .node }}
{{- end}}
{{- end }}
{{- $currentNode.Scratch.Set "relearnSubPages" .node.Pages }}
{{- if .node.IsHome}}
{{- $currentNode.Scratch.Set "relearnSubPages" .node.Sections }}
{{- else if .node.Sections}}
{{- $currentNode.Scratch.Set "relearnSubPages" (.node.Pages | union .node.Sections) }}
{{- end}}
{{- $pages := ($currentNode.Scratch.Get "relearnSubPages") }}
{{- if eq .Site.Params.ordersectionsby "title"}}
{{- range $pages.ByTitle }}
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hidden" $hidden_from_current }}
{{- end}}
{{- else}}
{{- range $pages.ByWeight }}
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hidden" $hidden_from_current }}
{{- end}}
{{- end }}
{{- end }}
<body class="" data-url="{{ .RelPermalink }}">
{{ partial "menu.html" . }}
<section id="body">
<div id="overlay"></div>
<div class="padding highlightable">
{{if not .IsHome}}
<div>
<div id="top-bar">
{{ if and (or .IsPage .IsSection) .Site.Params.editURL }}
{{ $File := .File }}
{{ $Site := .Site }}
{{with $File.Path }}
<div id="top-github-link">
<a class="github-link" title='{{T "Edit-this-page"}}' href="{{ $Site.Params.editURL }}{{ replace $File.Dir "\\" "/" }}{{ $File.LogicalName }}" target="blank">
<i class="fas fa-code-branch"></i>
<span id="top-github-link-text">{{T "Edit-this-page"}}</span>
</a>
</div>
{{ end }}
{{ end }}
{{$toc := (and (not .Params.disableToc) (not .Params.chapter))}}
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fas fa-bars"></i>
</a>
</span>
{{ if $toc }}
<span id="toc-menu"><i class="fas fa-list-alt"></i></span>
{{ end }}
<span class="links">
{{$showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb))}}
{{if $showBreadcrumb}}
{{ template "breadcrumb" dict "page" . "value" .Title }}
{{ else }}
{{ .Title }}
{{ end }}
</span>
</div>
{{ if $toc }}
{{ partial "toc.html" . }}
{{ end }}
</div>
</div>
{{ end }}
<div id="head-tags">
{{ partial "tags.html" . }}
</div>
{{ if .Params.chapter }}
<div id="chapter">
{{ end }}
<div id="body-inner">
{{if and (not .IsHome) (not .Params.chapter) }}
<h1>
{{ if eq .Kind "term" }}
{{.Data.Singular}} ::
{{ end }}
{{.Title}}
</h1>
{{end}}
{{define "breadcrumb"}}
{{$parent := .page.Parent }}
{{ if $parent }}
{{ $value := (printf "<a href='%s'>%s</a> > %s" $parent.RelPermalink $parent.Title .value) }}
{{ template "breadcrumb" dict "page" $parent "value" $value }}
{{else}}
{{.value|safeHTML}}
{{end}}
{{end}}