mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-07 00:58:13 +00:00
Tweak theme
This commit is contained in:
10
themes/custom-theme/layouts/partials/head/dark-mode.html
Normal file
10
themes/custom-theme/layouts/partials/head/dark-mode.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{ $jsBuildOptions := dict "target" "es6" }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $jsBuildOptions = $jsBuildOptions | merge (dict "minify" "true") }}
|
||||
{{ end }}
|
||||
|
||||
{{ $darkMode := resources.Get "js/dark-mode.js" | js.Build $jsBuildOptions }}
|
||||
|
||||
<script>
|
||||
{{ $darkMode.Content | safeJS }}
|
||||
</script>
|
7
themes/custom-theme/layouts/partials/head/favicons.html
Normal file
7
themes/custom-theme/layouts/partials/head/favicons.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#282828" />
|
||||
<meta name="msapplication-TileColor" content="#282828" />
|
||||
<meta name="theme-color" content="#282828" />
|
21
themes/custom-theme/layouts/partials/head/head.html
Normal file
21
themes/custom-theme/layouts/partials/head/head.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
{{ partial "head/resource-hints.html" . }}
|
||||
{{ partial "head/seo.html" . }}
|
||||
|
||||
|
||||
<!-- Extensibility -->
|
||||
{{ partial "head/head_start.html" . }}
|
||||
|
||||
{{ partial "head/stylesheets.html" . }}
|
||||
|
||||
{{ partial "head/dark-mode.html" . }}
|
||||
|
||||
{{ partial "head/favicons.html" . }}
|
||||
|
||||
|
||||
<!-- Extensibility -->
|
||||
{{ partial "head/head_end.html" . }}
|
||||
</head>
|
3
themes/custom-theme/layouts/partials/head/head_end.html
Normal file
3
themes/custom-theme/layouts/partials/head/head_end.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<!--
|
||||
Add custom HTML at the end of <head>
|
||||
-->
|
@@ -0,0 +1,3 @@
|
||||
<!--
|
||||
Add custom HTML at the start of <head>
|
||||
-->
|
@@ -0,0 +1,42 @@
|
||||
<!-- Preload commonly used font variations -->
|
||||
|
||||
<!-- Roboto Slab -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/roboto-slab-latin-400.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/roboto-slab-latin-700.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
|
||||
<!-- Fira Code -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/fira-code-latin-300.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/fira-code-latin-400.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
href="/fonts/fira-code-latin-700.woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
55
themes/custom-theme/layouts/partials/head/seo.html
Normal file
55
themes/custom-theme/layouts/partials/head/seo.html
Normal file
@@ -0,0 +1,55 @@
|
||||
{{ if eq .Kind "404" }}
|
||||
<meta name="robots" content="noindex, follow" />
|
||||
{{ else }}
|
||||
{{ with .Params.robots }}
|
||||
<meta name="robots" content="{{ . }}" />
|
||||
{{ else }}
|
||||
<meta
|
||||
name="robots"
|
||||
content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"
|
||||
/>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $title := .Title }}
|
||||
{{ if .IsHome }}
|
||||
{{ $title = .Site.Title }}
|
||||
{{ with .Site.Params.Subtitle }}
|
||||
{{ $title = printf "%s — %s" $title . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<title>{{ $title }}</title>
|
||||
|
||||
<meta
|
||||
name="description"
|
||||
content="
|
||||
{{- with .Description -}}
|
||||
{{- . -}}
|
||||
{{- else -}}
|
||||
{{- with .Summary | plainify -}}
|
||||
{{- . -}}
|
||||
{{- else -}}
|
||||
{{- .Site.Params.description -}}
|
||||
{{- end -}}
|
||||
{{- end -}}"
|
||||
/>
|
||||
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
|
||||
<!-- Internal Hugo templates -->
|
||||
<!-- See https://gohugo.io/templates/internal -->
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/schema.html" . }}
|
||||
|
||||
|
||||
<!-- RSS feed -->
|
||||
<!-- See https://gohugo.io/templates/rss/#reference-your-rss-feed-in-head -->
|
||||
{{ range .AlternativeOutputFormats }}
|
||||
<link
|
||||
rel="{{ .Rel }}"
|
||||
type="{{ .MediaType.Type }}"
|
||||
href="{{ .RelPermalink }}"
|
||||
title="{{ $.Site.Title }}"
|
||||
/>
|
||||
{{ end }}
|
67
themes/custom-theme/layouts/partials/head/stylesheets.html
Normal file
67
themes/custom-theme/layouts/partials/head/stylesheets.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!-- Styles -->
|
||||
{{ $defaultTheme := .Param "defaultTheme" | default "light" }}
|
||||
|
||||
{{ $critical := sort (resources.Match "css/critical/*.css") "Name" | resources.Concat nil | resources.ExecuteAsTemplate nil . | resources.PostCSS }}
|
||||
{{ $nonCritical := sort (resources.Match "css/non-critical/*.css") "Name" | resources.Concat "css/non-critical.css" | resources.ExecuteAsTemplate "css/non-critical.css" . | resources.PostCSS }}
|
||||
{{ $prismDark := resources.Get "prism-themes/prism-coldark-dark.css" }}
|
||||
{{ $prismLight := resources.Get "prism-themes/prism-coldark-dark.css" }}
|
||||
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $critical = $critical | resources.PostProcess }}
|
||||
{{ $nonCritical = $nonCritical | fingerprint "sha512" | resources.PostProcess }}
|
||||
{{ $prismDark = $prismDark | minify | fingerprint "sha512" }}
|
||||
{{ $prismLight = $prismLight | minify | fingerprint "sha512" }}
|
||||
{{ end }}
|
||||
|
||||
<style>
|
||||
/* stylelint-disable */
|
||||
{{ $critical.Content | safeCSS }}
|
||||
/* stylelint-enable */
|
||||
</style>
|
||||
|
||||
<link
|
||||
rel="preload"
|
||||
href="{{ $nonCritical.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
/>
|
||||
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
id="prism-dark"
|
||||
rel="preload"
|
||||
href="{{ $prismDark.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
{{ if eq $defaultTheme "light" }}disabled{{ end }}
|
||||
/>
|
||||
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
id="prism-light"
|
||||
rel="preload"
|
||||
href="{{ $prismLight.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
{{ if eq $defaultTheme "dark" }}disabled{{ end }}
|
||||
/>
|
||||
|
||||
<noscript>
|
||||
{{ if eq $defaultTheme "light" }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $prismLight.RelPermalink }}"
|
||||
/>
|
||||
{{ else }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $prismDark.RelPermalink }}"
|
||||
/>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $nonCritical.RelPermalink }}"
|
||||
/>
|
||||
</noscript>
|
Reference in New Issue
Block a user