mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 05:41:31 +00:00
Reduce the external files required for gem installation
This commit is contained in:
21
assets/404.html
Normal file
21
assets/404.html
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
layout: page
|
||||
title: "404: Page not found"
|
||||
permalink: /404.html
|
||||
|
||||
redirect_from:
|
||||
- /norobots/
|
||||
- /assets/
|
||||
- /posts/
|
||||
|
||||
dynamic_title: true
|
||||
---
|
||||
|
||||
<div class="lead">
|
||||
<p>Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. </p>
|
||||
<p>
|
||||
<a href="{{ '/' | relative_url }}">Head back Home</a>
|
||||
to try finding it again, or search for it on the
|
||||
<a href="{{ 'archives' | relative_url }}">Archives page</a>.
|
||||
</p>
|
||||
</div>
|
||||
61
assets/feed.xml
Normal file
61
assets/feed.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
layout: compress
|
||||
permalink: /feed.xml
|
||||
# Atom Feed, reference: https://validator.w3.org/feed/docs/atom.html
|
||||
---
|
||||
|
||||
{% capture source %}
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<id>{{ "/" | absolute_url }}</id>
|
||||
<title>{{ site.title }}</title>
|
||||
<subtitle>{{ site.description }}</subtitle>
|
||||
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
||||
<author>
|
||||
<name>{{ site.social.name }}</name>
|
||||
<uri>{{ "/" | absolute_url }}</uri>
|
||||
</author>
|
||||
<link rel="self" type="application/atom+xml" href="{{ page.url | absolute_url }}"/>
|
||||
<link rel="alternate" type="text/html" hreflang="{{ site.lang | default: 'en' }}"
|
||||
href="{{ '/' | absolute_url }}"/>
|
||||
<generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
|
||||
<rights> © {{ 'now' | date: '%Y' }} {{ site.social.name }} </rights>
|
||||
<icon>{{ site.baseurl }}/assets/img/favicons/favicon.ico</icon>
|
||||
<logo>{{ site.baseurl }}/assets/img/favicons/favicon-96x96.png</logo>
|
||||
|
||||
{% for post in site.posts limit: 5 %}
|
||||
{% assign post_absolute_url = post.url | absolute_url %}
|
||||
<entry>
|
||||
<title>{{ post.title }}</title>
|
||||
<link href="{{ post_absolute_url }}" rel="alternate" type="text/html" title="{{ post.title }}" />
|
||||
<published>{{ post.date | date_to_xmlschema }}</published>
|
||||
{% if post.last_modified_at %}
|
||||
<updated>{{ post.last_modified_at | date_to_xmlschema }}</updated>
|
||||
{% else %}
|
||||
<updated>{{ post.date | date_to_xmlschema }}</updated>
|
||||
{% endif %}
|
||||
<id>{{ post_absolute_url }}</id>
|
||||
<content src="{{ post_absolute_url }}" />
|
||||
<author>
|
||||
<name>{{ post.author | default: site.social.name }}</name>
|
||||
</author>
|
||||
|
||||
{% if post.categories %}
|
||||
{% for category in post.categories %}
|
||||
<category term="{{ category }}" />
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if post.summary %}
|
||||
<summary>{{ post.summary | strip }}</summary>
|
||||
{% else %}
|
||||
<summary>
|
||||
{% include no-linenos.html content=post.content %}
|
||||
{{ content | strip_html | truncate: 400 }}
|
||||
</summary>
|
||||
{% endif %}
|
||||
|
||||
</entry>
|
||||
{% endfor %}
|
||||
</feed>
|
||||
{% endcapture %}
|
||||
{{ source | replace: '&', '&' }}
|
||||
9
assets/js/pwa/app.js
Normal file
9
assets/js/pwa/app.js
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
layout: compress
|
||||
permalink: '/app.js'
|
||||
---
|
||||
|
||||
/* Registering Service Worker */
|
||||
if('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}');
|
||||
};
|
||||
87
assets/js/pwa/sw.js
Normal file
87
assets/js/pwa/sw.js
Normal file
@@ -0,0 +1,87 @@
|
||||
---
|
||||
layout: compress
|
||||
permalink: '/sw.js'
|
||||
# PWA service worker
|
||||
---
|
||||
|
||||
self.importScripts('{{ "/assets/js/data/swcache.js" | relative_url }}');
|
||||
|
||||
const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M" }}';
|
||||
|
||||
function verifyDomain(url) {
|
||||
for (const domain of allowedDomains) {
|
||||
const regex = RegExp(`^http(s)?:\/\/${domain}\/`);
|
||||
if (regex.test(url)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isExcluded(url) {
|
||||
for (const item of denyUrls) {
|
||||
if (url === item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
self.addEventListener('install', e => {
|
||||
self.skipWaiting();
|
||||
e.waitUntil(
|
||||
caches.open(cacheName).then(cache => {
|
||||
return cache.addAll(resource);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
if (event.request.method !== 'GET' ||
|
||||
!verifyDomain(url) ||
|
||||
isExcluded(url)) {
|
||||
return response;
|
||||
}
|
||||
|
||||
/*
|
||||
see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
|
||||
*/
|
||||
let responseToCache = response.clone();
|
||||
|
||||
caches.open(cacheName)
|
||||
.then(cache => {
|
||||
/* console.log('[sw] Caching new resource: ' + event.request.url); */
|
||||
cache.put(event.request, responseToCache);
|
||||
});
|
||||
|
||||
return response;
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('activate', e => {
|
||||
e.waitUntil(
|
||||
caches.keys().then(keyList => {
|
||||
return Promise.all(
|
||||
keyList.map(key => {
|
||||
if(key !== cacheName) {
|
||||
return caches.delete(key);
|
||||
}
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
10
assets/robots.txt
Normal file
10
assets/robots.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
permalink: /robots.txt
|
||||
# The robots rules
|
||||
---
|
||||
|
||||
User-agent: *
|
||||
|
||||
Disallow: /norobots/
|
||||
|
||||
Sitemap: {{ '/sitemap.xml' | absolute_url }}
|
||||
Reference in New Issue
Block a user