aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJieiku2023-08-20 22:37:18 -0700
committerJieiku2023-08-20 22:37:18 -0700
commit61f2e1c3ac343163a5361686ad529c7039387310 (patch)
tree4be20065b86c9378cae2fe3f6de7079c3e3b2d3d
parent4a9479325f07b1f73673cf95c1891229de9450dc (diff)
downloadabridge-61f2e1c3ac343163a5361686ad529c7039387310.tar.gz
abridge-61f2e1c3ac343163a5361686ad529c7039387310.tar.bz2
abridge-61f2e1c3ac343163a5361686ad529c7039387310.zip
fix image shortcodes for multilingual, and other optimizations
-rw-r--r--README.md2
-rw-r--r--content/overview-images/index.fr.md48
-rw-r--r--content/overview-images/index.md12
-rw-r--r--netlify.toml76
-rw-r--r--package.json8
-rw-r--r--static/android-chrome-192x192m.pngbin1170 -> 0 bytes
-rw-r--r--static/favicon-32x32.pngbin559 -> 397 bytes
-rw-r--r--static/js/sw_load.js2
-rw-r--r--static/js/sw_load.min.js2
-rw-r--r--static/manifest.json55
-rw-r--r--static/maskable-x128.pngbin0 -> 816 bytes
-rw-r--r--static/maskable-x192.pngbin0 -> 1086 bytes
-rw-r--r--static/maskable-x384.pngbin0 -> 1765 bytes
-rw-r--r--static/maskable-x48.pngbin0 -> 397 bytes
-rw-r--r--static/maskable-x512.pngbin0 -> 2618 bytes
-rw-r--r--static/maskable-x72.pngbin0 -> 566 bytes
-rw-r--r--static/maskable-x96.pngbin0 -> 671 bytes
-rw-r--r--static/maskable_x1024.pngbin0 -> 5454 bytes
-rw-r--r--static/sw.js13
-rw-r--r--static/sw.min.js2
-rw-r--r--templates/macros/macros.html3
-rw-r--r--templates/shortcodes/img.html17
-rw-r--r--templates/shortcodes/imgswap.html34
23 files changed, 228 insertions, 46 deletions
diff --git a/README.md b/README.md
index 25ed6b2..5bafb44 100644
--- a/README.md
+++ b/README.md
@@ -351,6 +351,8 @@ The theme switcher relies on javascript to work, it applies the .light class to
### Optimize PNG/ICO files:
+Good tool to generate maskable icons for manifest.json: [maskable.app](https://maskable.app/editor)
+
All png files can be optimized using [oxipng](https://github.com/shssoichiro/oxipng):
```bash
diff --git a/content/overview-images/index.fr.md b/content/overview-images/index.fr.md
index 9a68006..956fdcd 100644
--- a/content/overview-images/index.fr.md
+++ b/content/overview-images/index.fr.md
@@ -20,39 +20,41 @@ Cet article couvre les **shortcodes imgswap et img**. Les images peuvent égalem
- src est le chemin et le nom de fichier de l'image. (obligatoire)
- class définit une classe pour l'image. (facultatif)
-- alt définit la note alt pour l'image. (recommandé pour google phare)
-- w est la largeur de l'image. (recommandé pour google phare)
-- h est la hauteur de l'image. (recommandé pour google phare)
+- alt définit la note alt pour l'image.
+- w est la largeur de l'image.
+- h est la hauteur de l'image.
+
+** google lighthouse recommande de définir les attributs alt, w et h. Si alt est omis, le nom du fichier est utilisé. Si w ou h sont omis alors get_image_metadata() remplit ces valeurs. **
## Utilisation (même chemin)
```rs
-{{/* img(src="ferris-happy.svg" alt="Ferris est heureux" w=600 h=400) */}}
+{{/* img(src="ferris-happy.svg" alt="Ferris est heureux") */}}
```
**Sortir**
```html
-{{ img(src="ferris-happy.svg" alt="Ferris est heureux" w=600 h=400) }}
+{{ img(src="ferris-happy.svg" alt="Ferris est heureux") }}
```
-{{ img(src="ferris-happy.svg" alt="Ferris est heureux" w=600 h=400) }}
+{{ img(src="ferris-happy.svg" alt="Ferris est heureux") }}
## Utilisation (chemin relatif ./)
```rs
-{{/* img(src="./img/ferris-gesture.svg" alt="Ferris dit bonjour" w=600 h=400) */}}
+{{/* img(src="./img/ferris-gesture.svg" alt="Ferris dit bonjour") */}}
```
**Sortir**
```html
-{{ img(src="./img/ferris-gesture.svg" alt="Ferris dit bonjour" w=600 h=400) }}
+{{ img(src="./img/ferris-gesture.svg" alt="Ferris dit bonjour") }}
```
-{{ img(src="./img/ferris-gesture.svg" alt="Ferris dit bonjour" w=600 h=400) }}
+{{ img(src="./img/ferris-gesture.svg" alt="Ferris dit bonjour") }}
## Utilisation (chemin racine /)
```rs
-{{/* img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé" w=600 h=400) */}}
+{{/* img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé") */}}
```
**Sortir**
```html
-{{ img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé" w=600 h=400) }}
+{{ img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé") }}
```
-{{ img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé" w=600 h=400) }}
+{{ img(src="/overview-rich-content/ferris.svg" alt="Ferris le Rustacé") }}
# Image SVG directement dans le code :
```html
@@ -69,35 +71,39 @@ Lorsque vous passez votre souris sur l'image, l'image à comparer s'affiche.
- main_src est le chemin et le nom de fichier de l'image par défaut. (obligatoire)
- swap_src est le chemin et le nom de fichier de l'image d'échange. (obligatoire)
+- class définit une classe pour l'image. (facultatif)
+- alt définit la note alt pour l'image.
- w est la largeur de l'image.
- h est la hauteur de l'image.
+** google lighthouse recommande de définir les attributs alt, w et h. Si alt est omis, le nom du fichier est utilisé. Si w ou h sont omis alors get_image_metadata() remplit ces valeurs. **
+
## Utilisation (même chemin)
```rs
-{{/* imgswap(main_src="ferris.svg" swap_src="ferris-happy.svg" w=600 h=400) */}}
+{{/* imgswap(main_src="ferris.svg" swap_src="ferris-happy.svg") */}}
```
**Sortir**
```html
-{{ imgswap(main_src="ferris.svg" swap_src="ferris-happy.svg" w=600 h=400) }}
+{{ imgswap(main_src="ferris.svg" swap_src="ferris-happy.svg") }}
```
-{{ imgswap(main_src="ferris.svg" swap_src="ferris-happy.svg" w=600 h=400) }}
+{{ imgswap(main_src="ferris.svg" swap_src="ferris-happy.svg") }}
## Utilisation (chemin relatif ./)
```rs
-{{/* imgswap(main_src="./img/ferris.svg" swap_src="./img/ferris-gesture.svg" w=600 h=400) */}}
+{{/* imgswap(main_src="./img/ferris.svg" swap_src="./img/ferris-gesture.svg") */}}
```
**Sortir**
```html
-{{ imgswap(main_src="./img/ferris.svg" swap_src="./img/ferris-gesture.svg" w=600 h=400) }}
+{{ imgswap(main_src="./img/ferris.svg" swap_src="./img/ferris-gesture.svg") }}
```
-{{ imgswap(main_src="./img/ferris.svg" swap_src="./img/ferris-gesture.svg" w=600 h=400) }}
+{{ imgswap(main_src="./img/ferris.svg" swap_src="./img/ferris-gesture.svg") }}
## Utilisation (chemin racine /)
```rs
-{{/* imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg" w=600 h=400) */}}
+{{/* imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") */}}
```
**Sortir**
```html
-{{ imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg" w=600 h=400) }}
+{{ imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") }}
```
-{{ imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg" w=600 h=400) }}
+{{ imgswap(main_src="/overview-rich-content/ferris.svg" swap_src="/overview-rich-content/ferris-gesture.svg") }}
diff --git a/content/overview-images/index.md b/content/overview-images/index.md
index b1f07e2..cd3181c 100644
--- a/content/overview-images/index.md
+++ b/content/overview-images/index.md
@@ -20,9 +20,11 @@ This post covers the **imgswap and img shortcodes**. Images can also be embedded
- src is the path and filename of the image. (mandatory)
- class sets a class for the image. (optional)
-- alt sets the alt note for the image. (recommended for google lighthouse)
-- w is the width of the image. (recommended for google lighthouse)
-- h is the height of the image. (recommended for google lighthouse)
+- alt sets the alt note for the image.
+- w is the width of the image.
+- h is the height of the image.
+
+** google lighthouse recommends setting alt, w, and h attributes. If alt is omitted then the filename is used. If w or h are omitted then get_image_metadata() fills these values. **
## Usage (same path)
```rs
@@ -69,9 +71,13 @@ When you hover your mouse over the image it will display the image to compare.
- main_src is the path and filename for the default image. (mandatory)
- swap_src is the path and filename for the swap image. (mandatory)
+- class sets a class for the image. (optional)
+- alt sets the alt note for the image.
- w is the width of the image.
- h is the height of the image.
+** google lighthouse recommends setting alt, w, and h attributes. If alt is omitted then the filename is used. If w or h are omitted then get_image_metadata() fills these values. **
+
## Usage (same path)
```rs
{{/* imgswap(main_src="ferris.svg" swap_src="ferris-happy.svg") */}}
diff --git a/netlify.toml b/netlify.toml
index ec75f60..2777496 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -17,3 +17,79 @@ command = "zola build --base-url $DEPLOY_PRIME_URL && npm run pwa && zola build
Referrer-Policy = "strict-origin-when-cross-origin"
Strict-Transport-Security = "max-age=63072000; includeSubdomains"
Content-Security-Policy = "default-src 'none'; frame-ancestors 'none'; object-src 'none'; base-uri 'self'; manifest-src 'self'; worker-src 'self'; form-action 'self'; connect-src 'self' *.hyvor.com ws://*.hyvor.com; script-src 'self' talk.hyvor.com; img-src 'self' data: talk.hyvor.com cdn.cloudflare.com; frame-src 'self' www.youtube-nocookie.com player.vimeo.com streamable.com www.streamable.com; media-src 'self' data: cdn.cloudflare.com www.youtube-nocookie.com player.vimeo.com; font-src 'self' cdn.cloudflare.com cdn.jsdelivr.net fonts.gstatic.com; style-src 'self' talk.hyvor.com cdn.cloudflare.com cdn.jsdelivr.net fonts.googleapis.com;"
+[[headers]]
+ for = "*.js"#javascript
+ [headers.values]
+ Cache-Control = "public, max-age=604800, must-revalidate"
+[[headers]]
+ for = "*.css"#stylesheet
+ [headers.values]
+ Cache-Control = "public, max-age=604800, must-revalidate"
+[[headers]]
+ for = "*.svg"#image/favicon
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.png"#image/favicon
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.ico"#image/favicon
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.jpg"#image
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.jpeg"#image
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.gif"#image
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.webp"#image
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.avif"#image
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.mp4"#video
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.webm"#video
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.mp3"#audio
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.ogg"#audio
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.otf"#font
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.eot"#font
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.ttf"#font
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.woff"#font
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
+[[headers]]
+ for = "*.woff2"#font
+ [headers.values]
+ Cache-Control = "public, max-age=604800"
diff --git a/package.json b/package.json
index 0f234e1..d8355d9 100644
--- a/package.json
+++ b/package.json
@@ -6,11 +6,13 @@
"license": "MIT",
"homepage": "https://github.com/Jieiku/abridge",
"scripts": {
- "all": "npm run theme && npm run theme-light && npm run pwa && npm run katex-bundle && npm run search-elasticlunr && npm run search-stork && npm run search-tinysearch && npm run abridge-bundle-elasticlunr",
- "nonbundles": "npm run theme && npm run theme-light && npm run pwa && npm run katex-bundle && npm run search-elasticlunr && npm run search-stork && npm run search-tinysearch",
+ "all": "npm run theme && npm run theme-light && npm run pwa-minify && npm run katex-bundle && npm run search-elasticlunr && npm run search-stork && npm run search-tinysearch && npm run abridge-bundle-elasticlunr",
+ "nonbundles": "npm run theme && npm run theme-light && npm run pwa-minify && npm run katex-bundle && npm run search-elasticlunr && npm run search-stork && npm run search-tinysearch",
"theme": "uglifyjs static/js/theme.js -c -m -o static/js/theme.min.js",
"theme-light": "uglifyjs static/js/theme_light.js -c -m -o static/js/theme_light.min.js",
- "pwa": "CACHEFILES=$(find public -type f | sed 's/^public//' | sed 's/^\\/sw\\..*//' | sed 's/.*sw_load.*//' | sed 's/index.html//' | sed 's/.*stork.*//' | sed 's/.*tinysearch.*//' | sort | uniq | sed '/^$/d' | sed \"s/\\(.*\\)/'\\1'/\" | tr '\\n' ',' | uniq | sed 's/.$//' | sed \"s/\\(.*\\)/BASE_CACHE_FILES = \\[\\1\\];/\") && echo $CACHEFILES && sed -i \"s|BASE_CACHE_FILES =.*|$CACHEFILES|\" 'static/sw.js' && uglifyjs static/js/sw_load.js -c -m -o static/js/sw_load.min.js && uglifyjs static/sw.js -c -m -o static/sw.min.js",
+ "pwa-cache": "CACHEFILES=$(find public -type f | sed 's/^public//' | sed 's/^\\/sw\\..*//' | sed 's/.*sw_load.*//' | sed 's/index.html//' | sort | uniq | sed '/^$/d' | sed \"s/\\(.*\\)/'\\1'/\" | tr '\\n' ',' | uniq | sed 's/.$//' | sed \"s/\\(.*\\)/\\[\\1\\]/\") && sed -i \"s|BASE_CACHE_FILES =.*|BASE_CACHE_FILES = $CACHEFILES\\;|\" 'static/sw.js'",
+ "pwa-minify": "uglifyjs static/js/sw_load.js -c -m -o static/js/sw_load.min.js && uglifyjs static/sw.js -c -m -o static/sw.min.js",
+ "pwa": "npm run pwa-cache && npm run pwa-minify",
"katex-bundle": "uglifyjs static/js/katex.min.js static/js/mathtex-script-type.min.js static/js/katex-auto-render.min.js static/js/katexoptions.js -c -m -o static/js/katexbundle.min.js",
"search-elasticlunr": "uglifyjs static/js/elasticlunr.min.js static/js/search.js -c -m -o static/js/search_elasticlunr.min.js",
"search-stork": "uglifyjs static/js/stork.js static/js/stork_config.js -c -m -o static/js/search_stork.min.js",
diff --git a/static/android-chrome-192x192m.png b/static/android-chrome-192x192m.png
deleted file mode 100644
index f1e485d..0000000
--- a/static/android-chrome-192x192m.png
+++ /dev/null
Binary files differ
diff --git a/static/favicon-32x32.png b/static/favicon-32x32.png
index df1736f..df65fe1 100644
--- a/static/favicon-32x32.png
+++ b/static/favicon-32x32.png
Binary files differ
diff --git a/static/js/sw_load.js b/static/js/sw_load.js
index b38f118..9c10723 100644
--- a/static/js/sw_load.js
+++ b/static/js/sw_load.js
@@ -1,6 +1,6 @@
if ("serviceWorker" in navigator) {
navigator.serviceWorker
- .register("/sw.min.js?v=3.7.6", { scope: "/" })
+ .register("/sw.min.js?v=3.7.8", { scope: "/" })
.then(() => {
console.info("SW Loaded");
}, err => console.error("SW error: ", err));
diff --git a/static/js/sw_load.min.js b/static/js/sw_load.min.js
index c6cd8a1..2bc0802 100644
--- a/static/js/sw_load.min.js
+++ b/static/js/sw_load.min.js
@@ -1 +1 @@
-"serviceWorker"in navigator&&(navigator.serviceWorker.register("/sw.min.js?v=3.7.6",{scope:"/"}).then(()=>{console.info("SW Loaded")},e=>console.error("SW error: ",e)),navigator.serviceWorker.ready.then(()=>{console.info("SW Ready")})); \ No newline at end of file
+"serviceWorker"in navigator&&(navigator.serviceWorker.register("/sw.min.js?v=3.7.8",{scope:"/"}).then(()=>{console.info("SW Loaded")},e=>console.error("SW error: ",e)),navigator.serviceWorker.ready.then(()=>{console.info("SW Ready")})); \ No newline at end of file
diff --git a/static/manifest.json b/static/manifest.json
index 04ed38b..c4fcd1f 100644
--- a/static/manifest.json
+++ b/static/manifest.json
@@ -1,9 +1,9 @@
{
"name": "Abridge Zola Theme",
"short_name": "Abridge",
- "description": "Fast & Lightweight Zola Theme",
- "background_color": "#111",
- "theme_color": "#222",
+ "description": "Fast and Lightweight Zola Theme",
+ "background_color": "#111111",
+ "theme_color": "#333333",
"display": "standalone",
"orientation": "any",
"start_url": "/",
@@ -21,10 +21,57 @@
"type": "image/png"
},
{
- "src": "/android-chrome-192x192m.png",
+ "src": "/apple-touch-icon.png",
+ "sizes": "180x180",
+ "type": "image/png"
+ },
+ {
+ "src": "/maskable-x48.png",
+ "sizes": "48x48",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "/maskable-x72.png",
+ "sizes": "72x72",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "/maskable-x96.png",
+ "sizes": "96x96",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "/maskable-x128.png",
+ "sizes": "128x128",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "/maskable-x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
+ },
+ {
+ "src": "/maskable-x384.png",
+ "sizes": "384x384",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "/maskable-x512.png",
+ "sizes": "512x512",
+ "type": "image/png",
+ "purpose": "maskable"
+ },
+ {
+ "src": "/maskable-x1024.png",
+ "sizes": "1024x1024",
+ "type": "image/png",
+ "purpose": "maskable"
}
]
}
diff --git a/static/maskable-x128.png b/static/maskable-x128.png
new file mode 100644
index 0000000..a9ea7b0
--- /dev/null
+++ b/static/maskable-x128.png
Binary files differ
diff --git a/static/maskable-x192.png b/static/maskable-x192.png
new file mode 100644
index 0000000..6b17a50
--- /dev/null
+++ b/static/maskable-x192.png
Binary files differ
diff --git a/static/maskable-x384.png b/static/maskable-x384.png
new file mode 100644
index 0000000..d1fa562
--- /dev/null
+++ b/static/maskable-x384.png
Binary files differ
diff --git a/static/maskable-x48.png b/static/maskable-x48.png
new file mode 100644
index 0000000..b29fc5d
--- /dev/null
+++ b/static/maskable-x48.png
Binary files differ
diff --git a/static/maskable-x512.png b/static/maskable-x512.png
new file mode 100644
index 0000000..dbd35cf
--- /dev/null
+++ b/static/maskable-x512.png
Binary files differ
diff --git a/static/maskable-x72.png b/static/maskable-x72.png
new file mode 100644
index 0000000..1a9c0ca
--- /dev/null
+++ b/static/maskable-x72.png
Binary files differ
diff --git a/static/maskable-x96.png b/static/maskable-x96.png
new file mode 100644
index 0000000..22edaa1
--- /dev/null
+++ b/static/maskable-x96.png
Binary files differ
diff --git a/static/maskable_x1024.png b/static/maskable_x1024.png
new file mode 100644
index 0000000..35aa01e
--- /dev/null
+++ b/static/maskable_x1024.png
Binary files differ
diff --git a/static/sw.js b/static/sw.js
index 4a2b0db..7d07a13 100644
--- a/static/sw.js
+++ b/static/sw.js
@@ -14,6 +14,8 @@ class Pwa {
// 3600=1hour, 28800=8hours, 86400=1day, 604800=1week, 1209600=2weeks
this.NORM_TTL = 86400;// html, json, xml, anything else undefined
this.LONG_TTL = 604800;// js, css
+ // keep the ttl on these lower:
+ this.TTL_NORM = ["sw.min.js", "sw_load.min.js"];
// rarely change, may be a good idea to periodically refresh, incase I change these and forget to increment service worker version:
this.TTL_LONG = ["js", "css"];
// never change, cache forever unless service worker version is incremented:
@@ -33,10 +35,20 @@ class Pwa {
const extension = url.split('.').reverse()[0].split('?')[0];
return (extension.endsWith('/')) ? '/' : extension;
}
+ getFileName(url) {
+ const filename = url.substring(url.lastIndexOf('/') + 1).split('?')[0];;
+ return (filename.endsWith('/')) ? '/' : filename;
+ }
getTTL(url) {
if (typeof url === 'string') {
const extension = this.getFileExtension(url);
+ const filename = this.getFileName(url);
+
+ if (this.TTL_NORM.indexOf(filename) > -1) {
+ //console.info(url + ' contains a TTL_NORM filename');
+ return this.NORM_TTL;
+ }
if (this.TTL_LONG.indexOf(extension) > -1) {
//console.info(url + ' contains a TTL_LONG extension');
return this.LONG_TTL;
@@ -45,6 +57,7 @@ class Pwa {
//console.info(url + ' contains a TTL_EXEMPT extension');
return null;
}
+ //console.info(url + ' TTL_NORM');
return this.NORM_TTL;
}
return null;
diff --git a/static/sw.min.js b/static/sw.min.js
index c05bb61..f8700c9 100644
--- a/static/sw.min.js
+++ b/static/sw.min.js
@@ -1 +1 @@
-class Pwa{constructor(e){this.scope=e;var s=new URL(location).searchParams.get("v");this.CACHE_VERSION=s,this.BASE_CACHE_FILES=["/","/404.html","/about/","/abridge.css","/android-chrome-192x192m.png","/android-chrome-192x192.png","/android-chrome-512x512.png","/apple-touch-icon.png","/archive/","/atom.xml","/banner.png","/blog/","/blog/blog-section/","/blog/page/1/","/browserconfig.xml","/categories/","/categories/features/","/categories/features/atom.xml","/contact/","/elasticlunr.min.js","/favicon-16x16.png","/favicon-32x32.png","/favicon.ico","/favicon.svg","/font/Abridge.woff2","/font/Arimo-Bold.woff2","/font/Arimo-Italic.woff2","/font/Arimo.woff2","/font/FiraCode.woff2","/font/Roboto-Bold.woff2","/font/Roboto-Italic.woff2","/font/Roboto-Mono-Italic.woff2","/font/Roboto-Mono.woff2","/font/Roboto.woff2","/fonts/KaTeX_AMS-Regular.woff2","/fonts/KaTeX_Caligraphic-Bold.woff2","/fonts/KaTeX_Caligraphic-Regular.woff2","/fonts/KaTeX_Fraktur-Bold.woff2","/fonts/KaTeX_Fraktur-Regular.woff2","/fonts/KaTeX_Main-BoldItalic.woff2","/fonts/KaTeX_Main-Bold.woff2","/fonts/KaTeX_Main-Italic.woff2","/fonts/KaTeX_Main-Regular.woff2","/fonts/KaTeX_Math-BoldItalic.woff2","/fonts/KaTeX_Math-Italic.woff2","/fonts/KaTeX_SansSerif-Bold.woff2","/fonts/KaTeX_SansSerif-Italic.woff2","/fonts/KaTeX_SansSerif-Regular.woff2","/fonts/KaTeX_Script-Regular.woff2","/fonts/KaTeX_Size1-Regular.woff2","/fonts/KaTeX_Size2-Regular.woff2","/fonts/KaTeX_Size3-Regular.woff2","/fonts/KaTeX_Size4-Regular.woff2","/fonts/KaTeX_Typewriter-Regular.woff2","/fr/","/fr/about/","/fr/archive/","/fr/atom.xml","/fr/blog/","/fr/blog/blog-section/","/fr/blog/page/1/","/fr/categories/","/fr/categories/features/","/fr/categories/features/atom.xml","/fr/contact/","/fr/offline/","/fr/overview-abridge/","/fr/overview-code-blocks/","/fr/overview-embed-streamable/","/fr/overview-embed-vimeo/","/fr/overview-embed-youtube/","/fr/overview-images/","/fr/overview-images/corro.svg","/fr/overview-images/ferris-gesture.png","/fr/overview-images/ferris-gesture.svg","/fr/overview-images/ferris-happy.svg","/fr/overview-images/ferris.svg","/fr/overview-images/img/ferris-gesture.svg","/fr/overview-images/img/ferris.svg","/fr/overview-markdown-and-style/","/fr/overview-math/","/fr/overview-rich-content/","/fr/overview-rich-content/ferris-gesture.svg","/fr/overview-rich-content/ferris.svg","/fr/overview-rich-content/over9000-400.avif","/fr/overview-rich-content/over9000-640.avif","/fr/overview-rich-content/over9000-640.webp","/fr/overview-rich-content/over9000-960.avif","/fr/overview-rich-content/over9000_av1.mp4","/fr/overview-rich-content/over9000.mp3","/fr/overview-rich-content/over9000.ogg","/fr/overview-rich-content/over9000_vp9.webm","/fr/page/1/","/fr/page/2/","/fr/page/3/","/fr/page/4/","/fr/posts/","/fr/posts/posts-section/","/fr/privacy/","/fr/tags/","/fr/tags/audio/","/fr/tags/audio/atom.xml","/fr/tags/config/","/fr/tags/config/atom.xml","/fr/tags/images/","/fr/tags/images/atom.xml","/fr/tags/markdown/","/fr/tags/markdown/atom.xml","/fr/tags/mathematics/","/fr/tags/mathematics/atom.xml","/fr/tags/shortcodes/","/fr/tags/shortcodes/atom.xml","/fr/tags/video/","/fr/tags/video/atom.xml","/js/abridge.min.js","/js/codecopy.js","/js/elasticlunr.min.js","/js/email.js","/js/katex-auto-render.min.js","/js/katexbundle.min.js","/js/katex.min.js","/js/katexoptions.js","/js/lunr.da.js","/js/lunr.da.min.js","/js/lunr.de.js","/js/lunr.de.min.js","/js/lunr.du.js","/js/lunr.du.min.js","/js/lunr.es.js","/js/lunr.es.min.js","/js/lunr.fi.js","/js/lunr.fi.min.js","/js/lunr.fr.js","/js/lunr.fr.min.js","/js/lunr.hu.js","/js/lunr.hu.min.js","/js/lunr.it.js","/js/lunr.it.min.js","/js/lunr.jp.js","/js/lunr.jp.min.js","/js/lunr.no.js","/js/lunr.no.min.js","/js/lunr.pt.js","/js/lunr.pt.min.js","/js/lunr.ro.js","/js/lunr.ro.min.js","/js/lunr.ru.js","/js/lunr.ru.min.js","/js/lunr.stemmer.support.js","/js/lunr.stemmer.support.min.js","/js/lunr.sv.js","/js/lunr.sv.min.js","/js/lunr.tr.js","/js/lunr.tr.min.js","/js/lunr.zh.js","/js/lunr.zh.min.js","/js/mathtex-script-type.min.js","/js/prestyle.js","/js/search_elasticlunr.min.js","/js/searchjava.js","/js/searchjavaugly.js","/js/search.js","/js/theme_button.js","/js/theme.js","/js/theme_light.js","/js/theme_light.min.js","/js/theme.min.js","/katex.min.css","/manifest.json","/mstile-150x150.png","/nojs.css","/offline/","/overview-abridge/","/overview-code-blocks/","/overview-embed-streamable/","/overview-embed-vimeo/","/overview-embed-youtube/","/overview-images/","/overview-images/corro.svg","/overview-images/ferris-gesture.png","/overview-images/ferris-gesture.svg","/overview-images/ferris-happy.svg","/overview-images/ferris.svg","/overview-images/img/ferris-gesture.svg","/overview-images/img/ferris.svg","/overview-markdown-and-style/","/overview-math/","/overview-rich-content/","/overview-rich-content/ferris-gesture.svg","/overview-rich-content/ferris.svg","/overview-rich-content/over9000-400.avif","/overview-rich-content/over9000-640.avif","/overview-rich-content/over9000-640.webp","/overview-rich-content/over9000-960.avif","/overview-rich-content/over9000_av1.mp4","/overview-rich-content/over9000.mp3","/overview-rich-content/over9000.ogg","/overview-rich-content/over9000_vp9.webm","/page/1/","/page/2/","/page/3/","/page/4/","/posts/","/posts/posts-section/","/privacy/","/robots.txt","/safari-pinned-tab.svg","/search_index.en.json","/search_index.fr.json","/sitemap.xml","/tags/","/tags/audio/","/tags/audio/atom.xml","/tags/config/","/tags/config/atom.xml","/tags/images/","/tags/images/atom.xml","/tags/markdown/","/tags/markdown/atom.xml","/tags/mathematics/","/tags/mathematics/atom.xml","/tags/shortcodes/","/tags/shortcodes/atom.xml","/tags/video/","/tags/video/atom.xml"],this.host=e.location.protocol+"//"+e.location.host,console.info("Host: "+this.host),this.OFFLINE_PAGE="/offline/",this.NOT_FOUND_PAGE="/404.html",this.CACHE_NAME="content-v"+this.CACHE_VERSION,this.NORM_TTL=86400,this.LONG_TTL=1209600,this.TTL_LONG=["js","css"],this.TTL_EXEMPT=["jpg","jpeg","png","gif","webp","avif","ico","svg","otf","eot","ttf","woff","woff2","xml","xsl","txt","mp4","webm","mp3","ogg"]}canCache(e){return!e.startsWith("http://localhost")&&e.toString().startsWith(this.host)}getFileExtension(e){e=e.split(".").reverse()[0].split("?")[0];return e.endsWith("/")?"/":e}getTTL(e){var s;return"string"!=typeof e||(s=this.getFileExtension(e),-1<this.TTL_LONG.indexOf(s)&&console.info(e+" contains a TTL_LONG extension"),-1<this.TTL_EXEMPT.indexOf(s)&&console.info(e+" contains a TTL_EXEMPT extension"),~this.TTL_EXEMPT.indexOf(s))?null:this.NORM_TTL}async installServiceWorker(){try{return await caches.open(this.CACHE_NAME).then(e=>e.addAll(this.BASE_CACHE_FILES),e=>console.error("Error with "+this.CACHE_NAME,e)),this.scope.skipWaiting()}catch(e){return console.error("Error with installation: ",e)}}cleanupLegacyCache(){const t=[this.CACHE_NAME];return new Promise((s,r)=>{caches.keys().then(e=>e.filter(e=>!~t.indexOf(e))).then(e=>{e.length?Promise.all(e.map(e=>caches.delete(e))).then(()=>s()).catch(e=>{console.error("Error in legacy cleanup: ",e),r(e)}):s()}).catch(e=>{console.error("Error in legacy cleanup: ",e),r(e)})})}async preCacheUrl(s){const r=await caches.open(this.CACHE_NAME);return await r.match(s)?null:fetch(s).then(e=>r.put(s,e.clone()))}register(){this.scope.addEventListener("install",e=>{e.waitUntil(Promise.all([this.installServiceWorker(),this.scope.skipWaiting()])),console.info("SW Installed")}),this.scope.addEventListener("activate",s=>{s.waitUntil(Promise.all([this.cleanupLegacyCache(),this.scope.clients.claim(),this.scope.skipWaiting()]).catch(e=>{console.error("Activation error: ",e),s.skipWaiting()}))}),this.scope.addEventListener("fetch",a=>{a.respondWith(caches.open(this.CACHE_NAME).then(async s=>{if(!this.canCache(a.request.url))return fetch(a.request);const r=await s.match(a.request);if(r){var t;let e=null;for(t of r.headers.entries())if("date"===t[0]){e=new Date(t[1]);break}if(!e)return r;var o=parseInt((((new Date).getTime()-e.getTime())/1e3).toString()),i=this.getTTL(a.request.url);if(null===i||i&&o<i)return r}return fetch(a.request.clone()).then(e=>e.status<400?(this.canCache(a.request.url)&&s.put(a.request,e.clone()),e):s.match(this.NOT_FOUND_PAGE)).catch(e=>r||(console.error(`Error fetching ${a.request.url} resulted in offline`,e),s.match(this.OFFLINE_PAGE)))}))})}}const pwa=new Pwa(self);pwa.register(); \ No newline at end of file
+class Pwa{constructor(t){this.scope=t;var e=new URL(location).searchParams.get("v");this.CACHE_VERSION=e,this.BASE_CACHE_FILES=["/js/theme.min.js","/js/theme_light.min.js","/abridge.css","/js/abridge.min.js","/","/404.html","/offline/","/manifest.json"],this.host=t.location.protocol+"//"+t.location.host,console.info("Host: "+this.host),this.OFFLINE_PAGE="/offline/",this.NOT_FOUND_PAGE="/404.html",this.CACHE_NAME="content-v"+this.CACHE_VERSION,this.NORM_TTL=86400,this.LONG_TTL=604800,this.TTL_NORM=["sw.min.js","sw_load.min.js"],this.TTL_LONG=["js","css"],this.TTL_EXEMPT=["jpg","jpeg","png","gif","webp","avif","ico","svg","otf","eot","ttf","woff","woff2","xml","xsl","txt","mp4","webm","mp3","ogg"]}canCache(t){return!t.startsWith("http://localhost")&&t.toString().startsWith(this.host)}getFileExtension(t){t=t.split(".").reverse()[0].split("?")[0];return t.endsWith("/")?"/":t}getFileName(t){t=t.substring(t.lastIndexOf("/")+1).split("?")[0];return t.endsWith("/")?"/":t}getTTL(t){var e;return"string"==typeof t?(e=this.getFileExtension(t),t=this.getFileName(t),-1<this.TTL_NORM.indexOf(t)?this.NORM_TTL:-1<this.TTL_LONG.indexOf(e)?this.LONG_TTL:-1<this.TTL_EXEMPT.indexOf(e)?null:this.NORM_TTL):null}async installServiceWorker(){try{return await caches.open(this.CACHE_NAME).then(t=>t.addAll(this.BASE_CACHE_FILES),t=>console.error("Error with "+this.CACHE_NAME,t)),this.scope.skipWaiting()}catch(t){return console.error("Error with installation: ",t)}}cleanupLegacyCache(){const i=[this.CACHE_NAME];return new Promise((e,s)=>{caches.keys().then(t=>t.filter(t=>!~i.indexOf(t))).then(t=>{t.length?Promise.all(t.map(t=>caches.delete(t))).then(()=>e()).catch(t=>{console.error("Error in legacy cleanup: ",t),s(t)}):e()}).catch(t=>{console.error("Error in legacy cleanup: ",t),s(t)})})}async preCacheUrl(e){const s=await caches.open(this.CACHE_NAME);return await s.match(e)?null:fetch(e).then(t=>s.put(e,t.clone()))}register(){this.scope.addEventListener("install",t=>{t.waitUntil(Promise.all([this.installServiceWorker(),this.scope.skipWaiting()])),console.info("SW Installed")}),this.scope.addEventListener("activate",e=>{e.waitUntil(Promise.all([this.cleanupLegacyCache(),this.scope.clients.claim(),this.scope.skipWaiting()]).catch(t=>{console.error("Activation error: ",t),e.skipWaiting()}))}),this.scope.addEventListener("fetch",a=>{a.respondWith(caches.open(this.CACHE_NAME).then(async e=>{if(!this.canCache(a.request.url))return fetch(a.request);const s=await e.match(a.request);if(s){var i;let t=null;for(i of s.headers.entries())if("date"===i[0]){t=new Date(i[1]);break}if(!t)return s;var n=parseInt((((new Date).getTime()-t.getTime())/1e3).toString()),r=this.getTTL(a.request.url);if(null===r||r&&n<r)return s}return fetch(a.request.clone()).then(t=>t.status<400?(this.canCache(a.request.url)&&e.put(a.request,t.clone()),t):e.match(this.NOT_FOUND_PAGE)).catch(t=>s||(console.error(`Error fetching ${a.request.url} resulted in offline`,t),e.match(this.OFFLINE_PAGE)))}))})}}const pwa=new Pwa(self);pwa.register(); \ No newline at end of file
diff --git a/templates/macros/macros.html b/templates/macros/macros.html
index f994bdb..fb18345 100644
--- a/templates/macros/macros.html
+++ b/templates/macros/macros.html
@@ -148,9 +148,6 @@
{%- macro footer(page, config) %}
- {%- if page.reading_time and page.reading_time > 2 %}
- <p><b><a href="#">Back to top</a></b></p>
- {%- endif %}
{#- prev/next content page nextprev title pagination #}
{%- if not config.extra.hide_page_nextprev_titles | default(value=false) %}
{%- if page.lower or page.higher %}
diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html
index a5a0541..d599ba0 100644
--- a/templates/shortcodes/img.html
+++ b/templates/shortcodes/img.html
@@ -6,7 +6,12 @@
{%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %}
{%- set path = path ~ "/" %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=page.path ~ path ~ img) %}
+ {%- if lang != config.default_language %}
+ {%- set metapath = page.path ~ path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- else %}
+ {%- set metapath = page.path ~ path ~ img %}
+ {%- endif %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -15,7 +20,8 @@
{%- set rootpath = src | split(pat="/") | slice(end=-1) | join(sep="/") %}
{%- set path = config.base_url ~ rootpath ~ "/" %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=rootpath ~ "/" ~ img) %}
+ {%- set metapath = rootpath ~ "/" ~ img %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -23,7 +29,12 @@
{%- else %} {# Same Directory Path #}
{%- set path = page.path %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=page.path ~ img) %}
+ {%- if lang != config.default_language %}
+ {%- set metapath = page.path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- else %}
+ {%- set metapath = page.path ~ img %}
+ {%- endif %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
diff --git a/templates/shortcodes/imgswap.html b/templates/shortcodes/imgswap.html
index e92d1bc..607febb 100644
--- a/templates/shortcodes/imgswap.html
+++ b/templates/shortcodes/imgswap.html
@@ -7,7 +7,12 @@
{%- set path = main_src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %}
{%- set path = path ~ "/" %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=page.path ~ path ~ img) %}
+ {%- if lang != config.default_language %}
+ {%- set metapath = page.path ~ path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- else %}
+ {%- set metapath = page.path ~ path ~ img %}
+ {%- endif %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -16,7 +21,8 @@
{%- set rootpath = main_src | split(pat="/") | slice(end=-1) | join(sep="/") %}
{%- set path = config.base_url ~ rootpath ~ "/" %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=rootpath ~ "/" ~ img) %}
+ {%- set metapath = rootpath ~ "/" ~ img %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -24,7 +30,12 @@
{%- else %} {# Same Directory Path #}
{%- set path = page.path %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=page.path ~ img) %}
+ {%- if lang != config.default_language %}
+ {%- set metapath = page.path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- else %}
+ {%- set metapath = page.path ~ img %}
+ {%- endif %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -43,7 +54,12 @@
{%- set path = swap_src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %}
{%- set path = path ~ "/" %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=page.path ~ path ~ img) %}
+ {%- if lang != config.default_language %}
+ {%- set metapath = page.path ~ path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- else %}
+ {%- set metapath = page.path ~ path ~ img %}
+ {%- endif %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -52,7 +68,8 @@
{%- set rootpath = swap_src | split(pat="/") | slice(end=-1) | join(sep="/") %}
{%- set path = config.base_url ~ rootpath ~ "/" %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=rootpath ~ "/" ~ img) %}
+ {%- set metapath = rootpath ~ "/" ~ img %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -60,7 +77,12 @@
{%- else %} {# Same Directory Path #}
{%- set path = page.path %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=page.path ~ img) %}
+ {%- if lang != config.default_language %}
+ {%- set metapath = page.path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- else %}
+ {%- set metapath = page.path ~ img %}
+ {%- endif %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}