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

fingerprint CSS and JS, set one week browser cache

...and LOTS of tidying partials
This commit is contained in:
2020-04-25 11:15:31 -04:00
parent d2648a68be
commit adfa73b5fc
25 changed files with 86 additions and 110 deletions

View File

@@ -0,0 +1,11 @@
{{ partial "head/meta" . -}}
{{ partial "functions/social-images" . -}}
{{ partial "head/open-graph" . -}}
{{ partialCached "head/mobile" . -}}
{{ partial "head/preload" . -}}
{{ partial "head/styles" . -}}
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") -}}
{{ partialCached "head/feeds" . -}}
{{ partialCached "head/webmention" . -}}
{{ partial "head/canonical" . -}}
{{ partial "head/schema" . -}}

View File

@@ -0,0 +1,7 @@
<link rel="canonical" href="{{ .Permalink }}">
{{ if and .IsPage (eq .Type .Site.Params.mainSection) }}
{{- with .OutputFormats.Get "amp" -}}
<link rel="amphtml" href="{{ .Permalink }}">
{{ end -}}
{{ end -}}
<link rel="author" href="{{ "humans.txt" | absURL }}">

View File

@@ -4,7 +4,6 @@
{{- $safariIcon := resources.Get "img/safari-pinned-tab.svg" }}
<link rel="mask-icon" href="{{ $safariIcon.Permalink }}" color="#009cdf">
{{/* 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{{ . }}">

View File

@@ -1,21 +0,0 @@
{{ partial "head/meta" . -}}
{{ partial "functions/social-images" . -}}
{{ partial "head/open-graph" . -}}
{{ partialCached "head/mobile" . -}}
{{ partial "head/preload" . -}}
{{ partial "head/styles" . -}}
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") -}}
<link rel="manifest" href="{{ "site.webmanifest" | absURL }}">
<link rel="canonical" href="{{ .Permalink }}">
{{ partialCached "head/feeds" . -}}
{{ partialCached "head/webmention" . -}}
<link rel="author" href="{{ "humans.txt" | absURL }}">
{{ if and .IsPage (eq .Type .Site.Params.mainSection) }}
{{- with .OutputFormats.Get "amp" -}}
<link rel="amphtml" href="{{ .Permalink }}">
{{- end }}
{{ partial "head/schema-person" . }}
{{ partial "head/schema-article" . }}
{{ else }}
{{ partial "head/schema-person" . }}
{{ end -}}

View File

@@ -2,3 +2,4 @@
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="{{ .Site.Title }}">
<meta name="theme-color" content="#0e6dc2">
<link rel="manifest" href="{{ "site.webmanifest" | absURL }}">

View File

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

View File

@@ -1,12 +1,12 @@
{{ $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "sass/main.scss" . | resources.ToCSS (dict "targetPath" "css/main.css") | resources.PostCSS (dict "config" "postcss.config.js") }}
{{ $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "sass/main.scss" . | resources.ToCSS (dict "targetPath" "css/main.min.css") | resources.PostCSS (dict "config" "postcss.config.js") | resources.Fingerprint "sha256" }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{/* Page-specific styles set via front matter, scoped via SCSS */}}
{{ with .Params.css }}
{{- $sass := printf "div#content { %s }" . }}
{{- $target := path.Join $.File.Dir "css/inline.scss" }}
{{- $target := path.Join $.File.Dir "css/inline.min.scss" }}
{{- $css := $sass | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") -}}
{{- $css := $sass | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") | resources.Fingerprint "sha256" -}}
<link rel="stylesheet" href="{{ $css.Permalink }}">
{{ end }}

View File

@@ -1,2 +1,2 @@
<link rel="webmention" href="https://webmention.io/jarv.is/webmention">
<link rel="pingback" href="https://webmention.io/jarv.is/xmlrpc">
<link rel="webmention" href="https://webmention.io/jarv.is/webmention">