contrast-hugo/layouts/_default/baseof.html
Niklas Buschmann 1230c7959d add safeguards
2020-02-20 15:16:34 +01:00

53 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode | default "en" }}">
<title>{{ if .Title }}{{ .Title }} | {{ end }}{{ .Site.Title }}</title>
<meta charset="utf-8">
{{ hugo.Generator }}
{{- if or .Description .Site.Params.description }}
<meta name="description" content="{{ .Description | default .Site.Params.description }}">
{{- end }}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/index.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/classes.css">
{{- if .Site.Params.sidebar }}
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/sidebar.css" media="screen and (min-width: 70em)">
{{- end }}
<link rel="canonical" href="{{ .Permalink }}">
<link rel="alternate" type="application/rss+xml" href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" title="{{ .Site.Title }}">
{{- if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{- end }}
<body>
<header class="icons">
{{ if not (gt (len .Site.Menus) 1) }}
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
{{ end }}
{{ range $menu, $items := .Site.Menus }}
<nav>
{{ range $items }}
<a href="{{ .URL }}" {{ if (eq $.RelPermalink .URL) }}class="selected"{{ end }}>
{{ if and .Identifier (index $.Site.Data.fontawesome.icons .Identifier) }}
{{ $icon := index $.Site.Data.fontawesome.icons .Identifier }}
{{ $svg := $icon.svg.solid | default $icon.svg.regular | default $icon.svg.brands }}
<span {{ if eq $menu "main" }}class="hidden"{{ end }}>{{ safeHTML $svg.raw }}</span>
<span {{ if not (eq $menu "main") }}class="hidden"{{ end }}>{{ .Name }}</span>
{{ else }}
{{ .Name }}
{{ end }}
</a>
{{ end }}
</nav>
{{ end }}
{{ with .Site.Params.description }}
<div class="hidden description">{{ safeHTML . }}</div>
{{ end }}
</header>
{{- block "main" . }}{{- end }}
</body>
</html>