commit 658702950cf8ddbdd7db31bd12c5ac3fe50fcd53
parent 0635c6a3510fdaa08a0a4cbba5b4317ad3708eed
Author: oscarbenedito <oscar@oscarbenedito.com>
Date:   Fri, 20 Mar 2020 17:59:48 +0100

Static files URLs now have sha256 value

Added the SHA256 value to static files URLs to be able to use browser
caching for static files and having resets when contents change.

Diffstat:
M.gitmodules | 2+-
Mcontent/jsweblabels.html | 2+-
Mlayouts/404.html | 22+++++++++++++++++++++-
Mlayouts/_default/baseof.html | 3+--
Mlayouts/composer/single.html | 5++---
Mlayouts/index.html | 4++--
Dlayouts/partials/404.html | 21---------------------
Mlayouts/partials/head-base.html | 2+-
Mlayouts/partials/navbar.html | 2+-
Mlayouts/partials/scripts.html | 4++--
Mlayouts/shortcodes/js-label.html | 6+++---
Dstatic/js/mathjax | 1-
Astatic/js/mathjax-3.0.1 | 1+
13 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/.gitmodules b/.gitmodules @@ -1,3 +1,3 @@ [submodule "mathjax"] - path = static/js/mathjax + path = static/js/mathjax-3.0.1 url = https://git.oscarbenedito.com/mathjax-bin diff --git a/content/jsweblabels.html b/content/jsweblabels.html @@ -19,7 +19,7 @@ type: page {{< js-label asset="js/main.js" license-slug="GNU-AGPL-3.0-or-later" license-url="http://www.gnu.org/licenses/agpl-3.0.html" >}} {{< js-label asset="js/composer.js" license-slug="GNU-AGPL-3.0-or-later" license-url="http://www.gnu.org/licenses/agpl-3.0.html" >}} <tr> - <td><a href="/js/mathjax/tex-chtml.js">/js/mathjax/tex-chtml.js</a></td> + <td><a href="/js/mathjax-3.0.1/tex-chtml.js">/js/mathjax-3.0.1/tex-chtml.js</a></td> <td><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache-2.0-only</a></td> <td><a href="https://github.com/mathjax/MathJax-src/">MathJax source code</a></td> </tr> diff --git a/layouts/404.html b/layouts/404.html @@ -1 +1,21 @@ -{{ partial "404.html" . }} +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="description" content="Oscar Benedito's website"> + <meta name="author" content="{{ .Site.Author.name }}"> + <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> + <title>404 Error | Oscar Benedito</title> + {{- $favicon := resources.Get "img/favicon.min.svg" | fingerprint }} + <link rel="icon" href="{{ $favicon.RelPermalink }}"> + {{- $style := resources.Get "css/landing.css" | minify | fingerprint }} + <link rel="stylesheet" href="{{ $style.RelPermalink }}"> + </head> + <body> + <div class="content"> + <a href="/" class="img first"><img class="big-icon" src="{{ $favicon.RelPermalink }}"></a> + <p class="title">404 Error</p> + <p class="subtitle last">The file or page you requested was not found.</p> + </div> + </body> +</html> diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html @@ -3,8 +3,7 @@ <head> {{ partial "head-base.html" . -}} <link rel="alternate" type="application/atom+xml" title="{{ .Site.Params.blog_title }}" href=/blog/index.xml> - {{- $options := (dict "targetPath" "css/style.css" "outputStyle" "compressed") }} - {{- $style := resources.Get "css/style.scss" | resources.ToCSS $options }} + {{- $style := resources.Get "css/style.scss" | toCSS | minify | fingerprint }} <link id="theme" rel="stylesheet" type="text/css" href="{{ $style.RelPermalink }}"> </head> <body> diff --git a/layouts/composer/single.html b/layouts/composer/single.html @@ -2,8 +2,7 @@ <html lang="en"> <head> {{ partial "head-base.html" . }} - {{- $options := (dict "targetPath" "css/composer.css" "outputStyle" "compressed") }} - {{- $style := resources.Get "css/composer.scss" | resources.ToCSS $options }} + {{- $style := resources.Get "css/composer.scss" | toCSS | minify | fingerprint }} <link rel="stylesheet" type="text/css" href="{{ $style.RelPermalink }}"> </head> <body> @@ -11,7 +10,7 @@ <span id="word-count">0 words &middot; 0 minutes</span> &middot; <a onclick="toggleTheme()">Toggle theme</a> </nav> <textarea id="composer" placeholder="Start writing..." autofocus></textarea> - {{- $js := resources.Get "js/composer.js" | resources.Minify }} + {{- $js := resources.Get "js/composer.js" | minify | fingerprint }} <script type="text/javascript" src="{{ $js.RelPermalink }}"></script> <a href="/jsweblabels/" rel="jslicense" style="display: none;">JavaScript Web Labels</a> </body> diff --git a/layouts/index.html b/layouts/index.html @@ -6,10 +6,10 @@ <meta name="author" content="{{ .Site.Author.name }}"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> <title>Oscar Benedito</title> - {{- $favicon := resources.Get "img/favicon.min.svg" }} + {{- $favicon := resources.Get "img/favicon.min.svg" | fingerprint }} <link rel="icon" href="{{ $favicon.RelPermalink }}"> <link rel="shortcut icon" href="/favicon.ico"> - {{- $style := resources.Get "css/landing.css" | resources.Minify }} + {{- $style := resources.Get "css/landing.css" | minify | fingerprint }} <link rel="stylesheet" href="{{ $style.RelPermalink }}"> <link rel="me" href="https://fosstodon.org/@ob"> <link rel="me" href="https://github.com/oscarbenedito"> diff --git a/layouts/partials/404.html b/layouts/partials/404.html @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <meta name="description" content="Oscar Benedito's website"> - <meta name="author" content="{{ .Site.Author.name }}"> - <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> - <title>404 Error | Oscar Benedito</title> - {{ $favicon := resources.Get "img/favicon.min.svg" }} - <link rel="icon" href="{{ $favicon.RelPermalink }}"> - {{- $style := resources.Get "css/landing.css" | resources.Minify }} - <link rel="stylesheet" href="{{ $style.RelPermalink }}"> - </head> - <body> - <div class="content"> - <a href="/" class="img first"><img class="big-icon" src="/img/favicon.min.svg"></a> - <p class="title">404 Error</p> - <p class="subtitle last">The file or page you requested was not found.</p> - </div> - </body> -</html> diff --git a/layouts/partials/head-base.html b/layouts/partials/head-base.html @@ -2,7 +2,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> {{/* {{ if .Site.Params.description }}<meta name="description" content="{{ site.description }}">{% endif %} */}} <meta name="author" content="{{ .Site.Author.name }}"> -{{- $favicon := resources.Get "img/favicon.min.svg" }} +{{- $favicon := resources.Get "img/favicon.min.svg" | fingerprint }} <link rel="icon" href="{{ $favicon.RelPermalink }}"> <link rel="shortcut icon" href="/favicon.ico"> <title>{{ if .Params.headtitle }}{{ .Params.headtitle }} | {{ else if eq .Kind "taxonomy" }}{{ .Title | title }} | {{ else if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }}</title> diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html @@ -1,6 +1,6 @@ <nav id="navbar"> <div class="content"> - {{- $logo := resources.Get "img/logo.svg" }} + {{- $logo := resources.Get "img/logo.svg" | fingerprint }} <a class="logo" href="/"><svg viewBox="0 0 84.665 8.89"><use xlink:href="{{ $logo.RelPermalink }}#l"></use></svg></a> <div class="bars"> <a onclick="openMenu()"><svg class="icon" id="bars-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></a> diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html @@ -1,7 +1,7 @@ -{{ $js := resources.Get "js/main.js" | resources.Minify -}} +{{ $js := resources.Get "js/main.js" | minify | fingerprint -}} <script type="text/javascript" src="{{ $js.RelPermalink }}"></script> {{- with .File }} {{- if eq .Ext "pdc" }} -<script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script> +<script id="MathJax-script" async src="/js/mathjax-3.0.1/tex-chtml.js"></script> {{- end }} {{- end }} diff --git a/layouts/shortcodes/js-label.html b/layouts/shortcodes/js-label.html @@ -1,7 +1,7 @@ <tr> - {{- $js := resources.Get (.Get "asset") | resources.Minify -}} - <td><a href="{{ $js.RelPermalink }}">{{ $js.RelPermalink }}</a></td> + {{- $js := resources.Get (.Get "asset") | minify | fingerprint }} + <td><a href="{{ $js.RelPermalink }}">/{{ (.Get "asset") }}</a></td> <td><a href="{{ .Get "license-url" }}">{{ .Get "license-slug" }}</a></td> - {{- $js := resources.Get (.Get "asset") -}} + {{- $js := resources.Get (.Get "asset") }} <td><a href="{{ $js.RelPermalink }}">{{ $js.RelPermalink }}</a></td> </tr> diff --git a/static/js/mathjax b/static/js/mathjax @@ -1 +0,0 @@ -Subproject commit cc6681f8c80d1af9bf3d258cc760e7dc31892e9b diff --git a/static/js/mathjax-3.0.1 b/static/js/mathjax-3.0.1 @@ -0,0 +1 @@ +Subproject commit cc6681f8c80d1af9bf3d258cc760e7dc31892e9b