Add manifest

This commit is contained in:
Alex Shpak 2020-05-01 17:35:08 +02:00
parent c672d64f12
commit e2ffa7b3ad
5 changed files with 22 additions and 3 deletions

15
assets/manifest.json Normal file
View File

@ -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"
}
]
}

View File

@ -8,10 +8,9 @@ const pages = [
self.addEventListener("install", function (event) { self.addEventListener("install", function (event) {
self.skipWaiting(); self.skipWaiting();
const precache = caches.open(cacheName).then((cache) => { caches.open(cacheName).then((cache) => {
return cache.addAll(pages); return cache.addAll(pages);
}); });
event.waitUntil(precache);
}); });
self.addEventListener("fetch", (event) => { self.addEventListener("fetch", (event) => {

View File

@ -1,4 +1,4 @@
<div class="flex justify-between"> <div class="flex flex-wrap justify-between">
{{ if .Site.IsMultiLingual }} {{ if .Site.IsMultiLingual }}
{{ partial "docs/languages" . }} {{ partial "docs/languages" . }}
{{ end }} {{ end }}

View File

@ -1,10 +1,14 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ default .Summary .Description }}"> <meta name="description" content="{{ default .Summary .Description }}">
<meta name="theme-color" content="#FFFFFF">
{{- template "_internal/opengraph.html" . -}} {{- template "_internal/opengraph.html" . -}}
<title>{{ partial "docs/title" . }} | {{ .Site.Title -}}</title> <title>{{ partial "docs/title" . }} | {{ .Site.Title -}}</title>
{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }}
<link rel="manifest" href="{{ $manifest.RelPermalink }}">
<link rel="icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon"> <link rel="icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon">
{{- range .Translations }} {{- range .Translations }}

1
static/favicon.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M3 18h12v-2H3v2zM3 6v2h18V6H3zm0 7h18v-2H3v2z"/></svg>

After

Width:  |  Height:  |  Size: 185 B