1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-13 05:45:31 -04:00

some cleanup around hugo + webpack manifest

This commit is contained in:
2021-07-04 10:49:43 -04:00
parent b61ffd3629
commit 865ad9743a
10 changed files with 66 additions and 54 deletions

View File

@@ -1,32 +1,34 @@
{
"name": "{{ .Site.Title }}",
"short_name": "{{ (urls.Parse .Site.Params.baseURL).Host }}",
{{- with .Site.Data.manifest }}
"icons": [
{{ with index .Site.Data.manifest "images/android-chrome-512x512.png" }}{
{{ with index . "images/android-chrome-512x512.png" }}{
"src": "{{ .src | absURL | safeJS }}",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},{{ end }}
{{ with index .Site.Data.manifest "images/android-chrome-192x192.png" }}{
{{ with index . "images/android-chrome-192x192.png" }}{
"src": "{{ .src | absURL | safeJS }}",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},{{ end }}
{{ with index .Site.Data.manifest "images/maskable-512x512.png" }}{
{{ with index . "images/maskable-512x512.png" }}{
"src": "{{ .src | absURL | safeJS }}",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
},{{ end }}
{{ with index .Site.Data.manifest "images/maskable-192x192.png" }}{
{{ with index . "images/maskable-192x192.png" }}{
"src": "{{ .src | absURL | safeJS }}",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
}{{ end }}
],
{{- end }}
"start_url": "/",
"display": "browser",
"background_color": "#ffffff",

View File

@@ -36,10 +36,10 @@
<script>(function(d){var u=d.document,f=u.body.classList,e=localStorage,c="dark_mode_pref",t=e.getItem(c),a="dark",n="light",r="{{ .Site.Params.Theme.defaultTheme | safeJS }}",o=u.querySelector(".dark-mode-toggle"),i=r===a,b=function(d){f.remove(a,n);f.add(d);i=d===a};t===a&&b(a);t===n&&b(n);if(!t){var s=function(d){return"(prefers-color-scheme: "+d+")"};d.matchMedia(s(a)).matches?b(a):d.matchMedia(s(n)).matches?b(n):b(r);d.matchMedia(s(a)).addListener((function(d){d.matches&&b(a)}));d.matchMedia(s(n)).addListener((function(d){d.matches&&b(n)}))}if(o){o.style.display="block";o.addEventListener("click",(function(){if(i){b(n);e.setItem(c,n)}else{b(a);e.setItem(c,a)}}),!0)}})(window)</script>
{{ with .Site.Data.manifest }}
{{ with index . "main.js" }}
{{ with index . "main.js" -}}
<script async defer src="{{ .src | absURL }}" ></script>
{{ end }}
{{ end }}
{{ end -}}
{{ end -}}
{{- end -}}
@@ -50,20 +50,22 @@
{{/* If this is a page/post, link View Source to specific file on GitHub; otherwise, just link to repo homepage */}}
{{- with .Site.Params.social.githubRepo }}
{{- $githubURL := print "https://github.com/" . }}
{{- if not $.IsPage }}
{{- $.Scratch.Set "sourceURL" $githubURL }}
{{- else }}
{{- $.Scratch.Set "sourceURL" (print $githubURL "/blob/main/content/" $.File.Path) }}
{{- end }}
{{- end }}
{{- with .Site.Params.social.githubRepo -}}
{{- $githubURL := print "https://github.com/" . -}}
{{- if not $.IsPage -}}
{{- $.Scratch.Set "sourceURL" $githubURL -}}
{{- else -}}
{{- $.Scratch.Set "sourceURL" (print $githubURL "/blob/main/content/" $.File.Path) -}}
{{- end -}}
{{- end -}}
{{/* Chooses and initializes various images for use by JSON schema & open graph tags */}}
{{/* Author image (default) */}}
{{- with index .Site.Data.manifest .Site.Author.image -}}
{{- $.Scratch.Set "authorImage" (dict "Permalink" (absURL .src) "Width" 1200 "Height" 1200 "MediaType" "image/jpeg") -}}
{{- with .Site.Data.manifest -}}
{{- with index . $.Site.Author.image -}}
{{- $.Scratch.Set "authorImage" (dict "Permalink" (absURL .src) "Width" 1200 "Height" 1200 "MediaType" "image/jpeg") -}}
{{- end -}}
{{- end -}}
{{/* Page image (via frontmatter) */}}
{{- with .Params.image -}}
@@ -77,6 +79,8 @@
{{- end -}}
{{- end -}}
{{/* Site logo */}}
{{- with index .Site.Data.manifest .Site.Params.image -}}
{{- $.Scratch.Set "logoImage" (dict "Permalink" (absURL .src) "Width" 2048 "Height" 2048 "MediaType" "image/png") -}}
{{- with .Site.Data.manifest -}}
{{- with index . $.Site.Params.image -}}
{{- $.Scratch.Set "logoImage" (dict "Permalink" (absURL .src) "Width" 2048 "Height" 2048 "MediaType" "image/png") -}}
{{- end -}}
{{- end -}}

View File

@@ -2,9 +2,9 @@
{{ partial "head/meta" . -}}
{{ partial "head/open-graph" . -}}
{{ partialCached "head/mobile" . -}}
{{ partial "head/canonical" . -}}
{{ partialCached "head/preload" . -}}
{{ partial "head/styles" . -}}
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32" "manifest" .Site.Data.manifest) -}}
{{ partialCached "head/feeds" . -}}
{{ partial "head/canonical" . -}}
{{ partialCached "head/favicons" . -}}
{{ partialCached "head/misc" . -}}
{{ partial "head/schema" . -}}

View File

@@ -1,9 +1,4 @@
{{ if .Site.Params.social.webmentionIO }}
<link rel="webmention" href="{{ "/api/mention/" | absURL }}">
<link rel="pingback" href="{{ "/api/ping/" | absURL }}">
{{ end }}
<link rel="canonical" href="{{ print .Site.Params.baseURL .Permalink }}">
<link rel="author" href="{{ "humans.txt" | absURL }}">
<link rel="pgpkey" href="{{ "pubkey.asc" | absURL }}" type="application/pgp-keys">
<link rel="alternate" href="{{ "feed.xml" | absURL }}" type="application/rss+xml" title="{{ .Site.Title }} (RSS)">
<link rel="alternate" href="{{ "feed.atom" | absURL }}" type="application/atom+xml" title="{{ .Site.Title }} (Atom)">

View File

@@ -1,12 +1,15 @@
{{- $s := slice -}}
{{- range (split .icoSizes " ") }}{{ $s = $s | append (printf "%vx%v" . .) }}{{ end -}}
{{- $faviconIco := index .manifest "images/favicon.ico" }}
<link rel="icon" href="{{ $faviconIco.src | absURL }}"> <!-- sizes="{{ delimit $s " " }}" -->
{{ with .Site.Data.manifest }}
{{- with index . "images/favicon.ico" }}
<link rel="icon" href="{{ .src | absURL }}">
{{- end }}
{{- $faviconSvg := index .manifest "images/favicon.svg" }}
<link rel="icon" href="{{ $faviconSvg.src | absURL }}" type="image/svg+xml">
{{- with index . "images/favicon.svg" }}
<link rel="icon" href="{{ .src | absURL }}" type="image/svg+xml">
{{- end -}}
{{- $appleIcon := index .manifest "images/apple-touch-icon.png" }}
<link rel="apple-touch-icon" href="{{ $appleIcon.src | absURL }}" sizes="180x180">
{{- with index . "images/apple-touch-icon.png" }}
<link rel="apple-touch-icon" href="{{ .src | absURL }}" sizes="180x180">
{{- end }}
{{ end }}
<link rel="manifest" href="{{ "site.webmanifest" | absURL }}">

View File

@@ -1,2 +0,0 @@
<link rel="alternate" href="{{ "feed.xml" | absURL }}" type="application/rss+xml" title="{{ .Site.Title }} (RSS)">
<link rel="alternate" href="{{ "feed.atom" | absURL }}" type="application/atom+xml" title="{{ .Site.Title }} (Atom)">

View File

@@ -0,0 +1,7 @@
{{ if .Site.Params.social.webmentionIO }}
<link rel="webmention" href="{{ "/api/mention/" | absURL }}">
<link rel="pingback" href="{{ "/api/ping/" | absURL }}">
{{ end }}
<link rel="author" href="{{ "humans.txt" | absURL }}">
<link rel="pgpkey" href="{{ "pubkey.asc" | absURL }}" type="application/pgp-keys">

View File

@@ -1,8 +1,10 @@
<header>
<nav>
<a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" aria-label="{{ .Site.Title }}">
{{ with index .Site.Data.manifest "images/tiny-selfie.jpg" }}
<img id="selfie" src="{{ .src | absURL }}" width="54" height="54" alt="Photo of Jake Jarvis">
{{ with .Site.Data.manifest }}
{{ with index . "images/tiny-selfie.jpg" }}
<img id="selfie" src="{{ .src | absURL }}" width="54" height="54" alt="Photo of Jake Jarvis">
{{ end }}
{{ end }}
<span id="name">{{ .Site.Title }}</span>

View File

@@ -2,7 +2,8 @@ User-Agent: *
{{- if eq hugo.Environment "production" }}
Disallow: /403.html
Disallow: /404.html
Disallow: /api/
Disallow: /api/mention/
Disallow: /api/ping/
Sitemap: {{ print .Site.Params.baseUrl "/sitemap.xml" }}
{{- else }}
Disallow: /

View File

@@ -1579,9 +1579,9 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.12.4, ajv@^6.12.5:
uri-js "^4.2.2"
ajv@^8.0.1:
version "8.6.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.0.tgz#60cc45d9c46a477d80d92c48076d972c342e5720"
integrity sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==
version "8.6.1"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.1.tgz#ae65764bf1edde8cd861281cda5057852364a295"
integrity sha512-42VLtQUOLefAvKFAQIxIZDaThq6om/PrfP0CYk3/vn+y4BMNkKnbli8ON2QCiHov4KkzOSJ/xSoBJdayiiYvVQ==
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
@@ -2398,9 +2398,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001166, caniuse-lite@^1.0.30001179, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001230:
version "1.0.30001241"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001241.tgz#cd3fae47eb3d7691692b406568d7a3e5b23c7598"
integrity sha512-1uoSZ1Pq1VpH0WerIMqwptXHNNGfdl7d1cJUFs80CwQ/lVzdhTvsFZCeNFslze7AjsQnb4C85tzclPa1VShbeQ==
version "1.0.30001242"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001242.tgz#04201627abcd60dc89211f22cbe2347306cda46b"
integrity sha512-KvNuZ/duufelMB3w2xtf9gEWCSxJwUgoxOx5b6ScLXC4kPc9xsczUVCPrQU26j5kOsHM4pSUL54tAZt5THQKug==
caw@^2.0.0, caw@^2.0.1:
version "2.0.1"
@@ -3120,9 +3120,9 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.9:
ms "2.0.0"
debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
dependencies:
ms "2.1.2"
@@ -4225,9 +4225,9 @@ fastest-levenshtein@^1.0.12:
integrity sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==
fastq@^1.6.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.11.0.tgz#bb9fb955a07130a918eb63c1f5161cc32a5d0858"
integrity sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==
version "1.11.1"
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.11.1.tgz#5d8175aae17db61947f8b162cfc7f63264d22807"
integrity sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==
dependencies:
reusify "^1.0.4"