directly include icons as svgs

This commit is contained in:
Niklas Buschmann
2020-02-18 17:55:14 +01:00
parent 56ce3fcba0
commit d1ebe75f4e
7 changed files with 56439 additions and 17 deletions

View File

@@ -7,9 +7,6 @@
<meta name="description" content="{{ .Description | default .Site.Params.description }}">
{{- end }}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{- if .Site.Params.fontawesome }}
{{ partial "font-awesome.html" . }}
{{- end }}
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/index.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/classes.css">
{{- if .Site.Params.sidebar }}
@@ -21,16 +18,23 @@
{{ partial "math.html" . }}
{{- end }}
{{ $font_awesome := getJSON "themes/contrast-hugo/static/font-awesome/icons.json" }}
<body>
<header>
<header class="icons">
{{ if not (gt (len .Site.Menus) 1) }}
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
{{ end }}
{{ range .Site.Menus }}
{{ range $menu, $items := .Site.Menus }}
<nav>
{{ range . }}
<a href="{{ .URL }}" {{ if (eq $.RelPermalink .URL) }}class="selected"{{ end }}>{{ .Pre }}{{ .Name }}{{ .Post }}</a>
{{ range $items }}
{{ $icon := index $font_awesome .Identifier }}
{{ $svg := $icon.svg.solid | default $icon.svg.regular | default $icon.svg.brands }}
<a href="{{ .URL }}" {{ if (eq $.RelPermalink .URL) }}class="selected"{{ end }}>
<span {{ if eq $menu "main" }}class="hidden"{{ end }}>{{ safeHTML $svg.raw }}</span>
<span {{ if not (eq $menu "main") }}class="hidden"{{ end }}>{{ .Name }}</span>
</a>
{{ end }}
</nav>
{{ end }}

View File

@@ -1 +0,0 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css">