From e2ffa7b3ad920d577cc56fbaaea12a99be125774 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Fri, 1 May 2020 17:35:08 +0200 Subject: [PATCH] Add manifest --- assets/manifest.json | 15 +++++++++++++++ assets/sw.js | 3 +-- layouts/partials/docs/footer.html | 2 +- layouts/partials/docs/html-head.html | 4 ++++ static/favicon.svg | 1 + 5 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 assets/manifest.json create mode 100644 static/favicon.svg diff --git a/assets/manifest.json b/assets/manifest.json new file mode 100644 index 0000000..6a137ac --- /dev/null +++ b/assets/manifest.json @@ -0,0 +1,15 @@ +{ + "name": "{{ .Site.Title }}", + "short_name": "{{ .Site.Title }}", + "start_url": "{{ "/" | relURL }}", + "scope": "{{ "/" | relURL }}", + "display": "standalone", + "background_color": "#000000", + "theme_color": "#000000", + "icons": [ + { + "src": "{{ "/favicon.svg" | relURL }}", + "sizes": "512x512" + } + ] +} diff --git a/assets/sw.js b/assets/sw.js index d7d517a..0e7b0cf 100644 --- a/assets/sw.js +++ b/assets/sw.js @@ -8,10 +8,9 @@ const pages = [ self.addEventListener("install", function (event) { self.skipWaiting(); - const precache = caches.open(cacheName).then((cache) => { + caches.open(cacheName).then((cache) => { return cache.addAll(pages); }); - event.waitUntil(precache); }); self.addEventListener("fetch", (event) => { diff --git a/layouts/partials/docs/footer.html b/layouts/partials/docs/footer.html index abb1978..e171077 100644 --- a/layouts/partials/docs/footer.html +++ b/layouts/partials/docs/footer.html @@ -1,4 +1,4 @@ -
+
{{ if .Site.IsMultiLingual }} {{ partial "docs/languages" . }} {{ end }} diff --git a/layouts/partials/docs/html-head.html b/layouts/partials/docs/html-head.html index 4b0c62f..905904f 100644 --- a/layouts/partials/docs/html-head.html +++ b/layouts/partials/docs/html-head.html @@ -1,10 +1,14 @@ + {{- template "_internal/opengraph.html" . -}} {{ partial "docs/title" . }} | {{ .Site.Title -}} + +{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }} + {{- range .Translations }} diff --git a/static/favicon.svg b/static/favicon.svg new file mode 100644 index 0000000..a3c696d --- /dev/null +++ b/static/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file