From 52084f85d4ec4554005e736ef8c3497d6d4d316a Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 10 Sep 2023 20:37:18 +0800 Subject: [PATCH 1/3] chore(release): 6.2.0 --- CHANGELOG.md | 16 ++++++++++++++++ jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9c5bd6..dc732bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [6.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.1.0...v6.2.0) (2023-09-10) + +### Features + +* **layout:** center the footer ([41b8f9f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/41b8f9f519e5f5f69e9a123b38b06bade2271a82)) +* **posts:** render heading 4 in TOC ([#1023](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1023)) ([229c2a2](https://github.com/cotes2020/jekyll-theme-chirpy/commit/229c2a2e2b109fc2eca85be548f1dd97234e44c4)) +* **ui:** redesign the pagination button on home page ([62bcd60](https://github.com/cotes2020/jekyll-theme-chirpy/commit/62bcd601fcadc602c81672b1d4b937231396c3c0)) +* **ui:** update the twitter icon ([#1221](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1221)) ([aff7566](https://github.com/cotes2020/jekyll-theme-chirpy/commit/aff75667749769644f990d3dc9b0720c7d96d14d)) + +### Improvements + +* **core:** speed up the Jekyll build times ([#1163](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1163)) ([0d4103d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0d4103d47bc9cff93918bb09a2957737cc3c9fe0)) +* refactor using semantic HTML ([#1207](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1207)) ([505e314](https://github.com/cotes2020/jekyll-theme-chirpy/commit/505e314a3142c332e39365fbe2dac23df1bf0abe)), closes [#1196](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1196) +* **ui:** improve code snippet design ([4f86b04](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4f86b04a8487ebbf4a6d0d70b0c3ece79e9269f3)) +* **ui:** improve web accessibility ([#447](https://github.com/cotes2020/jekyll-theme-chirpy/issues/447)) ([37c9764](https://github.com/cotes2020/jekyll-theme-chirpy/commit/37c976499ead51c1d88e8e8213366240a72adebc)) + ## [6.1.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.0.0...v6.1.0) (2023-07-02) ### Features diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 90ba319..aa57965 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-theme-chirpy" - spec.version = "6.1.0" + spec.version = "6.2.0" spec.authors = ["Cotes Chung"] spec.email = ["cotes.chung@gmail.com"] diff --git a/package.json b/package.json index fa03060..232bd37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jekyll-theme-chirpy", - "version": "6.1.0", + "version": "6.2.0", "description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.", "repository": { "type": "git", From 1a041e0443696e6ed22d905c65ba1c88c302aa5f Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:45:27 +0800 Subject: [PATCH 2/3] style(pwa): use 2 spaces indentation for `sw.js` and `swcache.js` --- assets/js/data/swcache.js | 57 ++++++++++--------- assets/js/pwa/sw.js | 113 +++++++++++++++++++------------------- 2 files changed, 84 insertions(+), 86 deletions(-) diff --git a/assets/js/data/swcache.js b/assets/js/data/swcache.js index 9ff3899..f4dcc87 100644 --- a/assets/js/data/swcache.js +++ b/assets/js/data/swcache.js @@ -1,49 +1,48 @@ --- layout: compress - # The list to be cached by PWA --- const resource = [ - /* --- CSS --- */ - '{{ "/assets/css/style.css" | relative_url }}', + /* --- CSS --- */ + '{{ "/assets/css/style.css" | relative_url }}', - /* --- PWA --- */ - '{{ "/app.js" | relative_url }}', - '{{ "/sw.js" | relative_url }}', + /* --- PWA --- */ + '{{ "/app.js" | relative_url }}', + '{{ "/sw.js" | relative_url }}', - /* --- HTML --- */ - '{{ "/index.html" | relative_url }}', - '{{ "/404.html" | relative_url }}', + /* --- HTML --- */ + '{{ "/index.html" | relative_url }}', + '{{ "/404.html" | relative_url }}', - {% for tab in site.tabs %} - '{{ tab.url | relative_url }}', - {% endfor %} + {% for tab in site.tabs %} + '{{ tab.url | relative_url }}', + {% endfor %} - /* --- Favicons & compressed JS --- */ - {% assign cache_list = site.static_files | where: 'swcache', true %} - {% for file in cache_list %} - '{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} - {% endfor %} + /* --- Favicons & compressed JS --- */ + {% assign cache_list = site.static_files | where: 'swcache', true %} + {% for file in cache_list %} + '{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} + {% endfor %} ]; /* The request url with below domain will be cached */ const allowedDomains = [ - {% if site.google_analytics.id != empty and site.google_analytics.id %} - 'www.googletagmanager.com', - 'www.google-analytics.com', - {% endif %} + {% if site.google_analytics.id != empty and site.google_analytics.id %} + 'www.googletagmanager.com', + 'www.google-analytics.com', + {% endif %} - '{{ site.url | split: "//" | last }}', + '{{ site.url | split: "//" | last }}', - {% if site.img_cdn contains '//' and site.img_cdn %} - '{{ site.img_cdn | split: '//' | last | split: '/' | first }}', - {% endif %} + {% if site.img_cdn contains '//' and site.img_cdn %} + '{{ site.img_cdn | split: '//' | last | split: '/' | first }}', + {% endif %} - 'fonts.gstatic.com', - 'fonts.googleapis.com', - 'cdn.jsdelivr.net', - 'polyfill.io' + 'fonts.gstatic.com', + 'fonts.googleapis.com', + 'cdn.jsdelivr.net', + 'polyfill.io' ]; /* Requests that include the following path will be banned */ diff --git a/assets/js/pwa/sw.js b/assets/js/pwa/sw.js index 3213b4f..0e22f90 100644 --- a/assets/js/pwa/sw.js +++ b/assets/js/pwa/sw.js @@ -9,82 +9,81 @@ self.importScripts('{{ "/assets/js/data/swcache.js" | relative_url }}'); const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M%S" }}'; function verifyDomain(url) { - for (const domain of allowedDomains) { - const regex = RegExp(`^http(s)?:\/\/${domain}\/`); - if (regex.test(url)) { - return true; - } + for (const domain of allowedDomains) { + const regex = RegExp(`^http(s)?:\/\/${domain}\/`); + if (regex.test(url)) { + return true; } + } - return false; + return false; } function isExcluded(url) { - for (const item of denyUrls) { - if (url === item) { - return true; - } + for (const item of denyUrls) { + if (url === item) { + return true; } - return false; + } + return false; } -self.addEventListener('install', event => { - event.waitUntil( - caches.open(cacheName).then(cache => { - return cache.addAll(resource); - }) - ); +self.addEventListener('install', (event) => { + event.waitUntil( + caches.open(cacheName).then((cache) => { + return cache.addAll(resource); + }) + ); }); -self.addEventListener('activate', event => { - event.waitUntil( - caches.keys().then(keyList => { - return Promise.all( - keyList.map(key => { - if (key !== cacheName) { - return caches.delete(key); - } - }) - ); +self.addEventListener('activate', (event) => { + event.waitUntil( + caches.keys().then((keyList) => { + return Promise.all( + keyList.map((key) => { + if (key !== cacheName) { + return caches.delete(key); + } }) - ); + ); + }) + ); }); self.addEventListener('message', (event) => { - if (event.data === 'SKIP_WAITING') { - self.skipWaiting(); - } + if (event.data === 'SKIP_WAITING') { + self.skipWaiting(); + } }); -self.addEventListener('fetch', event => { - event.respondWith( - caches.match(event.request).then(response => { - if (response) { - return response; - } +self.addEventListener('fetch', (event) => { + event.respondWith( + caches.match(event.request).then((response) => { + if (response) { + return response; + } - return fetch(event.request).then(response => { - const url = event.request.url; + return fetch(event.request).then((response) => { + const url = event.request.url; - if (event.request.method !== 'GET' || - !verifyDomain(url) || - isExcluded(url)) { - return response; - } + if ( + event.request.method !== 'GET' || + !verifyDomain(url) || + isExcluded(url) + ) { + return response; + } - /* - see: - */ - let responseToCache = response.clone(); + /* see: */ + let responseToCache = response.clone(); - caches.open(cacheName).then(cache => { - /* console.log('[sw] Caching new resource: ' + event.request.url); */ - cache.put(event.request, responseToCache); - }); + caches.open(cacheName).then((cache) => { + /* console.log('[sw] Caching new resource: ' + event.request.url); */ + cache.put(event.request, responseToCache); + }); - return response; - }); - }) - ); + return response; + }); + }) + ); }); - From 4da7406dfea112a4a2b1db5615ecf2672be6694f Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 11 Sep 2023 00:35:56 +0800 Subject: [PATCH 3/3] fix(pwa): installation failure caused by outdated cache entries Change `/assets/css/style.css` to `/assets/css/jekyll-theme-chirpy.css` --- assets/js/data/swcache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/data/swcache.js b/assets/js/data/swcache.js index f4dcc87..ed5d40e 100644 --- a/assets/js/data/swcache.js +++ b/assets/js/data/swcache.js @@ -5,7 +5,7 @@ layout: compress const resource = [ /* --- CSS --- */ - '{{ "/assets/css/style.css" | relative_url }}', + '{{ "/assets/css/:THEME.css" | replace: ':THEME', site.theme | relative_url }}', /* --- PWA --- */ '{{ "/app.js" | relative_url }}',