1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-18 16:05:33 -04:00

minor hugo template refactoring before updating

This commit is contained in:
2021-12-18 10:36:18 -05:00
parent 0bac7577a6
commit 76cceb0001
23 changed files with 133 additions and 120 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
public/ public/
builds/ builds/
_vendor/ _vendor/
assets/jsconfig.json
hugo_stats.json hugo_stats.json
.hugo_build.lock .hugo_build.lock

View File

@@ -27,6 +27,8 @@ body {
} }
code, code,
kbd,
samp,
pre, pre,
.monospace { .monospace {
font-family: settings.$font-stack-mono; font-family: settings.$font-stack-mono;
@@ -42,6 +44,8 @@ pre,
} }
code, code,
kbd,
samp,
pre, pre,
.monospace { .monospace {
font-family: settings.$font-stack-mono-variable; font-family: settings.$font-stack-mono-variable;
@@ -55,6 +59,8 @@ pre,
// Roboto Mono doesn't have this problem, but the above fix breaks it, of course. // Roboto Mono doesn't have this problem, but the above fix breaks it, of course.
code, code,
kbd,
samp,
pre, pre,
.monospace { .monospace {
font-style: italic !important; font-style: italic !important;

View File

@@ -88,7 +88,7 @@ div.layout-contact {
); );
} }
svg.emoji { .emoji {
margin-left: 0; margin-left: 0;
margin-right: 0.4em; margin-right: 0.4em;
cursor: inherit; cursor: inherit;

View File

@@ -135,9 +135,13 @@ div.layout-home {
font-weight: 500; font-weight: 500;
letter-spacing: -0.014em; letter-spacing: -0.014em;
img.emoji { .emoji {
margin-left: 0.1em; // a little extra social distancing for the hand margin-left: 0.1em; // a little extra social distancing for the hand
} }
.wave {
margin-left: 2px;
}
} }
h2 { h2 {
@@ -163,7 +167,7 @@ div.layout-home {
word-spacing: -0.3em; word-spacing: -0.3em;
margin-right: 0.1em; margin-right: 0.1em;
img.emoji { .emoji {
vertical-align: -0.2em; // magic number to align with text :\ vertical-align: -0.2em; // magic number to align with text :\
padding: 0; padding: 0;
} }
@@ -190,10 +194,6 @@ div.layout-home {
) )
); );
} }
&.wave {
margin-left: 2px;
}
} }
} }

View File

@@ -36,7 +36,7 @@ div.layout-single {
margin-right: 0.4em; margin-right: 0.4em;
user-select: none; user-select: none;
img.emoji { .emoji {
margin-right: 0.25em; margin-right: 0.25em;
vertical-align: -0.22em; vertical-align: -0.22em;
cursor: inherit; cursor: inherit;

View File

@@ -155,7 +155,6 @@ imaging:
quality: 100 quality: 100
build: build:
noJSConfigInAssets: true
# don't use cache for SCSS compilation, better to throw error than be stale # don't use cache for SCSS compilation, better to throw error than be stale
useResourceCacheWhen: never useResourceCacheWhen: never

View File

@@ -5,7 +5,7 @@ description: "Things I use daily."
image: "images/bigsur.png" image: "images/bigsur.png"
layout: etc layout: etc
css: | css: |
h2 img.emoji { h2 .emoji {
margin-right: 2px; margin-right: 2px;
} }
--- ---

View File

@@ -1 +1 @@
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . | safeHTMLAttr }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a> <a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . | safeHTMLAttr }}"{{ end }}{{ if (urls.Parse .Destination).IsAbs }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>

View File

