From 106c981bac71e7434204a77e1f0c9c61d6eb1509 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 5 Jun 2022 00:10:20 +0800 Subject: [PATCH] feat: add option to turn off PWA (#527) --- _config.yml | 3 +++ _includes/js-selector.html | 6 +++++- _layouts/default.html | 28 +++++++++++++++------------- assets/js/pwa/unregister.js | 12 ++++++++++++ 4 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 assets/js/pwa/unregister.js diff --git a/_config.yml b/_config.yml index a1e0189..ad085a8 100644 --- a/_config.yml +++ b/_config.yml @@ -115,6 +115,9 @@ assets: # only works if `assets.self_host.enabled` is 'true' env: # [development|production] +pwa: + enabled: true # the option for PWA feature + paginate: 10 # ------------ The following options are not recommended to be modified ------------------ diff --git a/_includes/js-selector.html b/_includes/js-selector.html index 89b93a4..acc7791 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -90,7 +90,11 @@ {% if jekyll.environment == 'production' %} - + {% if site.pwa.enabled %} + + {% else %} + + {% endif %} {% if site.google_analytics.id != empty and site.google_analytics.id %} diff --git a/_layouts/default.html b/_layouts/default.html index 2d34cef..042d721 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -48,20 +48,22 @@ layout: compress -
{{ site.data.locales[lang].notification.update_found }}
+ +{{ site.data.locales[lang].notification.update_found }}
- -