1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-21 23:25:25 +00:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Cotes Chung
87a12be897 chore(release): 6.2.2 2023-09-11 02:32:35 +08:00
Cotes Chung
0614473893 Merge branch 'hotfix/6.2.2' into production 2023-09-11 02:32:32 +08:00
Cotes Chung
273b389c51 fix(sidebar): contact icons not stacking (#1224)
Fixes #1224
2023-09-11 02:28:16 +08:00
Cotes Chung
b3005f4e1a chore(release): 6.2.1 2023-09-11 00:36:52 +08:00
Cotes Chung
14d3960ca0 Merge branch 'hotfix/6.2.1' into production 2023-09-11 00:36:50 +08:00
Cotes Chung
4da7406dfe fix(pwa): installation failure caused by outdated cache entries
Change `/assets/css/style.css` to `/assets/css/jekyll-theme-chirpy.css`
2023-09-11 00:35:56 +08:00
Cotes Chung
1a041e0443 style(pwa): use 2 spaces indentation for sw.js and swcache.js 2023-09-11 00:30:23 +08:00
7 changed files with 132 additions and 124 deletions

View File

@@ -2,6 +2,18 @@
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. 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.2](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.2.1...v6.2.2) (2023-09-10)
### Bug Fixes
* **sidebar:** contact icons not stacking ([#1224](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1224)) ([273b389](https://github.com/cotes2020/jekyll-theme-chirpy/commit/273b389c512f13693ed6cdf57d256ac21deae97c))
## [6.2.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.2.0...v6.2.1) (2023-09-10)
### Bug Fixes
* **pwa:** installation failure caused by outdated cache entries ([4da7406](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4da7406dfea112a4a2b1db5615ecf2672be6694f))
## [6.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.1.0...v6.2.0) (2023-09-10) ## [6.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.1.0...v6.2.0) (2023-09-10)
### Features ### Features

View File

@@ -59,48 +59,46 @@
{% endif %} {% endif %}
{% endunless %} {% endunless %}
<address class="d-flex mb-0"> {% for entry in site.data.contact %}
{% for entry in site.data.contact %} {% case entry.type %}
{% case entry.type %} {% when 'github', 'twitter' %}
{% when 'github', 'twitter' %} {%- capture url -%}
{%- capture url -%}
https://{{ entry.type }}.com/{{ site[entry.type].username }} https://{{ entry.type }}.com/{{ site[entry.type].username }}
{%- endcapture -%} {%- endcapture -%}
{% when 'email' %} {% when 'email' %}
{% assign email = site.social.email | split: '@' %} {% assign email = site.social.email | split: '@' %}
{%- capture url -%} {%- capture url -%}
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@') javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
{%- endcapture -%} {%- endcapture -%}
{% when 'rss' %} {% when 'rss' %}
{% assign url = '/feed.xml' | relative_url %} {% assign url = '/feed.xml' | relative_url %}
{% else %} {% else %}
{% assign url = entry.url %} {% assign url = entry.url %}
{% endcase %} {% endcase %}
{% if url %} {% if url %}
<a <a
href="{{ url }}" href="{{ url }}"
aria-label="{{ entry.type }}" aria-label="{{ entry.type }}"
{% assign link_types = '' %} {% assign link_types = '' %}
{% unless entry.noblank %} {% unless entry.noblank %}
target="_blank" target="_blank"
{% assign link_types = 'noopener noreferrer' %} {% assign link_types = 'noopener noreferrer' %}
{% endunless %} {% endunless %}
{% if entry.type == 'mastodon' %} {% if entry.type == 'mastodon' %}
{% assign link_types = link_types | append: ' me' | strip %} {% assign link_types = link_types | append: ' me' | strip %}
{% endif %} {% endif %}
{% unless link_types == empty %} {% unless link_types == empty %}
rel="{{ link_types }}" rel="{{ link_types }}"
{% endunless %} {% endunless %}
> >
<i class="{{ entry.icon }}"></i> <i class="{{ entry.icon }}"></i>
</a> </a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</address>
</div> </div>
<!-- .sidebar-bottom --> <!-- .sidebar-bottom -->
</aside> </aside>

View File

@@ -830,8 +830,8 @@ $btn-mb: 0.5rem;
} }
.sidebar-bottom { .sidebar-bottom {
@include pl-pr(2rem); padding-left: 2rem;
padding-right: 1rem;
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
%button { %button {

View File

@@ -1,49 +1,48 @@
--- ---
layout: compress layout: compress
# The list to be cached by PWA # The list to be cached by PWA
--- ---
const resource = [ const resource = [
/* --- CSS --- */ /* --- CSS --- */
'{{ "/assets/css/style.css" | relative_url }}', '{{ "/assets/css/:THEME.css" | replace: ':THEME', site.theme | relative_url }}',
/* --- PWA --- */ /* --- PWA --- */
'{{ "/app.js" | relative_url }}', '{{ "/app.js" | relative_url }}',
'{{ "/sw.js" | relative_url }}', '{{ "/sw.js" | relative_url }}',
/* --- HTML --- */ /* --- HTML --- */
'{{ "/index.html" | relative_url }}', '{{ "/index.html" | relative_url }}',
'{{ "/404.html" | relative_url }}', '{{ "/404.html" | relative_url }}',
{% for tab in site.tabs %} {% for tab in site.tabs %}
'{{ tab.url | relative_url }}', '{{ tab.url | relative_url }}',
{% endfor %} {% endfor %}
/* --- Favicons & compressed JS --- */ /* --- Favicons & compressed JS --- */
{% assign cache_list = site.static_files | where: 'swcache', true %} {% assign cache_list = site.static_files | where: 'swcache', true %}
{% for file in cache_list %} {% for file in cache_list %}
'{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} '{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
{% endfor %} {% endfor %}
]; ];
/* The request url with below domain will be cached */ /* The request url with below domain will be cached */
const allowedDomains = [ const allowedDomains = [
{% if site.google_analytics.id != empty and site.google_analytics.id %} {% if site.google_analytics.id != empty and site.google_analytics.id %}
'www.googletagmanager.com', 'www.googletagmanager.com',
'www.google-analytics.com', 'www.google-analytics.com',
{% endif %} {% endif %}
'{{ site.url | split: "//" | last }}', '{{ site.url | split: "//" | last }}',
{% if site.img_cdn contains '//' and site.img_cdn %} {% if site.img_cdn contains '//' and site.img_cdn %}
'{{ site.img_cdn | split: '//' | last | split: '/' | first }}', '{{ site.img_cdn | split: '//' | last | split: '/' | first }}',
{% endif %} {% endif %}
'fonts.gstatic.com', 'fonts.gstatic.com',
'fonts.googleapis.com', 'fonts.googleapis.com',
'cdn.jsdelivr.net', 'cdn.jsdelivr.net',
'polyfill.io' 'polyfill.io'
]; ];
/* Requests that include the following path will be banned */ /* Requests that include the following path will be banned */

View File

@@ -9,82 +9,81 @@ self.importScripts('{{ "/assets/js/data/swcache.js" | relative_url }}');
const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M%S" }}'; const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M%S" }}';
function verifyDomain(url) { function verifyDomain(url) {
for (const domain of allowedDomains) { for (const domain of allowedDomains) {
const regex = RegExp(`^http(s)?:\/\/${domain}\/`); const regex = RegExp(`^http(s)?:\/\/${domain}\/`);
if (regex.test(url)) { if (regex.test(url)) {
return true; return true;
}
} }
}
return false; return false;
} }
function isExcluded(url) { function isExcluded(url) {
for (const item of denyUrls) { for (const item of denyUrls) {
if (url === item) { if (url === item) {
return true; return true;
}
} }
return false; }
return false;
} }
self.addEventListener('install', event => { self.addEventListener('install', (event) => {
event.waitUntil( event.waitUntil(
caches.open(cacheName).then(cache => { caches.open(cacheName).then((cache) => {
return cache.addAll(resource); return cache.addAll(resource);
}) })
); );
}); });
self.addEventListener('activate', event => { self.addEventListener('activate', (event) => {
event.waitUntil( event.waitUntil(
caches.keys().then(keyList => { caches.keys().then((keyList) => {
return Promise.all( return Promise.all(
keyList.map(key => { keyList.map((key) => {
if (key !== cacheName) { if (key !== cacheName) {
return caches.delete(key); return caches.delete(key);
} }
})
);
}) })
); );
})
);
}); });
self.addEventListener('message', (event) => { self.addEventListener('message', (event) => {
if (event.data === 'SKIP_WAITING') { if (event.data === 'SKIP_WAITING') {
self.skipWaiting(); self.skipWaiting();
} }
}); });
self.addEventListener('fetch', event => { self.addEventListener('fetch', (event) => {
event.respondWith( event.respondWith(
caches.match(event.request).then(response => { caches.match(event.request).then((response) => {
if (response) { if (response) {
return response; return response;
} }
return fetch(event.request).then(response => { return fetch(event.request).then((response) => {
const url = event.request.url; const url = event.request.url;
if (event.request.method !== 'GET' || if (
!verifyDomain(url) || event.request.method !== 'GET' ||
isExcluded(url)) { !verifyDomain(url) ||
return response; isExcluded(url)
} ) {
return response;
}
/* /* see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests> */
see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests> let responseToCache = response.clone();
*/
let responseToCache = response.clone();
caches.open(cacheName).then(cache => { caches.open(cacheName).then((cache) => {
/* console.log('[sw] Caching new resource: ' + event.request.url); */ /* console.log('[sw] Caching new resource: ' + event.request.url); */
cache.put(event.request, responseToCache); cache.put(event.request, responseToCache);
}); });
return response; return response;
}); });
}) })
); );
}); });

View File

@@ -2,7 +2,7 @@
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "jekyll-theme-chirpy" spec.name = "jekyll-theme-chirpy"
spec.version = "6.2.0" spec.version = "6.2.2"
spec.authors = ["Cotes Chung"] spec.authors = ["Cotes Chung"]
spec.email = ["cotes.chung@gmail.com"] spec.email = ["cotes.chung@gmail.com"]

View File

@@ -1,6 +1,6 @@
{ {
"name": "jekyll-theme-chirpy", "name": "jekyll-theme-chirpy",
"version": "6.2.0", "version": "6.2.2",
"description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.", "description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.",
"repository": { "repository": {
"type": "git", "type": "git",