@@ -1,13 +1,12 @@
<!doctype html> <!doctype html>
{{ printf "<!-- htmlmin:ignore -->" | safeHTML -}}
{{ printf "<!--\n ,,, ,,,\n ;\" ^; ;\" \",\n ; s$$$$$s ;\n , ss$$$$$$$ss ,\"\n ;$$$$$$$$$$$$$$$$\n $$$$$$$$$$$$$$$$$$ Hello, human. :)\n $$$$$\"\"\"$$$\"\"\"$$$$$$\n $$$$$ p\"$$$\"q $$$$$ %s\n $$$$ .$$$$$. $$$$\n $$$$$$$$$$$$$$$$$\n \"$$$$\"*\"$$$$\"\n \"$$.$$\"\n-->" (print .Site.Params.baseURL "/humans.txt") | safeHTML }}
{{- printf "<!-- htmlmin:ignore -->" | safeHTML }}
{{- partial "functions/prepare-meta" . -}} {{- partial "functions/prepare-meta" . -}}
{{- partial "functions/prepare-js" . -}} {{- partial "functions/prepare-js" . -}}
{{- partial "functions/prepare-css" . -}} {{- partial "functions/prepare-css" . -}}
<html lang="{{ .Site.LanguageCode | default "en" }}"{{ with .Site.Params.Theme.defaultTheme }} class="{{ . }}" style="color-scheme: {{ . }};"{{ end }}> {{ printf "<!-- htmlmin:ignore --><!--\n ,,, ,,,\n ;\" ^; ;\" \",\n ; s$$$$$s ;\n , ss$$$$$$$ss ,\"\n ;$$$$$$$$$$$$$$$$\n $$$$$$$$$$$$$$$$$$ Hello, human. :)\n $$$$$\"\"\"$$$\"\"\"$$$$$$\n $$$$$ p\"$$$\"q $$$$$ %s\n $$$$ .$$$$$. $$$$\n $$$$$$$$$$$$$$$$$\n \"$$$$\"*\"$$$$\"\n \"$$.$$\"\n--><!-- htmlmin:ignore -->" (print .Site.Params.baseURL "/humans.txt") | safeHTML }}
<html lang="{{ .Site.LanguageCode | default "en" }}"{{ with .Site.Params.Theme.defaultTheme }} class="{{ . }}"{{ end }}>
<head> <head>
{{ partial "head/_head" . }} {{ partial "head/_head" . }}
</head> </head>
@@ -20,4 +19,5 @@
{{ template "__body_js" . }} {{ template "__body_js" . }}
</body> </body>
</html> </html>
{{- partial "functions/debug" . -}} {{- partial "functions/debug" . -}}

View File

@@ -1,6 +1,6 @@
{{/* Output these variables for debugging purposes: */}} {{/* Output these variables for debugging purposes: */}}
{{- printf "<!-- htmlmin:ignore -->" | safeHTML }} {{- print "<!-- htmlmin:ignore -->" | safeHTML }}
{{ with hugo }}{{ with .Environment }}{{ printf "<!-- env: %s -->" . | safeHTML }}{{ end }}{{ end }} {{ with hugo }}{{ with .Environment }}{{ printf "<!-- env: %s -->" . | safeHTML }}{{ end }}{{ end }}
{{ with .GitInfo }}{{ with .AbbreviatedHash }}{{ printf "<!-- commit: %s -->" . | safeHTML }}{{ end }}{{ end }} {{ with .GitInfo }}{{ with .AbbreviatedHash }}{{ printf "<!-- commit: %s -->" . | safeHTML }}{{ end }}{{ end }}
{{ with .File }}{{ with .Path }}{{ printf "<!-- source: content/%s -->" . | safeHTML }}{{ end }}{{ end }} {{ with .File }}{{ with .Path }}{{ printf "<!-- source: content/%s -->" . | safeHTML }}{{ end }}{{ end }}
{{- printf "<!-- htmlmin:ignore -->" | safeHTML }} {{- print "<!-- htmlmin:ignore -->" | safeHTML }}

View File

@@ -8,7 +8,7 @@
{{/* Page-specific styles set via front matter, piped through PostCSS and inlined */}} {{/* Page-specific styles set via front matter, piped through PostCSS and inlined */}}
{{- with .Params.css -}} {{- with .Params.css -}}
{{/* NOTE: This file doesn't end up getting published (which is good) */}} {{/* NOTE: This file doesn't end up getting published (which is good) */}}
{{- $target := path.Join $.File.Dir "css/inline.scss" -}} {{- $target := path.Join $.File.Dir "css/inline.css" -}}
{{- $css := . | resources.FromString $target -}} {{- $css := . | resources.FromString $target -}}
<style> <style>
{{ $css.Content | safeCSS }} {{ $css.Content | safeCSS }}

