1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-28 18:15:51 -04:00

clean up a bunch of layouts, especially social-images function

also made even more config.toml parameters optional, will help when finally releasing theme
This commit is contained in:
2020-06-25 10:35:59 -04:00
parent 0a48ce296f
commit f3198e0235
31 changed files with 167 additions and 162 deletions

View File

@@ -1,5 +1,5 @@
# Hugo stuff that doesn't play well with Prettier # Hugo stuff that doesn't play well with Prettier
assets/vendor/ assets/**/vendor/
layouts/ layouts/
static/ static/

View File

@@ -25,15 +25,15 @@ Run `yarn install` ([Yarn must be installed](https://yarnpkg.com/en/docs/install
### 🐳 Using Docker: ### 🐳 Using Docker:
To ensure consistency and compatibility, the [`Dockerfile`](Dockerfile) in this repository will download the correct versino of the Hugo Extended binary and its dependencies, and start a live testing server in the temporary container. To ensure consistency and compatibility, the [`Dockerfile`](Dockerfile) in this repository will download the correct version of the Hugo Extended binary and its dependencies, and start a live testing server in a temporary container.
Using Docker doesn't require Node or Yarn, but you can also use `yarn start:docker` which simply runs: Using Docker doesn't require Node or Yarn, but you can also use `yarn start:docker` (or `npm run start:docker`) which is simply an alias for:
```bash ```bash
docker run --rm -v $(pwd):/src -p 1337:1337 $(docker build --no-cache -q .) docker run --rm -v $(pwd):/src -p 1337:1337 $(docker build --no-cache -q .)
``` ```
...then open [http://localhost:1337/](http://localhost:1337/). Once built, these two methods act identically — simply open [http://localhost:1337/](http://localhost:1337/) as above.
### 🤯 Why does this sound _way_ more complex than it needs to be?! ### 🤯 Why does this sound _way_ more complex than it needs to be?!

View File

@@ -8,25 +8,28 @@
// Generate the needed variables, this seems like a lot of repetition, but it // Generate the needed variables, this seems like a lot of repetition, but it
// makes our script availble for multple destination which prevents us to // makes our script availble for multple destination which prevents us to
// need multiple scripts. The minified version stays small. // need multiple scripts. The minified version stays small.
var https = "https:"; var version = 3;
var functionName = "sa_event";
var pageviewsText = "pageview"; var pageviewsText = "pageview";
var https = "https:";
var protocol = https + "//"; var protocol = https + "//";
var con = window.console;
var slash = "/"; var slash = "/";
var fullApiUrl = protocol + baseUrl;
var doc = window.document;
var con = window.console;
var nav = window.navigator; var nav = window.navigator;
var screen = window.screen;
var loc = window.location; var loc = window.location;
var locationHostname = loc.hostname; var locationHostname = loc.hostname;
var doc = window.document;
var userAgent = nav.userAgent; var userAgent = nav.userAgent;
var notSending = "Not sending requests "; var documentElement = doc.documentElement || {};
var addEventListenerFunc = window.addEventListener;
var encodeURIComponentFunc = encodeURIComponent; var encodeURIComponentFunc = encodeURIComponent;
var decodeURIComponentFunc = decodeURIComponent; var decodeURIComponentFunc = decodeURIComponent;
var stringify = JSON.stringify; var stringify = JSON.stringify;
var thousand = 1000; var thousand = 1000;
var addEventListenerFunc = window.addEventListener;
var fullApiUrl = protocol + baseUrl;
var undefinedVar = undefined; var undefinedVar = undefined;
var documentElement = doc.documentElement || {}; var notSending = "Not sending requests ";
var language = "language"; var language = "language";
var Height = "Height"; var Height = "Height";
var Width = "Width"; var Width = "Width";
@@ -35,14 +38,12 @@
var offsetHeight = "offset" + Height; var offsetHeight = "offset" + Height;
var clientHeight = "client" + Height; var clientHeight = "client" + Height;
var clientWidth = "client" + Width; var clientWidth = "client" + Width;
var screen = window.screen;
var functionName = "sa_event";
var bot = /(bot|spider|crawl)/i.test(userAgent);
var payload = { var payload = {
version: 3, version: version,
}; };
var bot = /(bot|spider|crawl)/i.test(userAgent);
if (bot) payload.bot = true; if (bot) payload.bot = true;
var options = { var options = {

View File

@@ -113,6 +113,7 @@ button {
img.emoji { img.emoji {
height: 1.1em; height: 1.1em;
width: 1.1em; width: 1.1em;
margin: 0;
padding: 0 0.09em; padding: 0 0.09em;
vertical-align: -0.18em; vertical-align: -0.18em;

View File

@@ -2,7 +2,7 @@
// NOTE: all variables set by Hugo's config.toml MUST go here: // NOTE: all variables set by Hugo's config.toml MUST go here:
// prettier-ignore // prettier-ignore
$max-width: "{{ printf "%d%s" .Site.Params.pageMaxWidth "px" }}"; $max-width: "{{ printf "%d%s" .Site.Params.maxWidth "px" }}";
$base-url: "{{ strings.TrimRight "/" .Site.BaseURL }}" + "/"; $base-url: "{{ strings.TrimRight "/" .Site.BaseURL }}" + "/";
// those values need quotes because, even though prettier & stylelint are correct // those values need quotes because, even though prettier & stylelint are correct

View File

@@ -24,19 +24,19 @@ disableAliases = true
[params] [params]
description = "Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps." description = "Hi there! I'm a frontend web developer based in Boston, Massachusetts specializing in the JAMstack, modern JavaScript frameworks, and progressive web apps."
domain = "jarv.is" image = "img/logo.png" # must be in assetDir
mainSection = "notes" mainSection = "notes" # reflected in RSS, Atom, AMP
pageMaxWidth = 940 maxWidth = 940 # px
defaultImage = "img/me_large.jpg" githubRepo = "jakejarvis/jarv.is"
github = "jakejarvis/jarv.is"
facebookAppID = "3357248167622283" facebookAppID = "3357248167622283"
webmention = "jarv.is" webmentionIO = "jarv.is" # webmention.io username
copyrightFirstYear = "2001" copyrightFirstYear = "2001"
license = "CC-BY-4.0" license = "CC-BY-4.0"
licenseFull = "Creative Commons Attribution 4.0 International" licenseFull = "Creative Commons Attribution 4.0 International"
[author] [author]
name = "Jake Jarvis" name = "Jake Jarvis"
image = "img/me_large.jpg" # must be in assetDir
jobTitle = "Front-End Web Developer" jobTitle = "Front-End Web Developer"
email = "jake@jarv.is" email = "jake@jarv.is"
twitter = "jakejarvis" twitter = "jakejarvis"
@@ -51,7 +51,6 @@ disableAliases = true
[module] [module]
[[module.imports]] [[module.imports]]
path = "github.com/twitter/twemoji" path = "github.com/twitter/twemoji"
disable = false
[[module.imports.mounts]] [[module.imports.mounts]]
source = "assets/svg" source = "assets/svg"
target = "static/vendor/emoji/svg" target = "static/vendor/emoji/svg"

View File

@@ -12,8 +12,8 @@
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</div> </div>
{{ partialCached "page/footer" . }} {{ partialCached "page/footer" . }}
{{ partial "scripts/_bundle" . }} {{ partial "scripts/_bundle" . -}}
{{ partial "scripts/shortcodes" . }} {{ partial "scripts/shortcodes" . -}}
</body> </body>
</html> </html>

View File

@@ -90,7 +90,7 @@
padding-left: 1em; padding-left: 1em;
} }
article { article {
max-width: {{ printf "%d%s" .Site.Params.pageMaxWidth "px" }}; max-width: {{ printf "%d%s" .Site.Params.maxWidth "px" }};
margin: 0 auto; margin: 0 auto;
padding: 0 15px; padding: 0 15px;
line-height: 1.75; line-height: 1.75;
@@ -147,7 +147,7 @@
text-decoration: none; text-decoration: none;
} }
nav { nav {
max-width: {{ printf "%d%s" .Site.Params.pageMaxWidth "px" }}; max-width: {{ printf "%d%s" .Site.Params.maxWidth "px" }};
margin: 0 auto; margin: 0 auto;
padding: 0 15px; padding: 0 15px;
display: flex; display: flex;
@@ -198,7 +198,7 @@
} }
footer div.row { footer div.row {
width: 100%; width: 100%;
max-width: {{ printf "%d%s" .Site.Params.pageMaxWidth "px" }}; max-width: {{ printf "%d%s" .Site.Params.maxWidth "px" }};
margin: 0 auto; margin: 0 auto;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@@ -2,7 +2,7 @@
<main id="single"> <main id="single">
<article> <article>
<div id="meta"> <div id="meta">
<a class="no-underline" href="{{ .Permalink }}" title="{{ .Date.Format "Mon, Jan 2 2006 3:04:05 PM MST" }}">{{ .Date.Format "January 2, 2006" }}</a>{{ with .Site.Params.github }}<span class="dash"></span><a class="no-underline" href="https://github.com/{{ . }}/blob/main/content/{{ $.File.Path }}" title="Edit this post on GitHub" target="_blank" rel="noopener">Improve This Post</a>{{ end }} <a class="no-underline" href="{{ .Permalink }}" title="{{ .Date.Format "Mon, Jan 2 2006 3:04:05 PM MST" }}">{{ .Date.Format "January 2, 2006" }}</a>{{ with .Site.Params.githubRepo }}<span class="dash"></span><a class="no-underline" href="https://github.com/{{ . }}/blob/main/content/{{ $.File.Path }}" title="Edit this post on GitHub" target="_blank" rel="noopener">Improve This Post</a>{{ end }}
</div> </div>
<h1 id="title"><a class="no-underline" href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1> <h1 id="title"><a class="no-underline" href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>

View File

@@ -1,3 +1,4 @@
{{- $img := partial "functions/social-images" . -}}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom"> <feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ .Site.Title }}</title> <title>{{ .Site.Title }}</title>
@@ -10,8 +11,8 @@
{{- with .Site.Copyright }} {{- with .Site.Copyright }}
<rights>{{ . }}</rights> <rights>{{ . }}</rights>
{{- end }} {{- end }}
{{- with .Site.Params.defaultImage }} {{- with .Scratch.Get "authorImage" }}
<logo>{{ . | absURL }}</logo> <logo>{{ .Permalink }}</logo>
{{- end }} {{- end }}
<updated>{{ .Date.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated> <updated>{{ .Date.Format "2006-01-02T15:04:05Z" | safeHTML }}</updated>
{{- with .OutputFormats.Get "ATOM" }} {{- with .OutputFormats.Get "ATOM" }}

View File

@@ -2,7 +2,7 @@
{{- $android192 := resources.Get "img/android-chrome-192x192.png" -}} {{- $android192 := resources.Get "img/android-chrome-192x192.png" -}}
{ {
"name": "{{ .Site.Title }}", "name": "{{ .Site.Title }}",
"short_name": "{{ .Site.Params.domain }}", "short_name": "{{ (urls.Parse .Site.BaseURL).Host }}",
"icons": [ "icons": [
{ {
"src": "{{ $android512.Permalink | safeJS }}", "src": "{{ $android512.Permalink | safeJS }}",

View File

@@ -1,15 +1,15 @@
{{ $svg := resources.Get .src -}} {{- $svg := resources.Get .src -}}
{{ $html := $svg.Content -}} {{- $html := $svg.Content -}}
{{/* remove unneeded tags/attributes when SVG is inlined versus a .svg file */}} {{/* remove unneeded tags/attributes when SVG is inlined versus a .svg file */}}
{{ $html = replaceRE "<\\?xml.+\\?>" "" $html -}} {{- $html = replaceRE "<\\?xml.+\\?>" "" $html -}}
{{ $html = replaceRE " version=\"(.*?)\"" "" $html -}} {{- $html = replaceRE " version=\"(.*?)\"" "" $html -}}
{{ $html = replaceRE " xmlns=\"(.*?)\"" "" $html -}} {{- $html = replaceRE " xmlns=\"(.*?)\"" "" $html -}}
{{ $wxh := printf "<svg width=\"%d\" height=\"%d\"" .width .height }} {{- $wxh := printf "<svg width=\"%d\" height=\"%d\" " .width .height }}
{{ $html = replace $html "<svg" $wxh -}} {{- $html = replace $html "<svg " $wxh -}}
{{/* bit of a hack: calling .Permalink so that the SVG file is published too */}} {{/* bit of a hack: calling .Permalink so that the SVG file is published too, comment will be removed when minified */}}
{{ printf "<!-- auto-inlined from: %s -->" $svg.Permalink | safeHTML }} {{- printf "<!-- auto-inlined from: %s -->" $svg.Permalink | safeHTML }}
{{ $html | safeHTML -}} {{- $html | safeHTML -}}

View File

@@ -3,7 +3,7 @@
{{ $original := .Page.Resources.GetMatch (.Get "src") }} {{ $original := .Page.Resources.GetMatch (.Get "src") }}
{{ .Scratch.Set "image" $original }} {{ .Scratch.Set "image" $original }}
{{ $setWidth := .Site.Params.pageMaxWidth }} {{ $setWidth := .Site.Params.maxWidth }}
{{ if .Get "width" }} {{ if .Get "width" }}
{{ $setWidth = (int (.Get "width")) }} {{ $setWidth = (int (.Get "width")) }}
@@ -22,4 +22,4 @@
{{ $displayWidth := $setWidth }} {{ $displayWidth := $setWidth }}
{{ $displayHeight := (math.Ceil (mul $origRatio $setWidth)) }} {{ $displayHeight := (math.Ceil (mul $origRatio $setWidth)) }}
{{ return (dict "Permalink" $image.Permalink "Width" $displayWidth "Height" $displayHeight) }} {{ return (dict "Permalink" $image.Permalink "Width" $displayWidth "Height" $displayHeight "MediaType" $image.MediaType) }}

View File

@@ -1,28 +1,27 @@
{{/* Default image */}} {{/* Chooses and initializes various images for use by JSON schema & open graph tags */}}
{{- $defaultImage := resources.Get $.Site.Params.defaultImage }}
{{- $.Scratch.Set "defaultImage_url" $defaultImage.Permalink }} {{/* Author image (default) */}}
{{- $.Scratch.Set "defaultImage_width" $defaultImage.Width }} {{- with .Site.Author.image -}}
{{- $.Scratch.Set "defaultImage_height" $defaultImage.Height }} {{- with resources.Get . -}}
{{- $.Scratch.Set "defaultImage_type" $defaultImage.MediaType }} {{- $.Scratch.Set "authorImage" . -}}
{{- end -}}
{{- end -}}
{{/* Article image */}} {{/* Article image */}}
{{- with .Params.image }} {{- with .Params.image -}}
{{- $socialImage := $.Page.Resources.GetMatch . }} {{- with $.Page.Resources.GetMatch . -}}
{{- $.Scratch.Set "socialImage_url" $socialImage.Permalink }} {{- $.Scratch.Set "pageImage" . -}}
{{- $.Scratch.Set "socialImage_width" $socialImage.Width }} {{- end -}}
{{- $.Scratch.Set "socialImage_height" $socialImage.Height }} {{- else -}}
{{- $.Scratch.Set "socialImage_type" $socialImage.MediaType }} {{/* Fallback to author image set above */}}
{{ else }} {{- with $.Scratch.Get "authorImage" -}}
{{/* fallback to default image set above */}} {{- $.Scratch.Set "pageImage" . -}}
{{- $.Scratch.Set "socialImage_url" $defaultImage.Permalink }} {{- end -}}
{{- $.Scratch.Set "socialImage_width" $defaultImage.Width }} {{- end -}}
{{- $.Scratch.Set "socialImage_height" $defaultImage.Height }}
{{- $.Scratch.Set "socialImage_type" $defaultImage.MediaType }}
{{ end -}}
{{/* Site logo */}} {{/* Site logo */}}
{{- $logoImage := resources.Get "img/logo.png" }} {{- with .Site.Params.image -}}
{{- $.Scratch.Set "logoImage_url" $logoImage.Permalink }} {{- with resources.Get . -}}
{{- $.Scratch.Set "logoImage_width" $logoImage.Width }} {{- $.Scratch.Set "logoImage" . -}}
{{- $.Scratch.Set "logoImage_height" $logoImage.Height }} {{- end -}}
{{- $.Scratch.Set "logoImage_type" $logoImage.MediaType }} {{- end -}}

View File

@@ -2,13 +2,13 @@
{{ partial "functions/social-images" . -}} {{ partial "functions/social-images" . -}}
{{ partial "head/open-graph" . -}} {{ partial "head/open-graph" . -}}
{{ partialCached "head/mobile" . -}} {{ partialCached "head/mobile" . -}}
{{ partial "head/preload" . -}} {{ partialCached "head/preload" . -}}
{{ partial "head/styles" . -}} {{ partial "head/styles" . -}}
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") -}} {{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") -}}
{{ partialCached "head/feeds" . -}} {{ partialCached "head/feeds" . -}}
{{ partialCached "head/webmention" . -}} {{ partialCached "head/webmention" . -}}
{{ partial "head/canonical" . -}} {{ partial "head/canonical" . -}}
{{ partial "head/schema" . -}} {{ partial "head/schema" . -}}
{{ if eq hugo.Environment "production" }} {{ if eq hugo.Environment "production" -}}
{{ partial "scripts/simple_analytics_events" . -}} {{ partialCached "scripts/simple_analytics_events" . -}}
{{ end }} {{ end -}}

View File

@@ -7,10 +7,10 @@
{{- range (split .pngSizes " ") }} {{- range (split .pngSizes " ") }}
{{- $faviconPng := resources.Get (printf "img/favicon-%v.png" .) }} {{- $faviconPng := resources.Get (printf "img/favicon-%v.png" .) }}
<link rel="icon" href="{{ $faviconPng.Permalink }}" sizes="{{ . }}x{{ . }}"> <link rel="icon" href="{{ $faviconPng.Permalink }}" sizes="{{ . }}x{{ . }}">
{{- end }} {{- end -}}
{{- $s := slice }} {{- $s := slice -}}
{{- range (split .icoSizes " ") }}{{ $s = $s | append (printf "%vx%v" . .) }}{{ end }} {{- range (split .icoSizes " ") }}{{ $s = $s | append (printf "%vx%v" . .) }}{{ end -}}
{{- $faviconIco := resources.Get "img/favicon.ico" }} {{- $faviconIco := resources.Get "img/favicon.ico" }}
<link rel="shortcut icon" href="{{ $faviconIco.Permalink }}" sizes="{{ delimit $s " " }}"> <link rel="shortcut icon" href="{{ $faviconIco.Permalink }}" sizes="{{ delimit $s " " }}">

View File

@@ -5,11 +5,13 @@
<meta property="og:url" content="{{ .Permalink }}"> <meta property="og:url" content="{{ .Permalink }}">
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}"> <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
<meta property="og:image" content="{{ .Scratch.Get "socialImage_url" | absURL }}"> {{- with .Scratch.Get "pageImage" }}
<meta property="og:image:type" content="{{ .Scratch.Get "socialImage_type" }}"> <meta property="og:image" content="{{ .Permalink }}">
<meta property="og:image:width" content="{{ .Scratch.Get "socialImage_width" }}"> <meta property="og:image:type" content="{{ .MediaType }}">
<meta property="og:image:height" content="{{ .Scratch.Get "socialImage_height" }}"> <meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:alt" content="{{ .Title }}"> <meta property="og:image:height" content="{{ .Height }}">
<meta property="og:image:alt" content="{{ $.Title }}">
{{ end -}}
{{- if and .IsPage (eq .Type .Site.Params.mainSection) }} {{- if and .IsPage (eq .Type .Site.Params.mainSection) }}
{{- if not .PublishDate.IsZero }} {{- if not .PublishDate.IsZero }}
@@ -23,16 +25,16 @@
<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.facebookid }}<meta property="fb:admins" content="{{ . }}">{{ end }} {{ with .Site.Author.facebookid }}<meta property="fb:admins" content="{{ . }}">{{ end }}
{{ with .Site.Params.facebookAppID }}<meta property="fb:app_id" content="{{ . }}">{{ end }} {{ with .Site.Params.facebookAppID }}<meta property="fb:app_id" content="{{ . }}">{{ end }}
<meta name="twitter:card" content="{{ if .IsPage }}summary_large_image{{ else }}summary{{ end }}"> <meta name="twitter:card" content="{{ if .IsPage }}summary_large_image{{ else }}summary{{ end }}">
<meta name="twitter:domain" content="{{ .Site.Params.domain }}"> <meta name="twitter:domain" content="{{ (urls.Parse .Site.BaseURL).Host }}">
{{- with .Site.Author.twitter }} {{- with .Site.Author.twitter }}
<meta name="twitter:site" content="{{ printf "%s%s" "@" . }}"> <meta name="twitter:site" content="{{ printf "%s%s" "@" . }}">
<meta name="twitter:creator" content="{{ printf "%s%s" "@" . }}"> <meta name="twitter:creator" content="{{ printf "%s%s" "@" . }}">
{{- end }} {{ end -}}
{{ with .Site.Author.twitterid }}<meta name="twitter:creator_id" content="{{ . }}">{{ end }} {{ with .Site.Author.twitterid }}<meta name="twitter:creator_id" content="{{ . }}">{{ end }}
<meta name="twitter:dnt" content="on"> <meta name="twitter:dnt" content="on">

View File

@@ -1,6 +1,5 @@
{{ partial "head/schema/person" . -}}
{{ if and .IsPage (eq .Type .Site.Params.mainSection) }} {{ if and .IsPage (eq .Type .Site.Params.mainSection) }}
{{ partial "head/schema/person" . }} {{ partial "head/schema/article" . -}}
{{ partial "head/schema/article" . }}
{{ else }}
{{ partial "head/schema/person" . }}
{{ end -}} {{ end -}}

View File

@@ -17,19 +17,19 @@
"publisher": { "publisher": {
"@type": "Organization", "@type": "Organization",
"name": {{ .Site.Title }}, "name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }}, "url": {{ .Site.BaseURL }}{{ with .Scratch.Get "logoImage" }},
"logo": { "logo": {
"@type": "ImageObject", "@type": "ImageObject",
"url": {{ .Scratch.Get "logoImage_url" | absURL }}, "url": {{ .Permalink }},
"width": "{{ .Scratch.Get "logoImage_width" }}", "width": "{{ .Width }}",
"height": "{{ .Scratch.Get "logoImage_height" }}" "height": "{{ .Height }}"
} }{{ end }}
}, }{{ with .Scratch.Get "pageImage" }},
"image": { "image": {
"@type": "ImageObject", "@type": "ImageObject",
"url": {{ .Scratch.Get "socialImage_url" | absURL }}, "url": {{ .Permalink }},
"width": "{{ .Scratch.Get "socialImage_width" }}", "width": "{{ .Width }}",
"height": "{{ .Scratch.Get "socialImage_height" }}" "height": "{{ .Height }}"
} }{{ end }}
} }
</script> </script>

View File

@@ -7,13 +7,13 @@
"name": {{ .name }}, "name": {{ .name }},
"url": {{ $.Site.BaseURL }}, "url": {{ $.Site.BaseURL }},
"description": {{ $.Site.Params.description }}, "description": {{ $.Site.Params.description }},
{{ with .jobtitle }}"jobTitle": {{ . }},{{ end }} {{ with .jobtitle }}"jobTitle": {{ . }},{{ end }}{{ with $.Scratch.Get "authorImage" }}
"image": { "image": {
"@type": "ImageObject", "@type": "ImageObject",
"url": {{ $.Scratch.Get "defaultImage_url" | absURL }}, "url": {{ .Permalink }},
"width": "{{ $.Scratch.Get "defaultImage_width" }}", "width": "{{ .Width }}",
"height": "{{ $.Scratch.Get "defaultImage_height" }}" "height": "{{ .Height }}"
}, },{{ end }}
"sameAs": [ "sameAs": [
{{ $.Site.BaseURL }}, {{ $.Site.BaseURL }},
{{ with .github }}{{ printf "%s%s" "https://github.com/" . }},{{ end }} {{ with .github }}{{ printf "%s%s" "https://github.com/" . }},{{ end }}

View File

@@ -2,9 +2,9 @@
<link rel="stylesheet" href="{{ $style.Permalink }}"> <link rel="stylesheet" href="{{ $style.Permalink }}">
{{/* Page-specific styles set via front matter, scoped via SCSS and inlined */}} {{/* Page-specific styles set via front matter, scoped via SCSS 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.scss" -}}
{{- $css := . | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") -}} {{- $css := . | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") -}}
{{/* Already being minified to my taste by PostCSS above */}} {{/* Already being minified to my taste by PostCSS above */}}
@@ -13,4 +13,4 @@
{{ $css.Content | safeCSS }} {{ $css.Content | safeCSS }}
</style> </style>
{{- printf "<!-- htmlmin:ignore -->" | safeHTML }} {{- printf "<!-- htmlmin:ignore -->" | safeHTML }}
{{ end }} {{ end -}}

View File

@@ -1,4 +1,4 @@
{{ with .Site.Params.webmention }} {{ with .Site.Params.webmentionIO }}
<link rel="pingback" href="https://webmention.io/{{ . }}/xmlrpc"> <link rel="pingback" href="https://webmention.io/{{ . }}/xmlrpc">
<link rel="webmention" href="https://webmention.io/{{ . }}/webmention"> <link rel="webmention" href="https://webmention.io/{{ . }}/webmention">
{{ end }} {{ end }}

View File

@@ -1,12 +1,10 @@
<footer> <footer>
<div class="row"> <div class="row">
<div id="copyright">Content <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.licenseFull }} title="{{ . }}"{{ end }}>licensed under {{ .Site.Params.license }}</a>, {{ with .Site.Params.copyrightFirstYear }}<a class="no-underline" href="{{ "previously/" | absURL }}" title="Previously on...">{{ . }} &ndash;</a>{{ end }} {{ now.Format "2006" }}.</div> <div id="copyright">Content <a class="no-underline" href="{{ "license/" | absURL }}"{{ with .Site.Params.licenseFull }} title="{{ . }}"{{ end }}>licensed under {{ .Site.Params.license }}</a>, {{ with .Site.Params.copyrightFirstYear }}<a class="no-underline" href="{{ "previously/" | absURL }}" title="Previously on...">{{ . }} &ndash;</a>{{ end }} {{ now.Format "2006" }}.</div>
<!-- adblock hides images with width="88" and height="31", for some reason? using style="..." gets around it. -->
<!-- TODO: ask about this..? https://github.com/AdguardTeam/AdguardFilters/blob/ba4db91022dbebe48967a447b5f818064ee60167/SpywareFilter/sections/general_elemhide.txt#L18 -->
<div id="y2k"><a class="no-underline" href="https://y2k.land/" title="Made for Internet Explorer&reg;" target="_blank" rel="noopener"><img src="{{ "img/ie.gif" | absURL }}" style="width: 88px; height: 31px;" alt="Made for Internet Explorer&reg;"></a></div> <div id="y2k"><a class="no-underline" href="https://y2k.land/" title="Made for Internet Explorer&reg;" target="_blank" rel="noopener"><img src="{{ "img/ie.gif" | absURL }}" style="width: 88px; height: 31px;" alt="Made for Internet Explorer&reg;"></a></div>
<div id="poweredby"> <div id="poweredby">
<a class="no-underline" href="https://gohugo.io/" title="Powered by Hugo" id="hugo" target="_blank" rel="noopener">Made with <span class="beat">&#x2764;</span> and Hugo.</a> <a class="no-underline" href="https://gohugo.io/" title="Powered by Hugo" id="hugo" target="_blank" rel="noopener">Made with <span class="beat">&#x2764;</span> and Hugo.</a>
{{ with .Site.Params.github }}<a class="no-underline" href="https://github.com/{{ . }}" title="View Source on GitHub" id="source" target="_blank" rel="noopener">View source.</a>{{ end }} {{ with .Site.Params.githubRepo }}<a class="no-underline" href="https://github.com/{{ . }}" title="View Source on GitHub" id="source" target="_blank" rel="noopener">View source.</a>{{ end }}
</div> </div>
</div> </div>
</footer> </footer>

View File

@@ -1,13 +1,13 @@
<header> <header>
<nav> <nav>
<a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" aria-label="{{ .Site.Title }}"> <a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" aria-label="{{ .Site.Title }}">
{{ partial "functions/inline-svg" (dict "src" "img/logo.svg" "width" 28 "height" 40) }} {{ if fileExists "assets/img/logo.svg" }}{{ partial "functions/inline-svg" (dict "src" "img/logo.svg" "width" 28 "height" 40) }}{{ end }}
<h1 id="name">{{ .Site.Title }}</h1> <h1 id="name">{{ .Site.Title }}</h1>
</a> </a>
<ul> <ul>
{{- range .Site.Menus.main }} {{- range .Site.Menus.main }}
<li><a class="no-underline" {{ printf "href=%q" .URL | safeHTMLAttr }} aria-label="{{ .Name }}"{{ if strings.HasPrefix .URL "http" }} target="_blank" rel="me noopener"{{ end }}><span class="icon">{{ .Pre }}</span><span class="text">{{ .Name }}</span></a></li> <li><a class="no-underline" {{ printf "href=%q" .URL | safeHTMLAttr }} aria-label="{{ .Name }}"{{ if strings.HasPrefix .URL "http" }} target="_blank" rel="me noopener"{{ end }}><span class="icon">{{ .Pre }}</span><span class="text">{{ .Name }}</span></a></li>
{{ end -}} {{- end }}
<li><button class="dark-mode-toggle" title="Toggle Dark Mode" aria-label="Toggle Dark Mode"></button></li> <li><button class="dark-mode-toggle" title="Toggle Dark Mode" aria-label="Toggle Dark Mode"></button></li>
</ul> </ul>
</nav> </nav>

View File

@@ -1,20 +1,20 @@
{{ $darkmode := resources.Get "js/dark-mode.js" | resources.ExecuteAsTemplate "js/dark-mode.js" . }} {{- $darkmode := resources.Get "js/dark-mode.js" | resources.ExecuteAsTemplate "js/dark-mode.js" . -}}
{{ $twemoji := resources.Get "vendor/emoji/emoji.js" | resources.ExecuteAsTemplate "vendor/emoji/emoji.min.js" . }} {{- $twemoji := resources.Get "js/vendor/twemoji.js" | resources.ExecuteAsTemplate "js/vendor/twemoji.js" . -}}
{{ $bundle := slice $darkmode $twemoji }} {{- $bundle := slice $darkmode $twemoji -}}
{{/* only parse and append analytics script on production site */}} {{/* only parse and append analytics script on production site */}}
{{ $includeAnalytics := eq hugo.Environment "production" }} {{- $includeAnalytics := eq hugo.Environment "production" -}}
{{ if $includeAnalytics }} {{- if $includeAnalytics }}
{{ $analytics := resources.Get "js/simple-analytics.js" | resources.ExecuteAsTemplate "js/simple-analytics.js" . }} {{- $analytics := resources.Get "js/analytics.js" | resources.ExecuteAsTemplate "js/analytics.js" . }}
{{ $bundle = slice $darkmode $twemoji $analytics }} {{- $bundle = slice $darkmode $twemoji $analytics }}
{{ end }} {{- end }}
{{ $js := $bundle | resources.Concat "/js/app.js" }} {{- $js := $bundle | resources.Concat "/js/app.js" -}}
<script async defer src="{{ $js.Permalink }}"></script> <script async defer src="{{ $js.Permalink }}"></script>
{{/* proxy to simple analytics noscript on production */}} {{/* proxy to simple analytics noscript on production */}}
{{ if $includeAnalytics }} {{- if $includeAnalytics }}
<noscript><img src="{{ "sa/manual.gif" | absURL }}" alt=""></noscript> <noscript><img src="{{ "sa/manual.gif" | absURL }}" alt=""></noscript>
{{ end }} {{ end -}}

View File

@@ -1,3 +1,4 @@
{{- $img := partial "functions/social-images" . -}}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>{{ .Site.Title }}</title> <title>{{ .Site.Title }}</title>
@@ -8,9 +9,9 @@
<managingEditor>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Author.email }} <managingEditor>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Author.email }}
<webMaster>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }} <webMaster>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }} <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}{{ with .Site.Params.defaultImage }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}{{ with .Scratch.Get "authorImage" }}
<image> <image>
<url>{{ . | absURL }}</url> <url>{{ .Permalink }}</url>
<title>{{ $.Site.Title }}</title> <title>{{ $.Site.Title }}</title>
<link>{{ $.Permalink }}</link> <link>{{ $.Permalink }}</link>
</image>{{ end }}{{ with .OutputFormats.Get "RSS" }} </image>{{ end }}{{ with .OutputFormats.Get "RSS" }}

