Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/tnwhitwell/hugo-startpage-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Whitwell <tom@whitwell.xyz>2018-04-25 09:36:25 +0300
committerTom Whitwell <tom@whitwell.xyz>2018-04-25 09:36:25 +0300
commitc0789d78783d31e007572dbe403bc08f2565d2fb (patch)
tree70298a3008a97c7d35b6c0eb4ed26f999241d41c
parent1609ec43bd25269c68b35f237a076432b63c7846 (diff)
theme is now controlled with a site parameterv1.0
-rw-r--r--README.md30
-rw-r--r--exampleSite/config.toml3
-rw-r--r--layouts/index.html2
3 files changed, 24 insertions, 11 deletions
diff --git a/README.md b/README.md
index 5b5b4c6..c16bac6 100644
--- a/README.md
+++ b/README.md
@@ -26,17 +26,26 @@ This file takes the following format:
## Demo Site (partially using the above links.yml)
-https://tnwhitwell.github.io/hugo-startpage-theme/
+* [GitHub Pages (most recent build)](https://tnwhitwell.github.io/hugo-startpage-theme/)
+* [Hugo themes site (current release)](https://themes.gohugo.io/theme/hugo-startpage-theme/)
## Offline Use
-The theme specifies and includes an appcache manifest for offline use / quick launch.
+The theme includes an appcache manifest for offline use / quick launch.
-This is always included at the moment, but will be controllable / disableable via `config.toml` eventually.
+This is disabled by default, and can be enabled through the site parameters in `config.toml`:
-For content changes to be applied, this manifest ***must*** be updated on each build.
+```toml
+[params]
+ offline = true
+```
+If offline use is not desired or required, either omit the parameter (it is off by default) or set `offline = false`.
+
+### Usage notes for offline-mode
+
+For changes to your startpage to be applied after a build, this manifest ***must*** be modified on each build.
-Suggested way to get this updated is by running:
+If your site is in a git repo, the suggested way to get this updated is by running the following after each successful build:
```bash
hugo
@@ -44,13 +53,14 @@ CURRENT_REVISION=$(git rev-parse --short HEAD)
sed -i "s/COMMIT_SHA/${CURRENT_REVISION}/" public/startpage.appcache
```
-This will ensure that the manifest is updated on each build so the cache is rebuilt by the browser after building.
+This will ensure that the manifest will be re-read by the browser, and all content re-cached.
### Fixing a prematurely cached site
-If the site is cached before you are ready, either:
+If the site is cached before you are ready, the following will help:
-1. add a comment to the generated startpage.appcache (changing one character will work)
-2. Empty the cache on your browser, using [Andy Gup's instructions](http://www.andygup.net/deleting-an-html-application-cache/).
+1. Add a comment / modify the version string of the generated startpage.appcache (changing one character will work) and reload
+2. Build the site with `offline = false` and refresh the page
+3. Empty the cache on your browser, using [Andy Gup's instructions](http://www.andygup.net/deleting-an-html-application-cache/).
## Acknowledgements
-@analbeard - for the theme idea and guidance
+[@analbeard](https://github.com/analbeard) - for the inspiration to create the theme and guidance
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index d7636d0..59d917c 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -2,3 +2,6 @@ baseURL = "https://example.org/"
languageCode = "en-gb"
title = "Start Page"
theme = "startpage"
+
+[params]
+ offline = false
diff --git a/layouts/index.html b/layouts/index.html
index d034e9e..83dc53f 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="{{ .Site.LanguageCode }}" manifest="startpage.appcache">
+<html lang="{{ .Site.LanguageCode }}"{{ if and (isset .Site.Params "offline") ( .Site.Params.offline ) }} manifest="startpage.appcache"{{ end }}>
<head>
<title> {{ .Site.Title }} </title>
{{ partial "head.html" . }}