View File

@@ -1,6 +1,16 @@
{{/* Pull in JS processed by Webpack */}} {{- define "__head_js" -}}
{{/* A super tiny script to restore dark mode off the bat (to hopefully avoid blinding flashes of white) */}}
{{ $themeScript := resources.Get "js/restore-theme.js" | js.Build (dict "target" "es2015" "format" "iife") }}
{{ with $themeScript }}
<script>
{{ .Content | safeJS }}
</script>
{{ end }}
{{- end -}}
{{- define "__body_js" -}} {{- define "__body_js" -}}
{{/* Pull in JS processed by Webpack */}}
{{ with partial "functions/webpack" (dict "context" . "src" "main.js") }} {{ with partial "functions/webpack" (dict "context" . "src" "main.js") }}
<script async defer src="{{ .src }}"></script> <script async defer src="{{ .src }}"></script>
{{ end }} {{ end }}

View File

@@ -1,9 +1,9 @@
{{ partial "head/meta" . -}} {{ partial "head/meta" . -}}
{{ partial "head/open-graph" . -}} {{ partial "head/open-graph" . -}}
{{ partial "head/canonical" . -}} {{ partial "head/canonical" . -}}
{{ partialCached "head/restore-theme" . -}}
{{ partialCached "head/preload" . -}} {{ partialCached "head/preload" . -}}
{{ partial "head/styles" . -}} {{ template "__head_css" . -}}
{{ partialCached "head/favicons" . -}} {{ partialCached "head/favicons" . -}}
{{ partialCached "head/misc" . -}} {{ partialCached "head/misc" . -}}
{{ template "__head_js" . -}}
{{ partial "head/schema" . -}} {{ partial "head/schema" . -}}

View File

@@ -22,9 +22,11 @@
<meta property="article:modified_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}"> <meta property="article:modified_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
{{- end }} {{- end }}
{{- with .Site.Author.social.facebook }} {{- with .Site.Author.social.facebook }}
<meta property="article:author" content="https://www.facebook.com/{{ . }}">{{ end }} <meta property="article:author" content="https://www.facebook.com/{{ . }}">
{{- end }}
{{- with .Params.tags }}{{ range . }} {{- with .Params.tags }}{{ range . }}
<meta property="article:tag" content="{{ . }}">{{ end }}{{ end }} <meta property="article:tag" content="{{ . }}">
{{- end }}{{ end }}
{{ end -}} {{ end -}}
{{- with .Site.Author.social.facebookid }} {{- with .Site.Author.social.facebookid }}
@@ -40,7 +42,9 @@
<meta name="twitter:site" content="{{ print "@" . }}"> <meta name="twitter:site" content="{{ print "@" . }}">
<meta name="twitter:creator" content="{{ print "@" . }}"> <meta name="twitter:creator" content="{{ print "@" . }}">
{{ end -}} {{ end -}}
{{ with .Site.Author.social.twitterid }}<meta name="twitter:creator_id" content="{{ . }}">{{ end }} {{ with .Site.Author.social.twitterid }}
<meta name="twitter:creator_id" content="{{ . }}">
{{ end }}
<meta name="twitter:dnt" content="on"> <meta name="twitter:dnt" content="on">
<meta name="twitter:widgets:csp" content="on"> <meta name="twitter:widgets:csp" content="on">

View File

@@ -1,6 +0,0 @@
{{ $themeScript := resources.Get "js/restore-theme.js" | js.Build (dict "target" "es2015" "format" "iife") }}
{{ with $themeScript }}
<script>
{{ .Content | safeJS }}
</script>
{{ end }}

View File

@@ -1 +0,0 @@
{{ template "__head_css" . }}

View File