View File

@@ -1,6 +1,6 @@
<amp-video <amp-video
layout="responsive" layout="responsive"
width="{{ with .Get "width" }}{{ . }}{{ else }}{{ .Site.Params.pageMaxWidth }}{{ end }}" width="{{ with .Get "width" }}{{ . }}{{ else }}{{ .Site.Params.maxWidth }}{{ end }}"
height="{{ with .Get "height" }}{{ . }}{{ else }}600{{ end }}" height="{{ with .Get "height" }}{{ . }}{{ else }}600{{ end }}"
{{- with .Page.Resources.GetMatch (.Get "poster") }} poster="{{ .Permalink }}"{{ end }} {{- with .Page.Resources.GetMatch (.Get "poster") }} poster="{{ .Permalink }}"{{ end }}
{{- if .Get "autoplay" }} autoplay{{ end }} {{- if .Get "autoplay" }} autoplay{{ end }}

View File

@@ -59,7 +59,7 @@
Content-Type = "text/plain; charset=UTF-8" Content-Type = "text/plain; charset=UTF-8"
Content-Disposition = "inline; filename=\"jarvis.asc\"" Content-Disposition = "inline; filename=\"jarvis.asc\""
# AMP cache invalidation key requirements # AMP cache invalidation key requirements:
# https://developers.google.com/amp/cache/update-cache#update-cache-guidelines # https://developers.google.com/amp/cache/update-cache#update-cache-guidelines
[[headers]] [[headers]]
for = "/.well-known/amphtml/apikey.pub" for = "/.well-known/amphtml/apikey.pub"
@@ -108,6 +108,37 @@
from = "/archives/*" from = "/archives/*"
to = "/notes/" to = "/notes/"
status = 301 status = 301
[[redirects]]
# Not sure if these XML-RPC requests are malicious but forward them to
# webmention.io anyway.
from = "/xmlrpc.php"
to = "https://webmention.io/jarv.is/xmlrpc"
status = 302
# Proxy data to Simple Analytics endpoints:
[[redirects]]
from = "/sa/send*"
to = "https://queue.simpleanalyticscdn.com/simple.gif:splat"
status = 200
[[redirects]]
from = "/sa/append*"
to = "https://queue.simpleanalyticscdn.com/append:splat"
status = 200
[[redirects]]
from = "/sa/post*"
to = "https://api.simpleanalytics.io/post:splat"
status = 200
[[redirects]]
# This noscript pixel needs to pass unknown arguments along for AMP pages:
# https://amp.dev/documentation/components/amp-pixel/
from = "/sa/noscript.gif*"
to = "https://queue.simpleanalyticscdn.com/noscript.gif:splat"
status = 200
[[redirects]]
# Same noscript.gif as above but with no arguments, except `ignore-dnt`.
from = "/sa/manual.gif"
to = "https://queue.simpleanalyticscdn.com/noscript.gif?ignore-dnt=true"
status = 200
# More miscellaneous mirrors/redirects: # More miscellaneous mirrors/redirects:
[[redirects]] [[redirects]]
@@ -130,6 +161,10 @@
from = "/apple-touch-icon.png" from = "/apple-touch-icon.png"
to = "/img/apple-touch-icon.png" to = "/img/apple-touch-icon.png"
status = 200 status = 200
[[redirects]]
from = "/safari-pinned-tab.svg"
to = "/img/safari-pinned-tab.svg"
status = 200
[[redirects]] [[redirects]]
from = "/keybase.txt" from = "/keybase.txt"
to = "/.well-known/keybase.txt" to = "/.well-known/keybase.txt"
@@ -139,31 +174,6 @@
to = "/vendor/emoji/svg/:splat" to = "/vendor/emoji/svg/:splat"
status = 301 status = 301
# Proxy data to Simple Analytics endpoints:
[[redirects]]
from = "/sa/send*"
to = "https://queue.simpleanalyticscdn.com/simple.gif:splat"
status = 200
[[redirects]]
from = "/sa/append*"
to = "https://queue.simpleanalyticscdn.com/append:splat"
status = 200
[[redirects]]
from = "/sa/post*"
to = "https://api.simpleanalytics.io/post:splat"
status = 200
[[redirects]]
# this noscript pixel needs to pass unknown arguments along for AMP pages
# https://amp.dev/documentation/components/amp-pixel/
from = "/sa/noscript.gif*"
to = "https://queue.simpleanalyticscdn.com/noscript.gif:splat"
status = 200
[[redirects]]
# same noscript img as above but with no arguments, except `ignore-dnt`
from = "/sa/manual.gif"
to = "https://queue.simpleanalyticscdn.com/noscript.gif?ignore-dnt=true"
status = 200
# Mirror these directories from elsewhere to mimic GitHub Pages behavior and # Mirror these directories from elsewhere to mimic GitHub Pages behavior and
# keep this main repository squeaky clean. # keep this main repository squeaky clean.
# https://github.com/jakejarvis/random-sites (private) # https://github.com/jakejarvis/random-sites (private)
@@ -221,9 +231,3 @@
from = "*/wlwmanifest.xml" from = "*/wlwmanifest.xml"
to = "/403.html" to = "/403.html"
status = 403 status = 403
# not sure if these xmlrpc requests are malicious but forward them to
# webmention.io anyway
[[redirects]]
from = "/xmlrpc.php"
to = "https://webmention.io/jarv.is/xmlrpc"
status = 302

View File

@@ -1224,9 +1224,9 @@ duplexer3@^0.1.4:
integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=
electron-to-chromium@^1.3.481: electron-to-chromium@^1.3.481:
version "1.3.481" version "1.3.483"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.481.tgz#0d59e72a0aaeb876b43fb1d6e84bf0dfc99617e8" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.483.tgz#9269e7cfc1c8e72709824da171cbe47ca5e3ca9e"
integrity sha512-q2PeCP2PQXSYadDo9uNY+uHXjdB9PcsUpCVoGlY8TZOPHGlXdevlqW9PkKeqCxn2QBkGB8b6AcMO++gh8X82bA== integrity sha512-+05RF8S9rk8S0G8eBCqBRBaRq7+UN3lDs2DAvnG8SBSgQO3hjy0+qt4CmRk5eiuGbTcaicgXfPmBi31a+BD3lg==
emoji-regex@^7.0.1: emoji-regex@^7.0.1:
version "7.0.3" version "7.0.3"