1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 04:35:31 -04:00

treat ALL images as assets (as they should have been all along...)

This commit is contained in:
2020-04-21 14:34:55 -04:00
parent 9a40dadfb2
commit 8ba0a887bc
34 changed files with 92 additions and 75 deletions

View File

@@ -206,12 +206,12 @@
display: block;
margin-left: 1.5em;
}
div.highlight span.k, div.highlight span.kc, div.highlight span.kd, div.highlight span.kp, div.highlight span.kr, div.highlight span.kt, div.highlight span.no { color: #03748a; }
div.highlight span.k, div.highlight span.kc, div.highlight span.kd, div.highlight span.kp, div.highlight span.kr, div.highlight span.kt, div.highlight span.no { color: #0e6dc2; }
div.highlight span.n, div.highlight span.bp, div.highlight span.nb, div.highlight span.ni, div.highlight span.fm, div.highlight span.nl, div.highlight span.nn, div.highlight span.py, div.highlight span.nv, div.highlight span.vc, div.highlight span.vg, div.highlight span.vi, div.highlight span.vm, div.highlight span.p { color: #111111; }
div.highlight span.na, div.highlight span.nc, div.highlight span.nd, div.highlight span.ne, div.highlight span.nf, div.highlight span.nx { color: #068200; }
div.highlight span.err, div.highlight span.nt, div.highlight span.o, div.highlight span.ow, div.highlight span.kn { color: #e8003d; }
div.highlight span.l, div.highlight span.se, div.highlight span.m, div.highlight span.mb, div.highlight span.mf, div.highlight span.mh, div.highlight span.mi, div.highlight span.il, div.highlight span.mo { color: #8145ec; }
div.highlight span.ld, div.highlight span.s, div.highlight span.sa, div.highlight span.sb, div.highlight span.sc, div.highlight span.dl, div.highlight span.sd, div.highlight span.s2, div.highlight span.sh, div.highlight span.si, div.highlight span.sx, div.highlight span.sr, div.highlight span.s1, div.highlight span.ss { color: #b35c00; }
div.highlight span.na, div.highlight span.nc, div.highlight span.nd, div.highlight span.ne, div.highlight span.nf, div.highlight span.nx { color: #337a15; }
div.highlight span.err, div.highlight span.nt, div.highlight span.o, div.highlight span.ow, div.highlight span.kn { color: #d43d2e; }
div.highlight span.l, div.highlight span.se, div.highlight span.m, div.highlight span.mb, div.highlight span.mf, div.highlight span.mh, div.highlight span.mi, div.highlight span.il, div.highlight span.mo { color: #8d4eff; }
div.highlight span.ld, div.highlight span.s, div.highlight span.sa, div.highlight span.sb, div.highlight span.sc, div.highlight span.dl, div.highlight span.sd, div.highlight span.s2, div.highlight span.sh, div.highlight span.si, div.highlight span.sx, div.highlight span.sr, div.highlight span.s1, div.highlight span.ss { color: #bd5500; }
div.highlight span.c, div.highlight span.ch, div.highlight span.cm, div.highlight span.c1, div.highlight span.cs, div.highlight span.cp, div.highlight span.cpf { color: #6b6859; }
div.highlight span.ge { font-style: italic; }
div.highlight span.gs { font-weight: bold; }
@@ -224,10 +224,8 @@
</style>
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") }}
{{ partialCached "head/feeds" . }}
<link rel="manifest" href="{{ "site.webmanifest" | absURL }}">
<link rel="alternate" type="application/rss+xml" href="{{ "feed.xml" | absURL }}" title="{{ .Site.Title }} (RSS)">
{{ partial "head/schema-person" . }}
{{ partial "head/schema-article" . }}
</head>

View File

@@ -10,6 +10,10 @@
/vendor/*
Cache-Control: public, max-age=31536000, immutable
# Kinda long cache (one week) for favicons, etc.
/img/*
Cache-Control: public, max-age=604800, immutable
# Proper MIME type for Atom feed
/*.atom
Content-Type: application/atom+xml

View File

@@ -1,14 +1,16 @@
{{- $android512 := resources.Get "img/android-chrome-512x512.png" -}}
{{- $android192 := resources.Get "img/android-chrome-192x192.png" -}}
{
"name": "{{ .Site.Title }}",
"short_name": "{{ .Site.Params.domain }}",
"icons": [
{
"src": "{{ "android-chrome-512x512.png" | absURL }}",
"src": "{{ $android512.Permalink }}",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "{{ "android-chrome-192x192.png" | absURL }}",
"src": "{{ $android192.Permalink }}",
"sizes": "192x192",
"type": "image/png"
}

View File

@@ -1,32 +1,24 @@
{{/* Default image */}}
{{- $defaultImagePath := (path.Join "content" $.Site.Params.defaultImage) }}
{{ $.Scratch.Set "defaultImage_url" (replace $defaultImagePath "content/" "") }}
{{ with (imageConfig $defaultImagePath) }}
{{- $.Scratch.Set "defaultImage_width" .Width }}
{{- $.Scratch.Set "defaultImage_height" .Height }}
{{ end -}}
{{- $defaultImage := resources.Get $.Site.Params.defaultImage }}
{{- $.Scratch.Set "defaultImage_url" $defaultImage.Permalink }}
{{- $.Scratch.Set "defaultImage_width" $defaultImage.Width }}
{{- $.Scratch.Set "defaultImage_height" $defaultImage.Height }}
{{/* Article image (with fallback to default image */}}
{{/* Article image */}}
{{- with .Params.image }}
{{- $imagePath := (path.Join "content" $.File.Dir .) }}
{{- $.Scratch.Set "socialImage_url" (replace $imagePath "content/" "") }}
{{- with (imageConfig $imagePath) }}
{{- $.Scratch.Set "socialImage_width" .Width }}
{{- $.Scratch.Set "socialImage_height" .Height }}
{{- end }}
{{- $socialImage := $.Page.Resources.GetMatch . }}
{{- $.Scratch.Set "socialImage_url" $socialImage.Permalink }}
{{- $.Scratch.Set "socialImage_width" $socialImage.Width }}
{{- $.Scratch.Set "socialImage_height" $socialImage.Height }}
{{ else }}
{{- $.Scratch.Set "socialImage_url" (replace $defaultImagePath "content/" "") }}
{{- with (imageConfig $defaultImagePath) }}
{{- $.Scratch.Set "socialImage_width" .Width }}
{{- $.Scratch.Set "socialImage_height" .Height }}
{{- end }}
{{/* fallback to default image set above */}}
{{- $.Scratch.Set "socialImage_url" $defaultImage.Permalink }}
{{- $.Scratch.Set "socialImage_width" $defaultImage.Width }}
{{- $.Scratch.Set "socialImage_height" $defaultImage.Height }}
{{ end -}}
{{/* Site logo */}}
{{- $logoImagePath := (path.Join "content" "logo.png") }}
{{ $.Scratch.Set "logoImage_url" (replace $logoImagePath "content/" "") }}
{{ with (imageConfig $logoImagePath) }}
{{- $.Scratch.Set "logoImage_width" .Width }}
{{- $.Scratch.Set "logoImage_height" .Height }}
{{ end -}}
{{- $logoImage := resources.Get "img/logo.png" }}
{{- $.Scratch.Set "logoImage_url" $logoImage.Permalink }}
{{- $.Scratch.Set "logoImage_width" $logoImage.Width }}
{{- $.Scratch.Set "logoImage_height" $logoImage.Height }}

View File

@@ -1,10 +1,16 @@
<link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | absURL }}" sizes="180x180">
<link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | absURL }}" color="#009cdf">
{{- $appleIcon := resources.Get "img/apple-touch-icon.png" }}
<link rel="apple-touch-icon" href="{{ $appleIcon.Permalink }}" sizes="{{ $appleIcon.Width }}x{{ $appleIcon.Height }}">
{{ range (split .pngSizes " ") -}}
<link rel="icon" href="{{ (printf "favicon-%v.png" .) | absURL }}" sizes="{{ . }}x{{ . }}">
{{ end -}}
{{- $safariIcon := resources.Get "img/safari-pinned-tab.svg" }}
<link rel="mask-icon" href="{{ $safariIcon.Permalink }}" color="#009cdf">
{{ $s := slice -}}
{{ range (split .icoSizes " ") }}{{ $s = $s | append (printf "%vx%v" . .) }}{{ end -}}
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" sizes="{{ delimit $s " " }}">
{{/* TODO: automate shrinking to given sizes based on one super big favicon */}}
{{- range (split .pngSizes " ") }}
{{- $faviconPng := resources.Get (printf "img/favicon-%v.png" .) }}
<link rel="icon" href="{{ $faviconPng.Permalink }}" sizes="{{ . }}x{{ . }}">
{{- end }}
{{- $s := slice }}
{{- range (split .icoSizes " ") }}{{ $s = $s | append (printf "%vx%v" . .) }}{{ end }}
{{- $faviconIco := resources.Get "img/favicon.ico" }}
<link rel="shortcut icon" href="{{ $faviconIco.Permalink }}" sizes="{{ delimit $s " " }}">

View File

@@ -1,5 +1,3 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="{{ .Site.Title }}">
<meta name="msapplication-TileColor" content="#0e6dc2">
<meta name="theme-color" content="#0e6dc2">

View File

@@ -4,7 +4,7 @@
{{/* Page-specific styles set via front matter, scoped via SCSS */}}
{{ with .Params.css }}
{{- $sass := printf "div#content { %s }" . }}
{{- $target := path.Join $.File.Dir "inline.scss" }}
{{- $target := path.Join $.File.Dir "css/inline.scss" }}
{{- $css := $sass | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") -}}