@@ -10,12 +10,13 @@
<ul id="header-menu"> <ul id="header-menu">
{{- range .Site.Menus.main }} {{- range .Site.Menus.main }}
<li> <li>
<a class="header-menu-item" {{ printf "href=%q" .URL | safeHTMLAttr }} aria-label="{{ .Name }}"{{ if strings.HasPrefix .URL "http" }} target="_blank" rel="me noopener"{{ end }}> <a class="header-menu-item" href="{{ .URL }}" aria-label="{{ .Name }}">
<span class="header-menu-icon">{{ .Pre }}</span> <span class="header-menu-icon">{{ .Pre }}</span>
<span class="header-menu-text">{{ .Name }}</span> <span class="header-menu-text">{{ .Name }}</span>
</a> </a>
</li> </li>
{{- end }} {{- end }}
<li class="theme-toggle"></li> <li class="theme-toggle"></li>
</ul> </ul>
</nav> </nav>

View File

@@ -1,7 +1,7 @@
{{- $optimized := partial "functions/optimize-image" . -}} {{- $optimized := partial "functions/optimize-image" . -}}
<figure> <figure>
{{ with .Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }} {{ with .Get "link" }}<a class="no-underline" href="{{ . }}"{{ if (urls.Parse .).IsAbs }} target="_blank" rel="noopener"{{ end }}>{{ end }}
<img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}" <img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
{{- with .Inner }} {{- with .Inner }}
alt="{{ . | $.Page.RenderString | plainify | safeHTML }}" alt="{{ . | $.Page.RenderString | plainify | safeHTML }}"

View File

@@ -80,7 +80,7 @@
"gulp-imagemin": "^8.0.0", "gulp-imagemin": "^8.0.0",
"hugo-extended": "0.90.1", "hugo-extended": "0.90.1",
"license-webpack-plugin": "^4.0.0", "license-webpack-plugin": "^4.0.0",
"lint-staged": "^12.1.2", "lint-staged": "^12.1.3",
"markdownlint-cli": "~0.30.0", "markdownlint-cli": "~0.30.0",
"mini-css-extract-plugin": "^2.4.5", "mini-css-extract-plugin": "^2.4.5",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",

View File

@@ -2538,9 +2538,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0" lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001179, caniuse-lite@^1.0.30001251, caniuse-lite@^1.0.30001272, caniuse-lite@^1.0.30001286: caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001179, caniuse-lite@^1.0.30001251, caniuse-lite@^1.0.30001272, caniuse-lite@^1.0.30001286:
version "1.0.30001287" version "1.0.30001289"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001287.tgz#5fab6a46ab9e47146d5dd35abfe47beaf8073c71" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001289.tgz#d62a20175c4d9e740feda12a78b7c8df7866329e"
integrity sha512-4udbs9bc0hfNrcje++AxBuc6PfLNHwh3PO9kbwnfCQWyqtlzg3py0YgFu8jyRTTo85VAz4U+VLxSlID09vNtWA== integrity sha512-hV6x4IfrYViN8cJbGFVbjD7KCrhS/O7wfDgvevYRanJ/IN+hhxpTcXXqaxy3CzPNFe5rlqdimdEB/k7H0YzxHg==
careful-downloader@^2.0.1: careful-downloader@^2.0.1:
version "2.0.1" version "2.0.1"
@@ -3225,7 +3225,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
dependencies: dependencies:
ms "2.0.0" ms "2.0.0"
debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2: debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3:
version "4.3.3" version "4.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664"
integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==
@@ -3685,7 +3685,7 @@ enhanced-resolve@^5.8.3:
graceful-fs "^4.2.4" graceful-fs "^4.2.4"
tapable "^2.2.0" tapable "^2.2.0"
enquirer@^2.3.5, enquirer@^2.3.6: enquirer@^2.3.5:
version "2.3.6" version "2.3.6"
resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d"
integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==
@@ -6343,27 +6343,26 @@ linkify-it@^3.0.1:
dependencies: dependencies:
uc.micro "^1.0.1" uc.micro "^1.0.1"
lint-staged@^12.1.2: lint-staged@^12.1.3:
version "12.1.2" version "12.1.3"
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-12.1.2.tgz#90c571927e1371fc133e720671dd7989eab53f74" resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-12.1.3.tgz#a16e885c0a5e77de9cf559724d29a10348670e68"
integrity sha512-bSMcQVqMW98HLLLR2c2tZ+vnDCnx4fd+0QJBQgN/4XkdspGRPc8DGp7UuOEBe1ApCfJ+wXXumYnJmU+wDo7j9A== integrity sha512-ajapdkaFxx+MVhvq6xQRg9zCnCLz49iQLJZP7+w8XaA3U4B35Z9xJJGq9vxmWo73QTvJLG+N2NxhjWiSexbAWQ==
dependencies: dependencies:
cli-truncate "^3.1.0" cli-truncate "^3.1.0"
colorette "^2.0.16" colorette "^2.0.16"
commander "^8.3.0" commander "^8.3.0"
debug "^4.3.2" debug "^4.3.3"
enquirer "^2.3.6"
execa "^5.1.1" execa "^5.1.1"
lilconfig "2.0.4" lilconfig "2.0.4"
listr2 "^3.13.3" listr2 "^3.13.5"
micromatch "^4.0.4" micromatch "^4.0.4"
normalize-path "^3.0.0" normalize-path "^3.0.0"
object-inspect "^1.11.0" object-inspect "^1.11.1"
string-argv "^0.3.1" string-argv "^0.3.1"
supports-color "^9.0.2" supports-color "^9.2.1"
yaml "^1.10.2" yaml "^1.10.2"
listr2@^3.13.3: listr2@^3.13.5:
version "3.13.5" version "3.13.5"
resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.13.5.tgz#105a813f2eb2329c4aae27373a281d610ee4985f" resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.13.5.tgz#105a813f2eb2329c4aae27373a281d610ee4985f"
integrity sha512-3n8heFQDSk+NcwBn3CgxEibZGaRzx+pC64n3YjpMD1qguV4nWus3Al+Oo3KooqFKTQEJ1v7MmnbnyyNspgx3NA== integrity sha512-3n8heFQDSk+NcwBn3CgxEibZGaRzx+pC64n3YjpMD1qguV4nWus3Al+Oo3KooqFKTQEJ1v7MmnbnyyNspgx3NA==
@@ -7177,10 +7176,10 @@ object-copy@^0.1.0:
define-property "^0.2.5" define-property "^0.2.5"
kind-of "^3.0.3" kind-of "^3.0.3"
object-inspect@^1.11.0, object-inspect@^1.9.0: object-inspect@^1.11.0, object-inspect@^1.11.1, object-inspect@^1.9.0:
version "1.11.1" version "1.12.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.1.tgz#d4bd7d7de54b9a75599f59a00bd698c1f1c6549b" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0"
integrity sha512-If7BjFlpkzzBeV1cqgT3OSWT3azyoxDGajR+iGnFBfVV2EWyDyWaZZW2ERDjUaY2QM8i5jI3Sj7mhsM4DDAqWA== integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==
object-is@^1.0.1: object-is@^1.0.1:
version "1.1.5" version "1.1.5"
@@ -9630,7 +9629,7 @@ supports-color@^8.0.0:
dependencies: dependencies:
has-flag "^4.0.0" has-flag "^4.0.0"
supports-color@^9.0.2: supports-color@^9.2.1:
version "9.2.1" version "9.2.1"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.2.1.tgz#599dc9d45acf74c6176e0d880bab1d7d718fe891" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.2.1.tgz#599dc9d45acf74c6176e0d880bab1d7d718fe891"
integrity sha512-Obv7ycoCTG51N7y175StI9BlAXrmgZrFhZOb0/PyjHBher/NmsdBgbbQ1Inhq+gIhz6+7Gb+jWF2Vqi7Mf1xnQ== integrity sha512-Obv7ycoCTG51N7y175StI9BlAXrmgZrFhZOb0/PyjHBher/NmsdBgbbQ1Inhq+gIhz6+7Gb+jWF2Vqi7Mf1xnQ==