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

Compare commits

..

103 Commits

Author SHA1 Message Date
Cotes Chung
a6d4db251f Bump version to 4.0.2 2021-06-23 23:02:54 +08:00
Cotes Chung
c8f2a18bd1 Lock the ruby version number (#245, #247, #344)
Since version 3.0, Ruby has no `webrick` that Jekyll (<= 4.2) needs
2021-06-23 23:02:52 +08:00
Cotes Chung
b887c439c6 Bump version to 4.0.1 2021-05-08 03:26:04 +08:00
Cotes Chung
89d73aa4cf Add the missing files to the gem 2021-05-08 03:26:01 +08:00
Cotes Chung
db82f71515 Bump version to 4.0.0 2021-04-30 14:10:23 +08:00
Cotes Chung
6d254af55f Simplify the favicons 2021-04-29 19:58:37 +08:00
Cotes Chung
a4dc39f70e Center the mermaid SVG 2021-04-24 16:32:56 +08:00
Cotes Chung
84bb4d0c4b Add image popup effect 2021-04-24 16:32:56 +08:00
Cotes Chung
e8296fe2e4 Improve the site config 2021-04-20 04:34:11 +08:00
Cotes Chung
6a45d7ccd1 Remove SRI of bootstrap and font-awesome css
Sometimes it causes the fetch event to fail after the PWA cache key is updated:

```
The FetchEvent for "<url_from_CDN>" resulted in a network error response: an "opaque" response was used for a request whose type is not no-cors
```
2021-04-20 04:22:28 +08:00
Cotes Chung
5df67616be Fix the grammar and typo of the docs 2021-04-20 04:22:28 +08:00
Cotes Chung
f0ce5ceb71 Fix tabs url for service worker 2021-04-20 04:22:28 +08:00
Cotes Chung
a9acaa669d Reduce the external files required for gem installation 2021-04-20 04:22:28 +08:00
Cotes Chung
72e8ffafa6 Exclude JS source code from the output 2021-04-20 04:22:28 +08:00
Cotes Chung
52f4012463 Fix custom author name in RSS template 2021-04-18 03:21:55 +08:00
Cotes Chung
d5407181a4 Add shadow effect option for images 2021-04-18 03:15:11 +08:00
Cotes Chung
4ed6988be3 Globally mark out image links 2021-04-17 15:00:21 +08:00
Cotes Chung
3f2d400f16 Improve the selector for lazy loading images (fix #313)
When `page.dynamic_title` is set to false, the image will not be loaded
2021-04-13 23:29:24 +08:00
Cotes Chung
e84331b26a Fix the response stream of service worker
After service worker update (rebuild the site), the following error will occasionally appear:

```
The FetchEvent for "<url_from_CDN>" resulted in a network error response: an "opaque" response was used for a request whose type is not no-cors
```

This commit ensures that the response object has been cached before being returned.
2021-04-13 16:51:49 +08:00
Cotes Chung
efd8d44b12 Improve the UI design
- Optimize the text color in light mode
- Stop iOS Safari input field zooming
- Uniform font size for posts
2021-04-13 16:51:49 +08:00
Cotes Chung
a71659ed27 Fix bump tool 2021-04-12 13:34:01 +08:00
mattpopovich
b14e97a92d Small typo fix 2021-04-12 12:38:39 +08:00
Cotes Chung
826b7dca1a Turn off autocompletion of input form 2021-04-11 14:13:30 +08:00
Cotes Chung
d720d0f66c Bump version to 3.3.2
(cherry picked from commit 0b0e493ff0)
2021-04-11 01:39:27 +08:00
Cotes Chung
c1b8e28601 Fix links color in search results 2021-04-11 01:18:19 +08:00
Cotes Chung
aa54e901b1 Resume the pv cache source & add validation for the number of localStorage keys 2021-04-10 23:36:08 +08:00
Cotes Chung
a03149cd40 Reduce PWA storage space 2021-04-10 14:51:04 +08:00
Cotes Chung
588fbbbec7 Stop tracking Gemfile.lock in deployment tool (#306) 2021-04-07 15:15:17 +08:00
Cotes Chung
6341752986 Enhance detection of PV key validity in localStorage 2021-04-07 15:01:23 +08:00
Cotes Chung
11bcd7027d Fix dns links in head 2021-04-06 23:16:02 +08:00
Cotes Chung
4a0242e496 Simplify the PV config options
- Remove options `site.google_analytics.pv.enabled` and `site.google_analytics.pv.proxy_url`
- Rename options `site.google_analytics.pv.cache` to `site.google_analytics.pv.cache_path`
2021-04-06 23:15:36 +08:00
Cotes Chung
48e4c7e6d3 Fix the PV fetching failed when local cache is disabled
also improve the PV report logic
2021-04-06 02:32:53 +08:00
Cotes Chung
991f53f8b2 Unify the text color in the panel 2021-04-06 02:32:53 +08:00
Cotes Chung
7a5ad10bdc Optimize the responsive design for Pad devices 2021-04-06 02:32:53 +08:00
Cotes Chung
3b5441a1c2 Hide scrollbar of sidebar 2021-04-05 18:47:03 +08:00
Cotes Chung
a1fca3706f Update credits in README 2021-04-02 22:18:19 +08:00
Cotes Chung
49346fd3c6 Bump version to 3.3.1
(cherry picked from commit 0b043daa34)
2021-04-02 21:15:50 +08:00
Cotes Chung
bff97df3b5 Fix the MathJax config was lost in jekyll-compress-html 2021-04-02 21:14:43 +08:00
Cotes Chung
dbe4c3d42f Bump version to 3.3.0
(cherry picked from commit 41741dc336)
2021-04-02 16:17:40 +08:00
Cotes Chung
fad8a23b87 Update the bump tool 2021-04-02 16:16:31 +08:00
Cotes Chung
834de0f02c Optimize the typo color 2021-04-02 16:10:07 +08:00
Cotes Chung
1ff38722a2 Rename copyright file for JS 2021-04-02 16:02:14 +08:00
Cotes Chung
1c0cd6b6b0 Remove a stale variable from timeago.js 2021-04-02 15:57:36 +08:00
Cotes Chung
4973a61e39 Update ruby setup actions (fix #306)
No longer tracking Gemfile.lock
2021-04-01 04:17:18 +08:00
dependabot-preview[bot]
99c12f6cd4 [Security] Bump kramdown from 2.3.0 to 2.3.1
Bumps [kramdown](https://github.com/gettalong/kramdown) from 2.3.0 to 2.3.1. **This update includes a security fix.**
- [Release notes](https://github.com/gettalong/kramdown/releases)
- [Changelog](https://github.com/gettalong/kramdown/blob/master/doc/news.page)
- [Commits](https://github.com/gettalong/kramdown/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-29 17:15:44 +00:00
Cotes Chung
042cec33d8 Update docs
- Remove ToC
- Remove JetBrains logo from readme
- Update funding options
2021-03-28 13:48:49 +08:00
Cotes Chung
8c940dbb96 Fix a code snippet of tutorial 2021-03-23 15:45:21 +08:00
Cotes Chung
9636612755 Fix the cache list on service worker
Adding '/index.html' to the cache storage
2021-03-23 15:42:10 +08:00
Cotes Chung
18f6c6ac4e Fix PWA error caused by service worker store the POST Request as cache key
fix #297, fix #301
2021-03-22 22:38:22 +08:00
Cotes Chung
88aa81dfe5 Revert "Restore the year of first publication in footer"
This reverts commit 338eddb454.
2021-03-20 22:41:35 +08:00
Cotes Chung
1b47c95cf6 Disable configuration option 'site.author' 2021-03-20 22:37:10 +08:00
DuchkPy
aa7309c136 Update typing error 2021-03-12 23:28:45 +08:00
Cotes Chung
d162167580 Support TeX and LaTeX math delimiters (#243) 2021-03-09 15:52:56 +08:00
Cotes Chung
6688e27787 Improve the pattern of issue bot 2021-03-04 21:52:19 +08:00
Cotes Chung
89751c8e9f Bump version to 3.2.2
(cherry picked from commit f78747d841)
2021-03-04 15:04:14 +08:00
Cotes Chung
eae506113b Fix the corners of the page navigation buttons of the latest/oldest post 2021-03-04 15:02:06 +08:00
Cotes Chung
3400568b09 Change the bundle cache path on gh-actions
ubuntu-latest changed from 18.04 TLS to 20.04 LTS causes a file path change to the `ffi` gem, invalidating the gh-actions cache file, and causes the build to fail.

See: <https://github.com/ffi/ffi/issues/769>
2021-03-04 15:02:06 +08:00
Cotes Chung
d2bb423220 Change the order of post meta & improve timeago 2021-03-03 18:32:06 +08:00
dependabot-preview[bot]
c6b0a8247b Bump html-proofer from 3.18.5 to 3.18.6
Bumps [html-proofer](https://github.com/gjtorikian/html-proofer) from 3.18.5 to 3.18.6.
- [Release notes](https://github.com/gjtorikian/html-proofer/releases)
- [Commits](https://github.com/gjtorikian/html-proofer/compare/v3.18.5...v3.18.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-01 21:11:56 +08:00
Cotes Chung
8ce8fc780f Improve the bump tool 2021-02-28 05:49:29 +08:00
Cotes Chung
ac2ec585f6 Update the sponsor buttons 2021-02-28 05:49:29 +08:00
Cotes Chung
338eddb454 Restore the year of first publication in footer 2021-02-28 05:42:24 +08:00
Cotes Chung
3573ccb7a3 Update the prompt of comments 2021-02-26 00:50:42 +08:00
Cotes Chung
82b3d061af Update the condition of issues intercept 2021-02-22 15:59:08 +08:00
Cotes Chung
fc94a8e36b Migration from BMC to Ko-fi 2021-02-22 15:55:54 +08:00
Cotes Chung
efc8c60b5d Fix image width in the list (when screen width is 768px) 2021-02-22 14:57:29 +08:00
Cotes Chung
3e79ad6300 Bump version to 3.2.1
(cherry picked from commit 125c23f19b)
2021-02-10 23:50:06 +08:00
Cotes Chung
273f2e152d Restore the copy link button in the post sharing option
Affected version >= 3.0.3, <= 3.2.0
2021-02-10 23:48:26 +08:00
Cotes Chung
d0a23c21ee Bump version to 3.2.0
(cherry picked from commit e13187cb1d)
2021-02-10 21:27:18 +08:00
Cotes Chung
89200f3109 Improve the bump tool 2021-02-10 21:15:58 +08:00
Cotes Chung
136773481e Add branches notice to the Docs 2021-02-10 21:15:58 +08:00
Cotes Chung
de7d2fab7c Optimize the language badge position in code block 2021-02-10 21:15:58 +08:00
Cotes Chung
1b1fa93cf6 Fix typo in readme & quick-start tutorial 2021-02-06 02:05:19 +08:00
Cotes Chung
7e31ba4103 Improve the width of search results items (fix #276) 2021-02-05 22:13:44 +08:00
Cotes Chung
34b7a80a78 Bump version to 3.1.1 2021-02-05 02:05:55 +08:00
Cotes Chung
ba6c7eceec Add a modification to Gemfile.lock in bump tool 2021-02-05 01:55:20 +08:00
Cotes Chung
5669f792a7 Fix search results slow scrolling (#273)
also:
- improve its responsive design
- fix the js path in gulp
2021-02-05 01:24:15 +08:00
Cotes Chung
f864b5c324 Hide empty categries/tags in search (#273) 2021-02-05 00:51:50 +08:00
Cotes Chung
c8ff81e79a Use regex in site exclusion list 2021-02-04 03:38:04 +08:00
Cotes Chung
2bcaabdab4 Give travis a new job: monitor the starter files 2021-02-04 03:15:20 +08:00
Cotes Chung
4faa595b04 Update dependencies in Gemfile.lock 2021-02-03 02:41:33 +08:00
Cotes Chung
d7443aad5d Bump version to 3.1.0 2021-02-03 01:42:10 +08:00
Cotes Chung
b2beaa0f4c Update travis settings for release-branches
- drop the deprecated flag `--deployment` of bundle (so we have to specify the bundler caching path)
2021-02-03 00:46:36 +08:00
Cotes Chung
83a7878043 Improved bump tool to fit the release branches 2021-02-02 21:56:17 +08:00
Cotes Chung
94b99350fc Restore the prompt in the page nav button in the latest/oldest articles 2021-02-02 21:56:17 +08:00
Cotes Chung
6dc9cdfa25 Reduce the font size of the Disqus prompt 2021-02-02 21:56:17 +08:00
Cotes Chung
fa56ea48c3 Improve docs 2021-02-02 21:56:17 +08:00
dependabot-preview[bot]
7d3e25c90d Bump tzinfo-data from 1.2020.6 to 1.2021.1 (#272)
Bumps [tzinfo-data](https://github.com/tzinfo/tzinfo-data) from 1.2020.6 to 1.2021.1.
- [Release notes](https://github.com/tzinfo/tzinfo-data/releases)
- [Commits](https://github.com/tzinfo/tzinfo-data/compare/v1.2020.6...v1.2021.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-02-01 19:33:45 +08:00
Cotes Chung
6c9ab6e5f8 Fix gemfile 2021-02-01 18:03:27 +08:00
Cotes Chung
91da99282d Add lang option to the site config sample 2021-02-01 17:38:50 +08:00
Cotes Chung
413a86277b Generate the breadcrumb by Liquid
also subtracted '/tabs/' from the tabs path
2021-01-31 22:06:10 +08:00
Cotes Chung
1879b94f3d Exclude gem-spec from output 2021-01-30 05:28:33 +08:00
Cotes Chung
7b5f7086b7 Fix post feature image style 2021-01-30 03:12:43 +08:00
Cotes Chung
a8b8a379f6 Improve the docs
- Add missing url references in the tutorial
- Add gem version badge in README
2021-01-30 02:00:34 +08:00
Bogdan Stoica
eacad65cbb Add alt attribute to the post's preview image (#271) 2021-01-30 01:14:03 +08:00
Cotes Chung
7a87ab4d05 Bump version to 3.0.3 2021-01-28 23:44:53 +08:00
Cotes Chung
c4be7c0cd6 Add more spec meta to gem 2021-01-28 23:39:03 +08:00
Cotes Chung
c9765e6923 Merge gem-build & bump tool
Drop the yard doc
2021-01-28 23:17:16 +08:00
Cotes Chung
5c04d4e45b Bypass the jekyll build on source branch 2021-01-28 20:56:23 +08:00
Cotes Chung
4d969ca0c5 Fix toc of readme 2021-01-28 20:56:23 +08:00
Cotes Chung
4a084eb681 Add new tool to build gem 2021-01-28 04:57:11 +08:00
Cotes Chung
adc117972a Fix the year of copyright 2021-01-28 03:37:08 +08:00
Cotes Chung
8e84c6b9d6 Improve code style
- js/css
- markdown
- shell
2021-01-28 03:21:58 +08:00
115 changed files with 2097 additions and 2006 deletions

4
.github/FUNDING.yml vendored
View File

@@ -1 +1,3 @@
custom: ['https://www.buymeacoffee.com/coteschung', 'https://cotes.gitee.io/alipay-wechat-donation']
custom:
- https://www.buymeacoffee.com/coteschung
- https://cotes.gitee.io/alipay-wechat-donation

View File

@@ -27,7 +27,7 @@ Please describe the tests that you ran to verify your changes. Provide instructi
### Test Configuration
- Browerser type & version:
- Browser type & version:
- Operating system:
- Bundler version:
- Ruby version:

View File

@@ -24,9 +24,6 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
env:
GEMS_PATH: ~/vendor/bundle
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -34,22 +31,10 @@ jobs:
fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Bundle Caching
uses: actions/cache@v2
with:
path: ${{ env.GEMS_PATH }}
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle Install
run: |
bundle config path ${{ env.GEMS_PATH }}
bundle install --jobs 4 --retry 3
bundler-cache: true
- name: Build Site
env:

View File

@@ -2,9 +2,9 @@ name: "Intercept bad issue/PRs"
on:
issues:
types: [opened, reopened]
types: [opened]
pull_request:
types: [opened, reopened]
types: [opened]
jobs:
autoclose:
@@ -14,7 +14,7 @@ jobs:
uses: roots/issue-closer@v1.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-pattern: "\\[x\\] I have read"
issue-pattern: "(\\[x\\]|\\[X\\]) I have read"
issue-close-message: ":wave: Hi @${issue.user.login},\n\nThis issue is being automatically closed because it does not follow the issue template."
pr-pattern: "\\[x\\] Bug|\\[x\\] New feat|\\[x\\] Break|\\[x\\] Doc|@dependabot"
pr-pattern: "(\\[x\\]|\\[X\\]) (Bug fix|New feature|Breaking change|Documentation update)|@dependabot"
pr-close-message: ":wave: Hi @${pull_request.user.login},\n\nThis PR is being automatically closed because it does not follow the PR template."

View File

@@ -13,9 +13,6 @@ jobs:
runs-on: ubuntu-latest
env:
GEMS_PATH: ~/vendor/bundle
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -23,22 +20,10 @@ jobs:
fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Bundle Caching
uses: actions/cache@v2
with:
path: ${{ env.GEMS_PATH }}
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle Install
run: |
bundle config path ${{ env.GEMS_PATH }}
bundle install --jobs 4 --retry 3
bundler-cache: true
- name: Check baseurl
run: |

5
.gitignore vendored
View File

@@ -2,14 +2,13 @@
.*
!.github
# jekyll cache
# bundler cache
_site
vendor
Gemfile.lock
# rubygem
*.gem
# yard docs
doc
# npm dependencies
node_modules

View File

@@ -1,25 +1,49 @@
os: linux
dist: bionic
language: ruby
rvm: 2.7.0
language: minimal
cache: bundler
jobs:
include:
addons:
apt:
packages:
- libcurl4-openssl-dev # required to avoid SSL error (for htmlproofer)
- name: CD
language: ruby
rvm: 2.7.0
script:
addons:
apt:
packages:
# required to avoid SSL error (for htmlproofer)
- libcurl4-openssl-dev
cache:
directories:
- $TRAVIS_BUILD_DIR/vendor/bundle
before_install:
# match the Gemfile.lock, travis' bundler is 2.1.2
- gem install bundler:2.2.4
- bundle config path 'vendor/bundle'
install:
# overriding to drop the travis `--development` flag
- bundle install --jobs=3 --retry=3
script:
- eval "$BUILD_CMD"
git:
depth: false # for posts' lastmod
- name: Flush Starter
script:
- eval "$FLUSH_STARTER"
before_script:
- git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
- eval "$BUILD_CMD"
branches:
only: production
git:
depth: false # for posts lastmod
only: /.*-stable$/
notifications:
email:

13
Gemfile
View File

@@ -1,15 +1,8 @@
# frozen_string_literal: true
source "https://rubygems.org"
gem "jekyll", "~> 4.1"
# plugins
group :jekyll_plugins do
gem "jekyll-paginate", "~> 1.1"
gem "jekyll-redirect-from", "~> 0.16"
gem "jekyll-seo-tag", "~> 2.7"
gem "jekyll-archives", "~> 2.2"
gem "jekyll-sitemap", "~> 1.4"
end
gemspec
group :test do
gem "html-proofer", "~> 3.18"

View File

@@ -1,113 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.7)
em-websocket (0.5.2)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
ethon (0.12.0)
ffi (>= 1.3.0)
eventmachine (1.2.7)
ffi (1.14.2)
forwardable-extended (2.6.0)
html-proofer (3.18.5)
addressable (~> 2.3)
mercenary (~> 0.3)
nokogumbo (~> 2.0)
parallel (~> 1.3)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
http_parser.rb (0.6.0)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
jekyll (4.2.0)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 2.0)
jekyll-archives (2.2.1)
jekyll (>= 3.6, < 5.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.16.0)
jekyll (>= 3.3, < 5.0)
jekyll-sass-converter (2.1.0)
sassc (> 2.0.1, < 3.0)
jekyll-seo-tag (2.7.1)
jekyll (>= 3.8, < 5.0)
jekyll-sitemap (1.4.0)
jekyll (>= 3.7, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.3.3)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
mini_portile2 (2.5.0)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogumbo (2.0.4)
nokogiri (~> 1.8, >= 1.8.4)
parallel (1.20.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
racc (1.5.2)
rainbow (3.0.0)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.26.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.9)
thread_safe (~> 0.1)
tzinfo-data (1.2020.6)
tzinfo (>= 1.0.0)
unicode-display_width (1.7.0)
wdm (0.1.1)
yell (2.2.2)
PLATFORMS
ruby
DEPENDENCIES
html-proofer (~> 3.18)
jekyll (~> 4.1)
jekyll-archives (~> 2.2)
jekyll-paginate (~> 1.1)
jekyll-redirect-from (~> 0.16)
jekyll-seo-tag (~> 2.7)
jekyll-sitemap (~> 1.4)
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)
BUNDLED WITH
2.2.4

108
README.md
View File

@@ -2,6 +2,7 @@
Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md)
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy)
[![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
@@ -11,17 +12,6 @@ A minimal, sidebar, responsive web design Jekyll theme that focuses on text pres
[![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info)
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [Usage](#usage)
- [Contributing](#contributing)
- [Credits](#credits)
- [Supporting](#supporting)
- [License](#license)
## Features
- Pinned Posts
@@ -48,10 +38,10 @@ Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete th
There are two ways to get the theme:
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy)
- Fork from GitHub
- **Install from RubyGems** - Easy to update, isolate irrelevant project files so you can focus on writing.
- **Fork on GitHub** - Convenient for custom development, but difficult to update, only suitable for web developers.
### Install From Rubygems
### Installing the Theme Gem
Add this line to your Jekyll site's `Gemfile`:
@@ -71,22 +61,19 @@ And then execute:
$ bundle
```
Finally, copy the extra files (refer to the [starter project][starter] for the detailed file directory structure) from the theme's gem to your Jekyll site, and append all the variables of the theme's `_config.yml` to your Jekyll site.
Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
> **Hint**: To locate the themes gem, execute:
> **Hint**: To locate the installed themes gem, execute:
>
```console
$ bundle info --path jekyll-theme-chirpy
```
> ```console
> $ bundle info --path jekyll-theme-chirpy
> ```
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem.
Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from the theme's gem. We have prepared everything for you there!
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
### Fork on GitHub
### Fork From GitHub
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local.
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub and then clone your fork to local. (Please note that the default branch code is in development. If you want the blog to be stable, please switch to the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags) and start writing.)
Install gem dependencies by:
@@ -104,16 +91,14 @@ $ bash tools/init.sh
What it does is:
1. Remove some files or directories from your repository:
1. Remove some files or directories from your repository:
- `.travis.yml`
- files under `_posts`
- folder `docs`
- `.travis.yml`
- files under `_posts`
- folder `docs`
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in folder `.github`.
3. Automatically create a commit to save the changes.
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`.
3. Automatically create a commit to save the changes.
## Usage
@@ -121,10 +106,10 @@ What it does is:
Update the variables of `_config.yml` as needed. Some of them are typical options:
- `url`
- `avatar`
- `timezone`
- `theme_mode`
- `url`
- `avatar`
- `timezone`
- `lang`
### Running Local Server
@@ -147,7 +132,7 @@ Open a browser and visit to _<http://localhost:4000>_.
### Deployment
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
Now you can choose ONE of the following methods to deploy your Jekyll site.
@@ -157,23 +142,20 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
Quickly check the files needed for GitHub Actions build:
1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
- Ensure your Jekyll site has file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
And then rename your repository to `<GH-USERNAME>.github.io` on GitHub.
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
Now publish your Jekyll site by:
Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
And then publish your Jekyll site by:
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) through _Settings__Options__GitHub Pages_:
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png)
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings__Options__GitHub Pages_:
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png)
3. Visit your website at the address indicated by GitHub.
3. Visit your website at the address indicated by GitHub.
#### Deploy on Other Platforms
@@ -197,10 +179,9 @@ $ docker run -it --rm \
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
## Documentation
For more details and the better reading experience, please check out the [tutorials on demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki).
For more details and a better reading experience, please check out the [tutorials on the demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki).
## Contributing
@@ -208,20 +189,29 @@ The old saying, "Two heads are better than one." Consequently, welcome to report
## Credits
This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Bootstrap](https://getbootstrap.com/), [Font Awesome](https://fontawesome.com/) and some other wonderful tools (their copyright information can be found in the relevant files).
This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Bootstrap](https://getbootstrap.com/), [Font Awesome](https://fontawesome.com/) and some other wonderful tools (their copyright information can be found in the relevant files). The avatar and favicon design comes from [Clipart Max](https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/).
:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas or inspired me to write more readable documentation.
:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas, or inspired me to write more readable documentation.
Also, thank [JetBrains][JB] for providing the open source license.
Last but not least, thank [JetBrains][jb] for providing the open source license.
[![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][JB]
## Sponsoring
[JB]:https://www.jetbrains.com/?from=jekyll-theme-chirpy
If you like this theme or find it helpful, please consider sponsoring me, because it will encourage and help me better maintain the project, I will be very grateful!
## Supporting
If you enjoy this theme or find it helpful, please consider becoming my sponsor, I'd really appreciate it! Click the button <kbd>:heart: Sponsor</kbd> at the top of the [Home Page](https://github.com/cotes2020/jekyll-theme-chirpy) and choose a link that suits you to donate; this will encourage and help me better maintain the project.
[![Buy Me a Coffee](https://img.shields.io/badge/-Buy%20Me%20a%20Coffee-ff813f?logo=buy-me-a-coffee&logoColor=white)](https://www.buymeacoffee.com/coteschung)
[![Wechat Pay](https://img.shields.io/badge/-Tip%20Me%20on%20WeChat-brightgreen?logo=wechat&logoColor=white)][cn-donation]
[![Alipay](https://img.shields.io/badge/-Tip%20Me%20on%20Alipay-blue?logo=alipay&logoColor=white)][cn-donation]
## License
This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
<!-- ReadMe links -->
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy
[cn-donation]: https://cotes.gitee.io/alipay-wechat-donation/

View File

@@ -1,5 +1,18 @@
# The Site Configuration
# Import the theme
theme: jekyll-theme-chirpy
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
# change below value to '/projectname'.
baseurl: ''
# the HTML language tag https://www.w3.org/International/questions/qa-choosing-language-tags
lang: en-US
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai
# jekyll-seo-tag settings https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# --------------------------
title: Chirpy # the main title
@@ -14,8 +27,6 @@ description: >- # used by seo meta and the atom feed
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
url: ''
author: your_full_name # change to your full name
github:
username: github_username # change to your github username
@@ -23,7 +34,9 @@ twitter:
username: twitter_username # change to your twitter username
social:
name: your_full_name # it will shows as the copyright owner in Footer
# Change to your full name.
# It will be displayed as the default author of the posts and the copyright owner in the Footer
name: your_full_name
email: example@doamin.com # change to your email address
links:
# The first element serves as the copyright owner's link
@@ -36,29 +49,12 @@ social:
google_site_verification: google_meta_tag_verification # change to your verification string
# --------------------------
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
# change below value to '/projectname'.
baseurl: ''
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai
google_analytics:
id: '' # Fill with your Google Analytics ID
id: '' # fill in your Google Analytics ID
# Google Analytics pageviews report settings
pv:
# The Google Analytics pageviews switch.
# DO NOT enable it unless you know how to deploy the Google Analytics superProxy.
enabled: false
# the next options only valid when `google_analytics.pv` is enabled.
proxy_url: ''
proxy_endpoint: ''
cache: false # pv data local cache, good for the users from GFW area.
disqus:
comments: false # boolean type, the global switch for posts comments.
shortname: '' # Fill with your Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
cache_path: # the local PV cache data, friendly to visitors from GFW region
# Prefer color scheme setting.
#
@@ -69,7 +65,6 @@ disqus:
# Available options:
#
# light - Use the light color scheme
#
# dark - Use the dark color scheme
#
theme_mode: # [light|dark]
@@ -87,8 +82,14 @@ avatar: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/avatar.jpg
# boolean type, the global switch for ToC in posts.
toc: true
disqus:
comments: false # boolean type, the global switch for posts comments.
shortname: '' # Fill with your Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname
paginate: 10
# ------------ The following options are not recommended to be modified ------------------
kramdown:
syntax_highlighter: rouge
syntax_highlighter_opts: # Rouge Options https://github.com/jneen/rouge#full-options
@@ -100,10 +101,6 @@ kramdown:
line_numbers: true
start_line: 1
# DO NOT change this unless you're a Pro user on Jekyll and Web development,
# or you think you're smart enough to change other relevant URLs within this template.
permalink: /posts/:title/
collections:
tabs:
output: true
@@ -119,55 +116,22 @@ defaults:
layout: post
comments: true # Enable comments in posts.
toc: true # Display TOC column in posts.
breadcrumb:
-
label: Posts
url: /
# DO NOT modify the following parameter unless you are confident enough
# to update the code of all other post links in this project.
permalink: /posts/:title/
-
scope:
path: _drafts
values:
comments: false
-
scope:
path: index.html
values:
breadcrumb:
-
label: Posts
-
scope:
path: tags
values:
breadcrumb:
-
label: Home
url: /
-
label: Tags
url: /tabs/tags/
-
scope:
path: categories
values:
breadcrumb:
-
label: Home
url: /
-
label: Categories
url: /tabs/categories/
-
scope:
path: ''
type: tabs # see `site.collections`
values:
layout: page
permalink: /:title/
dynamic_title: true # Hide title in mobile screens.
breadcrumb:
-
label: Home
url: /
sass:
style: compressed
@@ -182,17 +146,15 @@ compress_html:
envs: [development]
exclude:
- vendor
- Gemfile.lock
- Gemfile
- '*.gem'
- '*.gemspec'
- tools
- docs
- README.md
- LICENSE
- gulpfile.js
- node_modules
- package.json
- package-lock.json
- '*.json'
jekyll-archives:
enabled: [categories, tags]

View File

@@ -8,3 +8,8 @@
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css">
{% endif %}
{% if page.layout == 'page' or page.layout == 'post' %}
<!-- Manific Popup -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css">
{% endif %}

View File

@@ -4,8 +4,8 @@
-->
<div id="disqus" class="pt-2 pb-2">
<p class="text-center text-muted pb-5">
Loading comments from <a href="https://disqus.com/">Disqus</a> ...
<p class="text-center text-muted small pb-5">
Comments powered by <a href="https://disqus.com/">Disqus</a>.
</p>
</div>

View File

@@ -1,32 +1,17 @@
<!--
The Favicons for Web, Android, Microsoft, and iOS (iPhone and iPad) Apps
Generated by: https://www.favicon-generator.org/
Generated by: https://realfavicongenerator.net/
-->
{% capture icon_url %}{{ site.baseurl }}/assets/img/favicons{% endcapture %}
{% capture favicon_path %}{{ '/assets/img/favicons' | relative_url }}{% endcapture %}
<link rel="shortcut icon" href="{{ icon_url }}/favicon.ico" type="image/x-icon">
<link rel="icon" href="{{ icon_url }}/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="{{ icon_url }}/apple-icon.png">
<link rel="apple-touch-icon" href="{{ icon_url }}/apple-icon-precomposed.png">
<link rel="apple-touch-icon" sizes="57x57" href="{{ icon_url }}/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="{{ icon_url }}/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="{{ icon_url }}/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="{{ icon_url }}/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="{{ icon_url }}/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="{{ icon_url }}/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="{{ icon_url }}/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="{{ icon_url }}/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="{{ icon_url }}/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="{{ icon_url }}/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{ icon_url }}/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="{{ icon_url }}/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{ icon_url }}/favicon-16x16.png">
<link rel="manifest" href="{{ icon_url }}/manifest.json">
<meta name='msapplication-config' content='{{ icon_url }}/browserconfig.xml'>
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="{{ icon_url }}/ms-icon-144x144.png">
<link rel="apple-touch-icon" sizes="180x180" href="{{ favicon_path }}/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{ favicon_path }}/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{ favicon_path }}/favicon-16x16.png">
<link rel="manifest" href="{{ favicon_path }}/site.webmanifest">
<link rel="shortcut icon" href="{{ favicon_path }}/favicon.ico">
<meta name="apple-mobile-web-app-title" content="{{ site.title }}">
<meta name="application-name" content="{{ site.title }}">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="{{ favicon_path }}/browserconfig.xml">
<meta name="theme-color" content="#ffffff">

View File

@@ -7,19 +7,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% if page.layout == 'home' or page.layout == 'post' %}
<meta name="pv-cache-enabled" content="{{ site.google_analytics.pv.enabled }}">
{% if site.google_analytics.pv.enabled %}
{% if site.google_analytics.pv.proxy_endpoint != ''
and site.google_analytics.pv.proxy_endpoint %}
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
{% endif %}
{% if site.google_analytics.pv.cache %}
<meta name="pv-cache-data" content="{{ '/assets/js/data/pageviews.json' | relative_url }}">
{% endif %}
{% if site.google_analytics.pv.proxy_endpoint %}
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
{% endif %}
{% if site.google_analytics.pv.cache_path %}
<meta name="pv-cache-path" content="{{ site.google_analytics.pv.cache_path | relative_url }}">
{% endif %}
{% endif %}
{% seo title=false %}
@@ -45,26 +41,24 @@
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin="anonymous">
<link rel="dns-prefetch" href="https://www.googletagmanager.com">
{% if site.google_analytics.pv.proxy_url and site.google_analytics.pv.enabled %}
<link rel="preconnect" href="{{ site.google_analytics.pv.proxy_url }}" crossorigin="use-credentials">
<link rel="dns-prefetch" href="{{ site.google_analytics.pv.proxy_url }}">
{% if site.google_analytics.pv.proxy_endpoint %}
{% assign proxy_url = site.google_analytics.pv.proxy_endpoint
| replace: "https://", "" | split: "/" | first | prepend: "https://" %}
<link rel="preconnect" href="{{ proxy_url }}" crossorigin="use-credentials">
<link rel="dns-prefetch" href="{{ proxy_url }}">
{% endif %}
{% endif %}
<!-- jsDelivr CDN -->
<link rel="preconnect" href="cdn.jsdelivr.net">
<link rel="dns-prefetch" href="cdn.jsdelivr.net">
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
<!-- Bootstrap -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css"
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css">
{% include css-selector.html %}

View File

@@ -3,19 +3,26 @@
-->
{% if page.layout == 'home' or page.layout == 'post' %}
{% if site.google_analytics.pv.enabled %}
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<!-- pv-report needs countup.js -->
<script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>
<script async src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
{% endif %}
{% endif %}
{% if page.layout == 'post' or page.layout == 'page' %}
<!-- image lazy-loading & popup -->
<script async
src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js"></script>
{% endif %}
{% if page.layout == 'home'
or page.layout == 'categories'
or page.layout == 'post'
or page.layout == 'categories' %}
or page.layout == 'page' %}
{% assign type = page.layout %}
{% else %}
{% assign type = "page" %}
{% assign type = "commons" %}
{% endif %}
{% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %}
@@ -23,8 +30,25 @@
{% if page.math %}
<!-- MathJax -->
<script defer src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script defer src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>
/* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
MathJax = {
tex: {
inlineMath: [ /* start/end delimiter pairs for in-line math */
['$','$'],
['\\(','\\)']
],
displayMath: [ /* start/end delimiter pairs for display math */
['$$', '$$'],
['\\[', '\\]']
]
}
};
</script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>
{% endif %}
{% if jekyll.environment == 'production' %}

View File

@@ -1,10 +0,0 @@
<!--
image lazy load: https://github.com/ApoorvSaxena/lozad.js
-->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"></script>
<script type="text/javascript">
const imgs = document.querySelectorAll('.post-content img');
const observer = lozad(imgs);
observer.observe();
</script>

View File

@@ -9,7 +9,8 @@
<p>{{ page.previous.title }}</p>
</a>
{% else %}
<span class="btn btn-outline-primary disabled">
<span class="btn btn-outline-primary disabled"
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}">
<p>-</p>
</span>
{% endif %}
@@ -20,7 +21,8 @@
<p>{{ page.next.title }}</p>
</a>
{% else %}
<span class="btn btn-outline-primary disabled">
<span class="btn btn-outline-primary disabled"
prompt="{{ site.data.label.post.button.next | default: 'next' }}">
<p>-</p>
</span>
{% endif %}

View File

@@ -46,7 +46,6 @@
{% assign _content = _content | replace: '<img src="/', img_path_replacement %}
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% assign lozad = true %}
{% assign img_placehodler
= 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' %}
@@ -60,7 +59,3 @@
<!-- return -->
{{ _content }}
{% if lozad %}
{% include lozad.html %}
{% endif %}

View File

@@ -1,13 +1,14 @@
<!--
Jekyll Simple Search loader
See: <https://github.com/christian-fei/Simple-Jekyll-Search>
-->
{% capture result_elem %}
<div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0">
<a href="{{ site.url }}{url}">{title}</a>
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>{categories}</div>
<div><i class="fa fa-tag fa-fw"></i>{tags}</div>
{categories}
{tags}
</div>
<p>{snippet}</p>
</div>
@@ -23,6 +24,23 @@ SimpleJekyllSearch({
resultsContainer: document.getElementById('search-results'),
json: '{{ '/assets/js/data/search.json' | relative_url }}',
searchResultTemplate: '{{ result_elem | strip_newlines }}',
noResultsText: '{{ not_found }}'
noResultsText: '{{ not_found }}',
templateMiddleware: function(prop, value, template) {
if (prop === 'categories') {
if (value === '') {
return `${value}`;
} else {
return `<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
}
}
if (prop === 'tags') {
if (value === '') {
return `${value}`;
} else {
return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
}
}
}
});
</script>

View File

@@ -2,7 +2,7 @@
The Search results
-->
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
<div class="col-12 col-xl-11 post-content">
<div class="col-12 col-sm-11 post-content">
<div id="search-hints">
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags | default: 'Trending Tags' }}</h4>

View File

@@ -1,5 +1,6 @@
<!--
Date format snippet
See: /assets/js/_utils/timeage.js
-->
{% assign tooltip_df = site.data.date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
@@ -11,7 +12,10 @@
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: tooltip_df }}"
{% endif %}>
{% endif %}
{% if include.prefix %}prefix="{{ include.prefix }} "{% endif%}
{% if include.prep %}prep="{{ include.prep }}"{% endif %} >
{% assign this_year = site.time | date: "%Y" %}
{% assign post_year = include.date | date: "%Y" %}

View File

@@ -5,21 +5,42 @@
<div id="topbar-wrapper" class="row justify-content-center topbar-down">
<div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between">
<span id="breadcrumb">
{% for item in page.breadcrumb %}
{% if item.url %}
{% assign paths = page.url | split: '/' %}
{% if paths.size == 0 %}
<!-- index page -->
<span>{{ 'Posts' }}</span>
{% else %}
{% for item in paths %}
{% if forloop.first %}
{% unless page.layout == 'post' %}
<span>
<a href="{{ '/' | relative_url }}">{{ 'Home' }}</a>
</span>
{% endunless %}
{% elsif forloop.last %}
<span>{{ page.title }}</span>
{% else %}
<span>
<a href="{{ site.baseurl }}{{ item.url | remove: '.html'}}">
{{ item.label }}
{% assign url = item %}
{% if item == 'posts' and page.layout == 'post' %}
{% assign url = '/' %}
{% endif %}
<a href="{{ url | relative_url }}">
{{ item | capitalize }}
</a>
</span>
{% else %}
<span>{{ item.label }}</span>
{% endif %}
{% endfor %}
{% unless page.layout == "home" %}
<span>{{ page.title }}</span>
{% endunless %}
{% endif %}
</span><!-- endof #breadcrumb -->
@@ -39,7 +60,7 @@
<span id="search-wrapper" class="align-items-center">
<i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search"
aria-label="search" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
aria-label="search" autocomplete="off" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span>
<span id="search-cancel" >Cancel</span>

View File

@@ -17,14 +17,12 @@ $(function() {
const input = $("#search-input");
const hints = $("#search-hints");
/*--- Actions in small screens (Sidebar unloaded) ---*/
const scrollBlocker = (function () {
let offset = 0;
return {
block() {
offset = $(window).scrollTop();
offset = window.scrollY;
$("html,body").scrollTop(0);
},
release() {
$("html,body").scrollTop(offset);
@@ -35,6 +33,9 @@ $(function() {
};
}());
/*--- Actions in small screens (Sidebar unloaded) ---*/
const mobileSearchBar = (function () {
return {
on() {
@@ -60,11 +61,11 @@ $(function() {
return {
on() {
if (!visible) {
resultWrapper.removeClass("unloaded");
main.addClass("hidden");
visible = true;
// the block method must be called before $(#main) unloaded.
scrollBlocker.block();
resultWrapper.removeClass("unloaded");
main.addClass("unloaded");
visible = true;
}
},
off() {
@@ -75,12 +76,13 @@ $(function() {
}
resultWrapper.addClass("unloaded");
btnClear.removeClass("visible");
main.removeClass("hidden");
main.removeClass("unloaded");
// now the release method must be called after $(#main) display
scrollBlocker.release();
input.val("");
visible = false;
scrollBlocker.release();
}
},
isVisible() {

5
_javascript/copyright Normal file
View File

@@ -0,0 +1,5 @@
/*!
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View File

@@ -0,0 +1,48 @@
/**
Lazy load images (https://github.com/ApoorvSaxena/lozad.js)
and popup when clicked (https://github.com/dimsemenov/Magnific-Popup)
*/
$(function() {
const IMG_SCOPE = '#main > div.row:first-child > div:first-child';
if ($(`${IMG_SCOPE} img`).length <= 0 ) {
return;
}
/* lozy loading */
const imgs = document.querySelectorAll(`${IMG_SCOPE} img[data-src]`);
const observer = lozad(imgs);
observer.observe();
/* popup */
$(`${IMG_SCOPE} p > img[data-src],${IMG_SCOPE} img[data-src].preview-img`).each(
function() {
let nextTag = $(this).next();
const title = nextTag.prop('tagName') === 'EM' ? nextTag.text() : '';
const src = $(this).attr('data-src'); // created by lozad.js
$(this).wrap(`<a href="${src}" title="${title}" class="popup"></a>`);
}
);
$('.popup').magnificPopup({
type: 'image',
closeOnContentClick: true,
showCloseBtn: false,
zoom: {
enabled: true,
duration: 300,
easing: 'ease-in-out'
}
});
/* markup the image links */
$(`${IMG_SCOPE} a`).has("img").addClass('img-link');
});

View File

@@ -0,0 +1,250 @@
/*
* Count page views form GA or local cache file.
*
* Dependencies:
* - jQuery
* - countUp.js <https://github.com/inorganik/countUp.js>
*/
const getInitStatus = (function () {
let hasInit = false;
return () => {
let ret = hasInit;
if (!hasInit) {
hasInit = true;
}
return ret;
};
}());
const PvOpts = (function () {
function getContent(selector) {
return $(selector).attr("content");
}
function hasContent(selector) {
let content = getContent(selector);
return (typeof content !== "undefined" && content !== false);
}
return {
getProxyMeta() {
return getContent("meta[name=pv-proxy-endpoint]");
},
getLocalMeta() {
return getContent("meta[name=pv-cache-path]");
},
hasProxyMeta() {
return hasContent("meta[name=pv-proxy-endpoint]");
},
hasLocalMeta() {
return hasContent("meta[name=pv-cache-path]");
}
};
}());
const PvStorage = (function () {
const Keys = {
KEY_PV: "pv",
KEY_PV_SRC: "pv_src",
KEY_CREATION: "pv_created_date"
};
const Source = {
LOCAL: "same-origin",
PROXY: "cors"
};
function get(key) {
return localStorage.getItem(key);
}
function set(key, val) {
localStorage.setItem(key, val);
}
function saveCache(pv, src) {
set(Keys.KEY_PV, pv);
set(Keys.KEY_PV_SRC, src);
set(Keys.KEY_CREATION, new Date().toJSON());
}
return {
keysCount() {
return Object.keys(Keys).length;
},
hasCache() {
return (localStorage.getItem(Keys.KEY_PV) !== null);
},
getCache() {
return JSON.parse(localStorage.getItem(Keys.KEY_PV));
},
saveLocalCache(pv) {
saveCache(pv, Source.LOCAL);
},
saveProxyCache(pv) {
saveCache(pv, Source.PROXY);
},
isExpired() {
let date = new Date(get(Keys.KEY_CREATION));
date.setHours(date.getHours() + 1); // per hour
return Date.now() >= date.getTime();
},
isFromLocal() {
return get(Keys.KEY_PV_SRC) === Source.LOCAL;
},
isFromProxy() {
return get(Keys.KEY_PV_SRC) === Source.PROXY;
},
newerThan(pv) {
return PvStorage.getCache().totalsForAllResults["ga:pageviews"] > pv.totalsForAllResults["ga:pageviews"];
},
inspectKeys() {
if (localStorage.length !== PvStorage.keysCount()) {
localStorage.clear();
return;
}
for(let i = 0; i < localStorage.length; i++){
const key = localStorage.key(i);
switch (key) {
case Keys.KEY_PV:
case Keys.KEY_PV_SRC:
case Keys.KEY_CREATION:
break;
default:
localStorage.clear();
return;
}
}
}
};
}()); /* PvStorage */
function countUp(min, max, destId) {
if (min < max) {
let numAnim = new CountUp(destId, min, max);
if (!numAnim.error) {
numAnim.start();
} else {
console.error(numAnim.error);
}
}
}
function countPV(path, rows) {
let count = 0;
if (typeof rows !== "undefined" ) {
for (let i = 0; i < rows.length; ++i) {
const gaPath = rows[parseInt(i, 10)][0];
if (gaPath === path) { /* path format see: site.permalink */
count += parseInt(rows[parseInt(i, 10)][1], 10);
break;
}
}
}
return count;
}
function tacklePV(rows, path, elem, hasInit) {
let count = countPV(path, rows);
count = (count === 0 ? 1 : count);
if (!hasInit) {
elem.text(new Intl.NumberFormat().format(count));
} else {
const initCount = parseInt(elem.text().replace(/,/g, ""), 10);
if (count > initCount) {
countUp(initCount, count, elem.attr("id"));
}
}
}
function displayPageviews(data) {
if (typeof data === "undefined") {
return;
}
let hasInit = getInitStatus();
const rows = data.rows; /* could be undefined */
if ($("#post-list").length > 0) { /* the Home page */
$(".post-preview").each(function() {
const path = $(this).find("a").attr("href");
tacklePV(rows, path, $(this).find(".pageviews"), hasInit);
});
} else if ($(".post").length > 0) { /* the post */
const path = window.location.pathname;
tacklePV(rows, path, $("#pv"), hasInit);
}
}
function fetchProxyPageviews() {
if (PvOpts.hasProxyMeta()) {
$.ajax({
type: "GET",
url: PvOpts.getProxyMeta(),
dataType: "jsonp",
jsonpCallback: "displayPageviews",
success: (data) => {
PvStorage.saveProxyCache(JSON.stringify(data));
},
error: (jqXHR, textStatus, errorThrown) => {
console.log("Failed to load pageviews from proxy server: " + errorThrown);
}
});
}
}
function fetchLocalPageviews(hasCache = false) {
return fetch(PvOpts.getLocalMeta())
.then(response => response.json())
.then(data => {
if (hasCache) {
// The cache from the proxy will sometimes be more recent than the local one
if (PvStorage.isFromProxy() && PvStorage.newerThan(data)) {
return;
}
}
displayPageviews(data);
PvStorage.saveLocalCache(JSON.stringify(data));
});
}
$(function() {
if ($(".pageviews").length <= 0) {
return;
}
PvStorage.inspectKeys();
if (PvStorage.hasCache()) {
displayPageviews(PvStorage.getCache());
if (PvStorage.isExpired()) {
if (PvOpts.hasLocalMeta()) {
fetchLocalPageviews(true).then(fetchProxyPageviews);
} else {
fetchProxyPageviews();
}
} else {
if (PvStorage.isFromLocal()) {
fetchProxyPageviews();
}
}
} else { // no cached
if (PvOpts.hasLocalMeta()) {
fetchLocalPageviews().then(fetchProxyPageviews);
} else {
fetchProxyPageviews();
}
}
});

View File

@@ -10,13 +10,14 @@ $(function() {
let intervalId = void 0;
function timeago(iso, isLastmod) {
function timeago(iso, preposition) {
let now = new Date();
let past = new Date(iso);
let prep = (typeof preposition !== "undefined" ? `${preposition} ` : "");
if (past.getFullYear() !== now.getFullYear()) {
toRefresh -= 1;
return past.toLocaleString("en-US", {
return prep + past.toLocaleString("en-US", {
year: "numeric",
month: "short",
day: "numeric"
@@ -25,7 +26,7 @@ $(function() {
if (past.getMonth() !== now.getMonth()) {
toRefresh -= 1;
return past.toLocaleString("en-US", {
return prep + past.toLocaleString("en-US", {
month: "short",
day: "numeric"
});
@@ -49,17 +50,15 @@ $(function() {
return minute + " minute" + (minute > 1 ? "s" : "") + " ago";
}
return (isLastmod ? "just" : "Just") + " now";
return "just now";
}
function updateTimeago() {
$(".timeago").each(function() {
if ($(this).children("i").length > 0) {
$(this).text();
let isLastmod = $(this).hasClass("lastmod");
let node = $(this).children("i");
let date = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */
$(this).text(timeago(date, isLastmod));
$(this).text(timeago(date, $(this).attr("prep")));
$(this).append(node);
}
});

View File

@@ -11,7 +11,7 @@ layout: compress
{% endif %}
{% endcapture %}
<html lang="{{ site.lang | split: "_" | first | default: "en" }}" {{ prefer_mode }}>
<html lang="{{ site.lang | default: "en-US" }}" {{ prefer_mode }}>
{% include head.html %}

View File

@@ -68,7 +68,7 @@ layout: page
{% include read-time.html content=post.content %}
<!-- page views -->
{% if site.google_analytics.pv.enabled %}
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<i class="far fa-eye fa-fw"></i>
<span id="pv_{{-post.title-}}" class="pageviews">
<i class="fas fa-spinner fa-spin fa-fw"></i>

View File

@@ -14,19 +14,18 @@ layout: default
<div class="post-meta text-muted d-flex flex-column">
<!-- Published date and author -->
<div>
{% include timeago.html date=page.date tooltip=true %}
by
<span class="author">
{{ page.author | default: site.author }}
<span class="semi-bold">
{{ page.author | default: site.social.name }}
</span>
{% include timeago.html date=page.date prep="on" tooltip=true %}
</div>
<div>
<!-- lastmod -->
{% if page.last_modified_at %}
<span>
Updated
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
{% include timeago.html date=page.last_modified_at
class="lastmod" prefix="Updated" tooltip=true %}
</span>
{% endif %}
@@ -34,7 +33,7 @@ layout: default
{% include read-time.html content=content %}
<!-- page views -->
{% if site.google_analytics.pv.enabled %}
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<span id="pv" class="pageviews"><i class="fas fa-spinner fa-spin fa-fw"></i></span>
{% endif %}
@@ -44,8 +43,8 @@ layout: default
<div class="post-content">
{% if page.image %}
<img src="{{ page.image }}" class="preview-img" alt="Preview Image">
{% if page.image.src %}
<img src="{{ page.image.src }}" class="preview-img" alt="{{ page.image.alt | default: "Preview Image" }}">
{% endif %}
{{ content }}

View File

@@ -6,7 +6,8 @@ categories: [Blogging, Demo]
tags: [typography]
math: true
mermaid: true
image: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
image:
src: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
---
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
@@ -56,7 +57,6 @@ Fluttering and dancing in the breeze.
- [ ] TODO
- [x] Completed
- Hold on
- [ ] Defeat COVID-19
- [x] Vaccine production
- [ ] Economic recovery
@@ -107,6 +107,11 @@ _Full screen width and center alignment_
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="400"}
_400px image width_
- Shadow
![Shadow Avatar](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/window.png){: .shadow width="90%" }
_shadow effect (visible in light mode)_
<br>
- Left aligned
@@ -146,7 +151,7 @@ The mathematics powered by [**MathJax**](https://www.mathjax.org/):
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
When \\(a \ne 0\\), there are two solutions to \\(ax^2 + bx + c = 0\\) and they are
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$

View File

@@ -84,11 +84,13 @@ Then you can use it like other markdown language: surround the graph code with `
### Preview image
If you want to add an image to the top of the post contents, specify the url for the image by:
If you want to add an image to the top of the post contents, specify the url and alt attribute for the image:
```yaml
---
image: /path/to/image-file
image:
src: /path/to/image/file
alt: image alternative text
---
```
@@ -133,7 +135,16 @@ By default, the image is centered, but you can specify the position by using one
![Desktop View](/assets/img/sample/mockup.png){: .right}
```
**Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
> **Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
### Image shadow
The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .shadow}
```
### CDN URL

View File

@@ -15,10 +15,10 @@ Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete th
There are two ways to get the theme:
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy)
- Fork from GitHub
- **Install from RubyGems** - Easy to update, isolate irrelevant project files so you can focus on writing.
- **Fork on GitHub** - Convenient for custom development, but difficult to update, only suitable for web developers.
### Install From Rubygems
### Installing the Theme Gem
Add this line to your Jekyll site's `Gemfile`:
@@ -38,22 +38,19 @@ And then execute:
$ bundle
```
Finally, copy the extra files (refer to the [starter project][starter] for the detailed file directory structure) from the theme's gem to your Jekyll site, and append all the variables of the theme's `_config.yml` to your Jekyll site.
Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
> **Hint**: To locate the themes gem, execute:
> **Hint**: To locate the installed themes gem, execute:
>
```console
$ bundle info --path jekyll-theme-chirpy
```
> ```console
> $ bundle info --path jekyll-theme-chirpy
> ```
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem.
Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from the theme's gem. We have prepared everything for you there!
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
### Fork on GitHub
### Fork From GitHub
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local.
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub and then clone your fork to local. (Please note that the default branch code is in development. If you want the blog to be stable, please switch to the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags) and start writing.)
Install gem dependencies by:
@@ -71,16 +68,14 @@ $ bash tools/init.sh
What it does is:
1. Remove some files or directories from your repository:
1. Remove some files or directories from your repository:
- `.travis.yml`
- files under `_posts`
- folder `docs`
- `.travis.yml`
- files under `_posts`
- folder `docs`
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in folder `.github`.
3. Automatically create a commit to save the changes.
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`.
3. Automatically create a commit to save the changes.
## Usage
@@ -88,10 +83,10 @@ What it does is:
Update the variables of `_config.yml` as needed. Some of them are typical options:
- `url`
- `avatar`
- `timezone`
- `theme_mode`
- `url`
- `avatar`
- `timezone`
- `lang`
### Running Local Server
@@ -114,7 +109,7 @@ Open a browser and visit to _<http://localhost:4000>_.
### Deployment
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
Now you can choose ONE of the following methods to deploy your Jekyll site.
@@ -124,23 +119,20 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
Quickly check the files needed for GitHub Actions build:
1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
- Ensure your Jekyll site has file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
And then rename your repository to `<GH-USERNAME>.github.io` on GitHub.
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
Now publish your Jekyll site by:
Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
And then publish your Jekyll site by:
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) through _Settings__Options__GitHub Pages_:
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png)
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings__Options__GitHub Pages_:
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png)
3. Visit your website at the address indicated by GitHub.
3. Visit your website at the address indicated by GitHub.
#### Deploy on Other Platforms
@@ -163,3 +155,7 @@ $ docker run -it --rm \
```
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook

View File

@@ -4,36 +4,34 @@ author: Cotes Chung
date: 2019-08-11 00:34:00 +0800
categories: [Blogging, Tutorial]
tags: [favicon]
toc: false
---
In [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/), the image files of [Favicons](https://www.favicon-generator.org/about/) are placed in `assets/img/favicons/`. You may need to replace them with your own. So let's see how to customize these Favicons.
The [favicons](https://www.favicon-generator.org/about/) of [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) are placed in the directory `assets/img/favicons/`. You may need to replace them with your own. The following sections will guide you how to create and replace the default favicons.
With a square image (PNG, JPG or GIF) in hand, open the site [*Favicon & App Icon Generator*](https://www.favicon-generator.org/) and upload your original image.
## Generate the favicon
![upload-image](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190811/upload-image.png)
Prepare a square image (PNG, JPG, or SVG) with a size of 512x512 or more, and then go to the online tool [**Real Favicon Generator**](https://realfavicongenerator.net/) and click button <kbd>Select your Favicon image</kbd> to upload your image file.
Click button <kbd>Create Favicon</kbd> and wait a moment for the website to generate the icons of various sizes automatically.
In the next step, the webpage will show all usage scenarios. You can keep the default options, scroll to the bottom of the page, and click the button <kbd>Generate your Favicons and HTML code</kbd> to generate the favicon.
![download-icons](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190811/download-icons.png){: width="600"}
## Download & Replace
Download the generated package, unzip and delete the following two from the extracted files:
- browserconfig.xml
- manifest.json
- `browserconfig.xml`
- `site.webmanifest`
Now, copy the remaining image files (`.PNG` and `.ICO`) from the extracted `.zip` file to cover the original files in the folder `assets/img/favicons/`.
Now, copy the remaining image files (`PNG` and `ICO`) to cover the original files in the folder `assets/img/favicons/` of your Jekyll site.
The following table helps you understand the changes to the icon file:
The following table will helps you understand the changes to the favicon files:
> ✓ means keep, ✗ means delete.
| File(s) | From Favicon & App Icon Generator | From Chirpy |
| File(s) | From Online Tool | From Chirpy |
|---------------------|:---------------------------------:|:-----------:|
| `*.PNG` | ✓ | ✗ |
| `*.ICO` | ✓ | ✗ |
| `browserconfig.xml` | ✗ | ✓ |
| `manifest.json` | ✗ | ✓ |
| `site.webmanifest` | ✗ | ✓ |
> Note: ✓ means keep, ✗ means delete.
The next time you build the site, the icon will be replaced with a customized edition.
The next time you build the site, the favicon will be replaced with a customized edition.

View File

@@ -7,7 +7,7 @@ tags: [google analytics, pageviews]
---
This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme based blog that you just built. This requires technical knowledge and it's recommended to keep the `google_analytics.pv` disabled unless you have a good reason. If your website has low traffic, the page views count would discourage you to write more blogs. With that said, let's start with the setup.
This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme based blog that you just built. This requires technical knowledge and it's recommended to keep the `google_analytics.pv.*` empty unless you have a good reason. If your website has low traffic, the page views count would discourage you to write more blogs. With that said, let's start with the setup.
## Set up Google Analytics
@@ -16,10 +16,10 @@ This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme bas
First, you need to setup your account on Google analytics. While your create your account, you must create your first **Property** as well.
1. Head to <https://analytics.google.com/> and click on **Start Measuring**
2. Enter your desired *Account Name* and choose the desired checkboxes
3. Enter your desired *Property Name*. This is the name of the tracker project that appears on your Google Analytics dashboard
4. Enter the required information *About your business*
5. Hit *Create* and accept any license popup to setup your Google Analytics account and create your property
2. Enter your desired _Account Name_ and choose the desired checkboxes
3. Enter your desired _Property Name_. This is the name of the tracker project that appears on your Google Analytics dashboard
4. Enter the required information _About your business_
5. Hit _Create_ and accept any license popup to setup your Google Analytics account and create your property
### Create Data Stream
@@ -39,14 +39,11 @@ Now, click on the new data stream and grab the **Measurement ID**. It should loo
```yaml
google_analytics:
id: 'G-V6XXXXXXX' # Fill with your Google Analytics ID
id: 'G-V6XXXXXXX' # fill in your Google Analytics ID
# Google Analytics pageviews report settings
pv:
# The Google Analytics pageviews switch.
enabled: false
# the next options only valid when `google_analytics.pv` is enabled.
proxy_url: ''
proxy_endpoint: ''
cache: false # pv data local cache, good for the users from GFW area.
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
cache_path: # the local PV cache data, friendly to visitors from GFW region
```
When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pickup your changes. You should now be able to monitor your traffic in realtime.
@@ -75,9 +72,9 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
8. Click on **Enable APIs and Services** button on the top
9. Enable the following APIs: *Google Analytics API*
9. Enable the following APIs: _Google Analytics API_
10. On the left, Click on *OAuth Consent Screen* and accept **Configure Consent Screen**. Select **External** since your blog is probably hosted for the public. Click on **Publish** under *Publishing Status*
10. On the left, Click on _OAuth Consent Screen_ and accept **Configure Consent Screen**. Select **External** since your blog is probably hosted for the public. Click on **Publish** under _Publishing Status_
11. Click on **Credentials** on the left and create a new **OAuth Client IDs** credential. Make sure to add a entry under `Authorized redirect URIs` that matches: `https://<project-id>.<region>.r.appspot.com/admin/auth`
@@ -116,10 +113,10 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local.
2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file:
```diff
```diff
- application: your-project-id
- version: 1
```
```
3. In `src/config.py`, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from you App Engine Dashboard.
@@ -143,7 +140,8 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
# XSRF Settings
XSRF_KEY = 'OnceUponATimeThereLivedALegend'
```
**Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL.
**Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL.
5. From inside the src/ directory, deploy the app
@@ -194,20 +192,17 @@ Head to `https://PROJECT_ID.REGION_ID.r.appspot.com/admin` and create a query af
The query parameters are as follows:
- **start-date**: fill in the first day of blog posting
- **end-date**: fill in `today` (this is a parameter supported by GA Report, which means that it will always end according to the current query date)
- **metrics**: select `ga:pageviews`
- **dimensions**: select `ga:pagePath`
In order to reduce the returned results and reduce the network bandwidth, we add custom filtering rules [^ga-filters]:
- **filters**: fill in `ga:pagePath=~^/posts/.*/$;ga:pagePath!@=`
- **filters**: fill in `ga:pagePath=~^/posts/.*/$;ga:pagePath!@=`.
Among them, `;` means using _logical AND_ to concatenate two rules.
Among them, `;` means using _logical AND_ to concatenate two rules.
If the `site.baseurl` is specified, change the first filtering rule to `ga:pagePath=~^/BASE_URL/posts/.*/$`, where `BASE_URL` is the value of `site.baseurl`.
If the `site.baseurl` is specified, change the first filtering rule to `ga:pagePath=~^/BASE_URL/posts/.*/$`, where `BASE_URL` is the value of `site.baseurl`.
After <kbd>Run Query</kbd>, copy the generated contents of **API Query URI** at the bottom of the page, and fill in the **Encoded URI for the query** of SuperProxy on GAE.
@@ -226,14 +221,10 @@ Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the
```yaml
google_analytics:
id: 'G-XXXXXXXXXX' # Fill with your Google Analytics ID
id: 'G-V6XXXXXXX' # fill in your Google Analytics ID
pv:
# The Google Analytics pageviews switch.
enabled: true
# the next options only valid when `google_analytics.pv` is enabled.
proxy_url: 'https://PROJECT_ID.REGION_ID.r.appspot.com'
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
cache: false # pv data local cache, good for the users from GFW area.
cache_path: # the local PV cache data, friendly to visitors from GFW region
```
Now, you should see the Page View enabled on your blog.

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,15 @@
/*
* Mainly scss modules, only imported to `assets/css/main.scss`
*
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
/* ---------- scss placeholder --------- */
%heading {
color: var(--heading-color);
font-weight: 400;
font-family: 'Lato', 'Microsoft Yahei', sans-serif;
}
%tag-hover {
background: var(--tag-hover);
transition: background 0.35s ease-in-out;
@@ -38,11 +39,6 @@
border-bottom: none;
}
%heading {
font-weight: 400;
font-family: 'Lato', 'Microsoft Yahei', sans-serif;
}
%section {
#post-wrapper & {
line-height: 1.2;
@@ -100,6 +96,7 @@
@mixin panel-label {
@include label(inherit);
display: block;
line-height: 1.2;
padding-top: 0.5rem;

View File

@@ -1,9 +1,5 @@
/*
* The syntax highlight.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT Licensed
*/
@import "colors/light-syntax";
@@ -161,7 +157,7 @@ div {
div[class^='language-']::before {
content: attr(lang);
position: absolute;
right: 1.8rem;
right: 2rem;
margin-top: 3px;
font-size: 0.7rem;
font-weight: 600;
@@ -174,3 +170,9 @@ div[class^='language-']::before {
right: 3.1rem;
}
}
@media (min-width: 1650px) {
div[class^='language-']::before {
right: 3.5rem;
}
}

View File

@@ -1,10 +1,5 @@
/*
* Mainly scss variables
*
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
/* --- ↓ width and height ---- */

View File

@@ -15,6 +15,7 @@
/* common color */
--text-color: rgb(175, 176, 177);
--heading-color: #cccccc;
--text-muted-color: rgb(107, 116, 124);
--link-color: rgb(138, 180, 248);
--link-underline-color: rgb(82, 108, 150);

View File

@@ -68,7 +68,7 @@
/* --- custom light colors --- */
--highlight-bg-color: #f7f7f7;
--highlighter-rouge-color: #353a3d;
--highlighter-rouge-color: #2f2f2f;
--highlight-lineno-color: #c2c6cc;
--highlight-lineno-border-color: #e9ecef;
--inline-code-bg: #f3f3f3;

View File

@@ -9,7 +9,8 @@
--main-wrapper-bg: white;
--main-border-color: #f3f3f3;
--btn-border-color: #e9ecef;
--text-color: #333333;
--text-color: #34343c;
--heading-color: black;
--blockquote-border-color: #eee;
--blockquote-text-color: #9a9a9a;
--link-color: #2a408e;

View File

@@ -1,22 +1,23 @@
/*!
* The styles for Jekyll theme Chirpy
*
* Chirpy v3.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2021 Cotes Chung
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung
* MIT Licensed
*/
@import "colors/light-typography";
@import "colors/dark-typography";
@import
"colors/light-typography",
"colors/dark-typography",
@import "addon/module";
@import "addon/variables";
@import 'addon/syntax';
@import "addon/commons";
"addon/module",
"addon/variables",
"addon/syntax",
"addon/commons",
@import "layout/home";
@import "layout/post";
@import "layout/tags";
@import "layout/archives";
@import "layout/categories";
@import "layout/category-tag";
"layout/home",
"layout/post",
"layout/tags",
"layout/archives",
"layout/categories",
"layout/category-tag";

View File

@@ -14,34 +14,12 @@
#archives {
letter-spacing: 0.03rem;
li {
font-size: 1.1rem;
line-height: 3rem;
&:nth-child(odd) {
background-color: var(--main-wrapper-bg, #fff);
background-image: linear-gradient(
to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
}
> div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
span.lead {
font-size: 1.5rem;
position: relative;
left: 8px;
&:not(:first-child) {
position: relative;
left: 4px;
&::after {
left: 67px;
}
}
&::after { /* Year dot */
content: "";
display: block;
@@ -59,8 +37,64 @@
box-shadow: 0 0 2px 0 #c2c6cc;
z-index: 1;
}
&:not(:first-child) {
position: relative;
left: 4px;
&::after {
left: 67px;
}
}
} // #archives span.lead
ul {
li {
font-size: 1.1rem;
line-height: 3rem;
div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: 0.1rem;
}
}
&:nth-child(odd) {
background-color: var(--main-wrapper-bg, #fff);
background-image: linear-gradient(to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
}
&::after {
@extend %date-timeline;
height: 2.8rem;
top: -1.3rem;
}
&:first-child::before {
@extend %date-timeline;
height: 3.06rem;
top: -1.61rem;
}
}
&:not(:last-child) > li:last-child::after {
height: 3.4rem;
}
&:last-child > li:last-child::after {
display: none;
}
} // #archives ul
.date {
white-space: nowrap;
display: inline-block;
@@ -97,36 +131,8 @@
}
} // #archives .date
ul {
> li {
> div > a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: 0.1rem;
}
&::after {
@extend %date-timeline;
height: 2.8rem;
top: -1.3rem;
}
&:first-child::before {
@extend %date-timeline;
height: 3.06rem;
top: -1.61rem;
}
}
&:not(:last-child) > li:last-child::after {
height: 3.4rem;
}
&:last-child > li:last-child::after {
display: none;
}
} // #archives ul
} // #archives
@media all and (max-width: 576px) {
#archives {
margin-top: -1rem;

View File

@@ -11,6 +11,14 @@
.card-header {
padding-right: 12px;
}
i {
&.far,
&.fas {
font-size: 86%; // fontawesome icons
}
}
.list-group-item {
border-left: none;
border-right: none;
@@ -29,12 +37,6 @@
@extend %category-icon-color;
}
i {
&.far, &.fas {
font-size: 86%; // fontawesome icons
}
}
} // .categories
.category-trigger {
@@ -42,7 +44,7 @@
height: 1.7rem;
border-radius: 50%;
text-align: center;
color: #6c757d!important;
color: #6c757d !important;
> i.fas {
position: relative;
height: 0.7rem;

View File

@@ -2,10 +2,17 @@
Style for page Category and Tag
*/
#page-category, #page-tag {
.dash {
margin: 0 .5rem .6rem .5rem;
border-bottom: 2px dotted var(--dash-color);
}
#page-category,
#page-tag {
ul > li {
line-height: 1.5rem;
padding: 0.6rem 0;
&::before { // dot
background: #999;
width: 5px;
@@ -17,14 +24,16 @@
top: 0.6rem;
margin-right: 0.5rem;
}
> a { /* post's title */
font-size: 1.1rem;
@extend %no-bottom-border;
font-size: 1.1rem;
}
> span:last-child {
white-space: nowrap;
}
/* post's date */
} /* post's date */
}
}
@@ -36,22 +45,19 @@
font-size: 1.25rem;
}
a:hover {
#page-category &,
#page-tag &,
#access-lastmod & {
#page-category,
#page-tag,
#access-lastmod {
a:hover {
@extend %link-hover;
margin-bottom: -1px; // Avoid jumping
}
}
.dash {
margin: 0 .5rem .6rem .5rem;
border-bottom: 2px dotted var(--dash-color);
}
@media all and (max-width: 576px) {
#page-category, #page-tag {
#page-category,
#page-tag {
ul > li {
&::before {
margin: 0 .5rem;

View File

@@ -2,6 +2,60 @@
Style for Homepage
*/
.pagination {
font-size: 1rem;
a:hover {
text-decoration: none;
}
.page-item {
.page-link {
color: var(--btn-patinator-text-color);
width: 2.5rem;
height: 2.5rem;
padding: 0;
text-align: center;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
&:hover {
background-color: var(--btn-paginator-hover-color);
}
}
&.active {
.page-link {
background-color: var(--btn-active-bg);
border-color: var(--btn-active-border-color);
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
color: var(--btn-text-color);
}
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg);
}
}
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item
} // .pagination
#post-list {
margin-top: 1rem;
padding-right: 0.5rem;
@@ -11,6 +65,10 @@
padding-bottom: 1rem;
border-bottom: 1px solid var(--main-border-color);
a:hover {
@extend %link-hover;
}
h1 {
font-size: 1.4rem;
margin: 0;
@@ -55,60 +113,6 @@
} // #post-list
.pagination {
font-size: 1rem;
a:hover {
text-decoration: none;
}
.page-item {
.page-link {
color: var(--btn-patinator-text-color);
width: 2.5rem;
height: 2.5rem;
padding: 0;
text-align: center;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
&:hover {
background-color: var(--btn-paginator-hover-color)
}
}
&.active {
.page-link {
background-color: var(--btn-active-bg);
border-color: var(--btn-active-border-color);
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
color: var(--btn-text-color);
}
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg);
}
}
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item
} // .pagination
/* Hide SideBar and TOC */
@media all and (max-width: 830px) {
.pagination {

View File

@@ -4,7 +4,7 @@
@mixin btn-sharing-color($light-color, $important: false) {
@if $important {
color: var(--btn-share-color, $light-color)!important;
color: var(--btn-share-color, $light-color) !important;
} @else {
color: var(--btn-share-color, $light-color);
}
@@ -23,6 +23,10 @@
padding-right: $pr;
}
.timeago::before {
content: attr(prefix);
}
#post-wrapper .post-meta {
> div:nth-child(2) {
> span:not(:first-child)::before {
@@ -41,9 +45,10 @@
.post-content {
.preview-img {
margin-top: 0;
margin-bottom: 2.5rem;
@include align-center;
margin-top: 0;
margin-bottom: 2.5rem !important;
}
}
@@ -63,25 +68,50 @@
.btn {
@include btn-post-nav;
color: var(--link-color);
&:hover {
background: #2a408e;
color: #fff;
border-color: #2a408e;
}
&.disabled {
@include btn-post-nav;
pointer-events: auto;
cursor: not-allowed;
background: none;
color: gray;
&:hover {
border-color: none;
}
}
&.btn-outline-primary.disabled:focus {
box-shadow: none;
}
&::before {
color: var(--text-muted-color);
font-size: 0.65rem;
text-transform: uppercase;
content: attr(prompt);
}
&:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
left: 0.5px;
}
&:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
right: 0.5px;
}
}
p {
@@ -91,24 +121,6 @@
white-space: normal;
}
a {
&::before {
color: var(--text-muted-color);
font-size: 0.65rem;
text-transform: uppercase;
content: attr(prompt);
}
&:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
left: 0.5px;
}
&:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
right: 0.5px;
}
}
} // .post-navigation
@keyframes fade-up {
@@ -139,17 +151,20 @@
}
}
#toc li>a {
#toc li > a {
line-height: 1rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
&.nav-link:not(.active) {
color: inherit;
}
}
/*--- Related Posts ---*/
/* --- Related Posts --- */
#related-posts {
>h3 {
> h3 {
@include label(1.1rem, 600);
}
.card {
@@ -165,7 +180,7 @@
&:hover {
-webkit-transform: translate3d(0, -3px, 0);
transform: translate3d(0, -3px, 0);
box-shadow: 0 10px 15px -4px rgba(0,0,0,0.15);
box-shadow: 0 10px 15px -4px rgba(0, 0, 0, 0.15);
}
}
@@ -190,7 +205,7 @@
ul {
list-style-type: none;
padding-inline-start: 1.5rem;
>li::before {
> li::before {
background: #c2c9d4;
width: 5px;
height: 5px;
@@ -216,12 +231,13 @@
}
%btn-share-hovor {
color: var(--btn-share-hover-color)!important;
color: var(--btn-share-hover-color) !important;
}
.share-wrapper {
vertical-align: middle;
user-select: none;
.share-icons {
font-size: 1.2rem;
a {
@@ -230,12 +246,12 @@
}
&:hover {
text-decoration: none;
>i {
> i {
@extend %btn-share-hovor;
}
}
}
>i {
> i {
padding-top: 0.35rem;
&:hover {
@extend %btn-share-hovor;
@@ -243,7 +259,7 @@
}
.fab {
&.fa-twitter {
@include btn-sharing-color(rgba(29, 161, 242, 1.00));
@include btn-sharing-color(rgba(29, 161, 242, 1));
}
&.fa-facebook-square {
@include btn-sharing-color(rgb(66, 95, 156));
@@ -264,9 +280,9 @@
} // .share-wrapper
.share-label {
@include label(inherit, 400, inherit);
&::after {
content: ":";
}
@@ -274,25 +290,22 @@
.license-wrapper {
line-height: 1.2rem;
>a {
> a {
font-weight: 600;
&:hover {
@extend %link-hover;
}
}
i {
font-weight: 400;
}
span:last-child {
font-size: 0.85rem;
}
} // .license-wrapper
@media all and (max-width: 576px) {
.post-tail-bottom {
-ms-flex-wrap: wrap-reverse!important;
flex-wrap: wrap-reverse!important;
-ms-flex-wrap: wrap-reverse !important;
flex-wrap: wrap-reverse !important;
>div:first-child {
width: 100%;
margin-top: 1rem;
@@ -301,8 +314,8 @@
.post-content > div[class^='language-'] {
@include ml-mr(-1.25rem);
border-radius: 0;
border-radius: 0;
&::before { // the lang badge
right: 1rem;
}
@@ -323,21 +336,15 @@
@include dot(0.5rem, 0.2rem);
}
&.flex-column {
-webkit-box-orient: horizontal!important;
-webkit-box-direction: normal!important;
-ms-flex-direction: row!important;
flex-direction: row!important;
-webkit-box-orient: horizontal !important;
-webkit-box-direction: normal !important;
-ms-flex-direction: row !important;
flex-direction: row !important;
}
}
} // .post
}
@media all and (min-width: 768px) and (max-width: 830px) {
.post img {
max-width: calc(100% + 2rem);
}
}
/* Hide SideBar and TOC */
@media all and (max-width: 830px) {
.post-navigation {

View File

@@ -6,9 +6,6 @@ permalink: /404.html
redirect_from:
- /norobots/
- /assets/
- /tabs/
- /categories/
- /tags/
- /posts/
dynamic_title: true
@@ -16,5 +13,9 @@ 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="{{ site.baseurl }}/">Head back Home</a> to try finding it again, or search for it on the <a href="{{ site.baseurl }}/tabs/archives">Archives page</a>.</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>

View File

@@ -1,5 +1,6 @@
---
layout: compress
permalink: /feed.xml
# Atom Feed, reference: https://validator.w3.org/feed/docs/atom.html
---
@@ -10,14 +11,14 @@ layout: compress
<subtitle>{{ site.description }}</subtitle>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<author>
<name>{{ site.author }}</name>
<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.author }} </rights>
<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>
@@ -35,7 +36,7 @@ layout: compress
<id>{{ post_absolute_url }}</id>
<content src="{{ post_absolute_url }}" />
<author>
<name>{{ site.author }}</name>
<name>{{ post.author | default: site.social.name }}</name>
</author>
{% if post.categories %}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,20 +1,13 @@
---
layout: compress
# A part of the Favicons
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="{{ site.baseurl }}/assets/img/favicons/ms-icon-70x70.png" />
<square150x150logo src="{{ site.baseurl }}/assets/img/favicons/ms-icon-150x150.png" />
<square310x310logo src="{{ site.baseurl }}/assets/img/favicons/ms-icon-310x310.png" />
<TileColor>#ffffff</TileColor>
<square150x150logo src="{{ '/assets/img/favicons/mstile-150x150.png' | relative_url }}" />
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>
</browserconfig>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,58 +0,0 @@
---
layout: compress
#
# A part of the Favicons
# Chirpy v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
{% assign icon_url = "/assets/img/favicons" | relative_url %}
{
"name": "{{ site.title }}",
"short_name": "{{ site.title }}",
"description": "{{ site.description }}",
"icons": [
{
"src": "{{ icon_url }}/android-icon-36x36.png",
"sizes": "36x36",
"type": "image/png",
"density": "0.75"
},
{
"src": "{{ icon_url }}/android-icon-48x48.png",
"sizes": "48x48",
"type": "image/png",
"density": "1.0"
},
{
"src": "{{ icon_url }}/android-icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"density": "1.5"
},
{
"src": "{{ icon_url }}/android-icon-96x96.png",
"sizes": "96x96",
"type": "image/png",
"density": "2.0"
},
{
"src": "{{ icon_url }}/android-icon-144x144.png",
"sizes": "144x144",
"type": "image/png",
"density": "3.0"
},
{
"src": "{{ icon_url }}/android-icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"density": "4.0"
}],
"start_url": "{{ '/index.html' | relative_url }}",
"display": "fullscreen",
"theme_color": "#2a1e6b",
"background_color": "white"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,26 @@
---
layout: compress
---
{% assign favicon_path = "/assets/img/favicons" | relative_url %}
{
"name": "{{ site.title }}",
"short_name": "{{ site.title }}",
"description": "{{ site.description }}",
"icons": [
{
"src": "{{ favicon_path }}/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "{{ favicon_path }}/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}],
"start_url": "{{ '/index.html' | relative_url }}",
"theme_color": "#2a1e6b",
"background_color": "#ffffff",
"display": "fullscreen"
}

View File

@@ -1,5 +0,0 @@
/*!
* Chirpy v3.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2021 Cotes Chung
* MIT Licensed
*/

View File

@@ -1,8 +0,0 @@
/*
* Find out the <a> tag contains an image and mark it.
*/
$(function() {
const MARK = "img-hyperlink";
$("a:has(img)").addClass(MARK);
});

View File

@@ -1,232 +0,0 @@
/*
* Count page views form GA or local cache file.
*
* Dependencies:
* - jQuery
* - countUp.js <https://github.com/inorganik/countUp.js>
*/
const getInitStatus = (function () {
let hasInit = false;
return () => {
let ret = hasInit;
if (!hasInit) {
hasInit = true;
}
return ret;
};
}());
const PvOpts = (function () {
return {
isEnabled() {
return "true" === $("meta[name=pv-cache-enabled]").attr("content");
},
getProxyEndpoint() {
return $("meta[name=pv-proxy-endpoint]").attr("content");
},
getLocalData() {
return $("meta[name=pv-cache-data]").attr("content");
}
}
}());
const PvCache = (function () {
const KEY_PV = "pv";
const KEY_CREATION = "pv_created_date";
const KEY_PV_SRC = "pv_source";
const Source = {
ORIGIN: "origin",
PROXY: "proxy"
};
function get(key) {
return localStorage.getItem(key);
}
function set(key, val) {
localStorage.setItem(key, val);
}
return {
getData() {
// get data from browser cache
return JSON.parse(localStorage.getItem(KEY_PV));
},
saveOriginCache(pv) {
set(KEY_PV, pv);
set(KEY_PV_SRC, Source.ORIGIN);
set(KEY_CREATION, new Date().toJSON());
},
saveProxyCache(pv) {
set(KEY_PV, pv);
set(KEY_PV_SRC, Source.PROXY);
set(KEY_CREATION, new Date().toJSON());
},
isFromOrigin() {
return get(KEY_PV_SRC) === Source.ORIGIN;
},
isFromProxy() {
return get(KEY_PV_SRC) === Source.PROXY;
},
isExpired() {
if (PvCache.isFromOrigin()) {
let date = new Date(get(KEY_CREATION));
date.setDate(date.getDate() + 1); /* update origin records every day */
return Date.now() >= date.getTime();
} else if (PvCache.isFromProxy()) {
let date = new Date(get(KEY_CREATION));
date.setHours(date.getHours() + 1); /* update proxy records per hour */
return Date.now() >= date.getTime();
}
return false;
},
getAllPageviews() {
return PvCache.getData().totalsForAllResults["ga:pageviews"];
},
newerThan(pv) {
return PvCache.getAllPageviews() > pv.totalsForAllResults["ga:pageviews"];
},
inspectKeys() {
if (localStorage.getItem(KEY_PV) === null
|| localStorage.getItem(KEY_PV_SRC) === null
|| localStorage.getItem(KEY_CREATION) === null) {
localStorage.clear();
}
}
};
}()); /* PvCache */
function countUp(min, max, destId) {
if (min < max) {
let numAnim = new CountUp(destId, min, max);
if (!numAnim.error) {
numAnim.start();
} else {
console.error(numAnim.error);
}
}
}
function countPV(path, rows) {
let count = 0;
if (typeof rows !== "undefined" ) {
for (let i = 0; i < rows.length; ++i) {
const gaPath = rows[parseInt(i, 10)][0];
if (gaPath === path) { /* path format see: site.permalink */
count += parseInt(rows[parseInt(i, 10)][1], 10);
break;
}
}
}
return count;
}
function tacklePV(rows, path, elem, hasInit) {
let count = countPV(path, rows);
count = (count === 0 ? 1 : count);
if (!hasInit) {
elem.text(new Intl.NumberFormat().format(count));
} else {
const initCount = parseInt(elem.text().replace(/,/g, ""), 10);
if (count > initCount) {
countUp(initCount, count, elem.attr("id"));
}
}
}
function displayPageviews(data) {
if (typeof data === "undefined") {
return;
}
let hasInit = getInitStatus();
const rows = data.rows; /* could be undefined */
if ($("#post-list").length > 0) { /* the Home page */
$(".post-preview").each(function() {
const path = $(this).find("a").attr("href");
tacklePV(rows, path, $(this).find(".pageviews"), hasInit);
});
} else if ($(".post").length > 0) { /* the post */
const path = window.location.pathname;
tacklePV(rows, path, $("#pv"), hasInit);
}
}
function fetchProxyPageviews() {
$.ajax({
type: "GET",
url: PvOpts.getProxyEndpoint(),
dataType: "jsonp",
jsonpCallback: "displayPageviews",
success: (data, textStatus, jqXHR) => {
PvCache.saveProxyCache(JSON.stringify(data));
},
error: (jqXHR, textStatus, errorThrown) => {
console.log("Failed to load pageviews from proxy server: " + errorThrown);
}
});
}
function fetchPageviews(fetchOrigin = true, filterOrigin = false) {
if (PvOpts.isEnabled() && fetchOrigin) {
fetch(PvOpts.getLocalData())
.then((response) => response.json())
.then((data) => {
if (filterOrigin) {
if (PvCache.newerThan(data)) {
return;
}
}
displayPageviews(data);
PvCache.saveOriginCache(JSON.stringify(data));
})
.then(() => fetchProxyPageviews());
} else {
fetchProxyPageviews();
}
}
$(function() {
if ($(".pageviews").length > 0) {
PvCache.inspectKeys();
let cache = PvCache.getData();
if (cache) {
displayPageviews(cache);
if (PvCache.isExpired()) {
fetchPageviews(true, PvCache.isFromProxy());
} else {
if (PvCache.isFromOrigin()) {
fetchPageviews(false);
}
}
} else {
fetchPageviews();
}
}
});

View File

@@ -1,69 +0,0 @@
---
layout: compress
# The list to be cached by PWA
# Chirpy v2.2
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
---
const include = [
/*--- CSS ---*/
'{{ "/assets/css/style.css" | relative_url }}',
/*--- Javascripts ---*/
'{{ "/assets/js/dist/home.min.js" | relative_url }}',
'{{ "/assets/js/dist/page.min.js" | relative_url }}',
'{{ "/assets/js/dist/post.min.js" | relative_url }}',
'{{ "/assets/js/dist/categories.min.js" | relative_url }}',
/*--- HTML ---*/
/* Tabs */
{% for tab in site.tabs %}
'{{ tab.url }}',
{% endfor %}
/*--- Icons ---*/
{%- capture icon_url -%}
{{ "/assets/img/favicons" | relative_url }}
{%- endcapture -%}
'{{ icon_url }}/favicon.ico',
'{{ icon_url }}/apple-icon.png',
'{{ icon_url }}/apple-icon-precomposed.png',
'{{ icon_url }}/apple-icon-57x57.png',
'{{ icon_url }}/apple-icon-60x60.png',
'{{ icon_url }}/apple-icon-72x72.png',
'{{ icon_url }}/apple-icon-76x76.png',
'{{ icon_url }}/apple-icon-114x114.png',
'{{ icon_url }}/apple-icon-120x120.png',
'{{ icon_url }}/apple-icon-144x144.png',
'{{ icon_url }}/apple-icon-152x152.png',
'{{ icon_url }}/apple-icon-180x180.png',
'{{ icon_url }}/android-icon-192x192.png',
'{{ icon_url }}/favicon-32x32.png',
'{{ icon_url }}/favicon-96x96.png',
'{{ icon_url }}/favicon-16x16.png',
'{{ icon_url }}/ms-icon-144x144.png',
'{{ icon_url }}/manifest.json',
'{{ icon_url }}/browserconfig.xml',
/*--- Others ---*/
'{{ "/assets/js/data/search.json" | relative_url }}',
'{{ "/404.html" | relative_url }}',
'{{ "/app.js" | relative_url }}',
'{{ "/sw.js" | relative_url }}'
];
const exclude = [
{%- if site.google_analytics.pv.proxy_url and site.google_analytics.pv.enabled -%}
'{{ site.google_analytics.pv.proxy_url }}',
{%- endif -%}
'/assets/js/data/pageviews.json',
'/img.shields.io/'
];

64
assets/js/data/swcache.js Normal file
View File

@@ -0,0 +1,64 @@
---
layout: compress
# The list to be cached by PWA
---
const resource = [
/* --- CSS --- */
'{{ "/assets/css/style.css" | relative_url }}',
/* --- JavaScripts --- */
{% assign js_path = "/assets/js" | relative_url %}
'{{ js_path }}/dist/home.min.js',
'{{ js_path }}/dist/page.min.js',
'{{ js_path }}/dist/post.min.js',
'{{ js_path }}/dist/categories.min.js',
'{{ js_path }}/data/search.json',
'{{ "/app.js" | relative_url }}',
'{{ "/sw.js" | relative_url }}',
/* --- HTML --- */
'{{ "/index.html" | relative_url }}',
'{{ "/404.html" | relative_url }}',
{% for tab in site.tabs %}
'{{ tab.url | relative_url }}',
{% endfor %}
/* --- Favicons --- */
{% assign favicon_path = "/assets/img/favicons" | relative_url %}
'{{ favicon_path }}/android-chrome-192x192.png',
'{{ favicon_path }}/android-chrome-512x512.png',
'{{ favicon_path }}/apple-touch-icon.png',
'{{ favicon_path }}/favicon-16x16.png',
'{{ favicon_path }}/favicon-32x32.png',
'{{ favicon_path }}/favicon.ico',
'{{ favicon_path }}/mstile-150x150.png',
'{{ favicon_path }}/site.webmanifest',
'{{ favicon_path }}/browserconfig.xml'
];
/* The request url with below domain will be cached */
const allowedDomains = [
{% if site.google_analytics.id != '' %}
'www.googletagmanager.com',
'www.google-analytics.com',
{% endif %}
'{{ site.url | split: "//" | last }}',
'fonts.gstatic.com',
'fonts.googleapis.com',
'cdn.jsdelivr.net',
'polyfill.io'
];
/* Requests that include the following path will be banned */
const denyUrls = [
{% if site.google_analytics.pv.cache_path %}
'{{ site.google_analytics.pv.cache_path | absolute_url }}'
{% endif %}
];

View File

@@ -1,6 +1,6 @@
/*!
* Chirpy v3.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2021 Cotes Chung
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/
function copyLink(e){e&&0!==e.length||(e=window.location.href);const o=$("<input>");$("body").append(o),o.val(e).select(),document.execCommand("copy"),o.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),s=$("#search-cancel"),t=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),d=$("#search-result-wrapper"),r=$("#search-results"),c=$("#search-input"),i=$("#search-hints"),f=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),u={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),s.addClass("loaded")},off(){s.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(d.removeClass("unloaded"),a.addClass("hidden"),e=!0,f.block())},off(){e&&(r.empty(),i.hasClass("unloaded")&&i.removeClass("unloaded"),d.addClass("unloaded"),t.removeClass("visible"),a.removeClass("hidden"),c.val(""),e=!1,f.release())},isVisible:()=>e}}();function h(){return s.hasClass("loaded")}o.click(function(){u.on(),p.on(),c.focus()}),s.click(function(){u.off(),p.off()}),c.focus(function(){n.addClass("input-focus")}),c.focusout(function(){n.removeClass("input-focus")}),c.on("keyup",function(e){8===e.keyCode&&""===c.val()?h()?i.removeClass("unloaded"):p.off():""!==c.val()&&(p.on(),t.hasClass("visible")||t.addClass("visible"),h()&&i.addClass("unloaded"))}),t.on("click",function(){c.val(""),h()?(i.removeClass("unloaded"),r.empty()):p.off(),c.focus(),t.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const o=$("body");return{toggle(){!1===e?o.attr("sidebar-display",""):o.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),o=$("#toc-wrapper"),s=$(".access"),t=$("#search-input");let a,l=0;const n=5,d=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>d?(e.removeClass("topbar-down").addClass("topbar-up"),o.length>0&&o.removeClass("topbar-down"),s.length>0&&s.removeClass("topbar-down"),t.is(":focus")&&t.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),o.length>0&&o.addClass("topbar-down"),s.length>0&&s.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),s=e.text().trim();let t=o.length>0?o.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==t&&e.text(t):e.text()!==s&&e.text(s)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){const e=$(".collapse");e.on("hide.bs.collapse",function(){const e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${e} i.fas`).addClass("rotate"),$(`#${e}`).removeClass("hide-border-bottom"))}),e.on("show.bs.collapse",function(){const e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${e} i.fas`).removeClass("rotate"),$(`#${e}`).addClass("hide-border-bottom"))})});
$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const o=$("#sidebar-trigger"),e=$("#search-trigger"),s=$("#search-cancel"),t=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),d=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),f=function(){let o=0;return{block(){o=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(o)},getOffset:()=>o}}(),u={on(){o.addClass("unloaded"),l.addClass("unloaded"),e.addClass("unloaded"),n.addClass("d-flex"),s.addClass("loaded")},off(){s.removeClass("loaded"),n.removeClass("d-flex"),o.removeClass("unloaded"),l.removeClass("unloaded"),e.removeClass("unloaded")}},p=function(){let o=!1;return{on(){o||(f.block(),r.removeClass("unloaded"),a.addClass("unloaded"),o=!0)},off(){o&&(d.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),t.removeClass("visible"),a.removeClass("unloaded"),f.release(),i.val(""),o=!1)},isVisible:()=>o}}();function h(){return s.hasClass("loaded")}e.click(function(){u.on(),p.on(),i.focus()}),s.click(function(){u.off(),p.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(o){8===o.keyCode&&""===i.val()?h()?c.removeClass("unloaded"):p.off():""!==i.val()&&(p.on(),t.hasClass("visible")||t.addClass("visible"),h()&&c.addClass("unloaded"))}),t.on("click",function(){i.val(""),h()?(c.removeClass("unloaded"),d.empty()):p.off(),i.focus(),t.removeClass("visible")})}),$(function(){const o=function(){let o=!1;const e=$("body");return{toggle(){!1===o?e.attr("sidebar-display",""):e.removeAttr("sidebar-display"),o=!o}}}();$("#sidebar-trigger").click(o.toggle),$("#mask").click(o.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const o=$("#topbar-wrapper"),e=$("#toc-wrapper"),s=$(".access"),t=$("#search-input");let a,l=0;const n=5,r=o.outerHeight();$(window).scroll(function(o){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>r?(o.removeClass("topbar-down").addClass("topbar-up"),e.length>0&&e.removeClass("topbar-down"),s.length>0&&s.removeClass("topbar-down"),t.is(":focus")&&t.blur()):a+$(window).height()<$(document).height()&&(o.removeClass("topbar-up").addClass("topbar-down"),e.length>0&&e.addClass("topbar-down"),s.length>0&&s.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const o=$("#topbar-title"),e=$("div.post>h1"),s=o.text().trim();let t=e.length>0?e.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||e.is(":hidden")||o.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?o.text()!==t&&o.text(t):o.text()!==s&&o.text(s)}),o.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){const o=$(".collapse");o.on("hide.bs.collapse",function(){const o="h_"+$(this).attr("id").substring("l_".length);o&&($(`#${o} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${o} i.fas`).addClass("rotate"),$(`#${o}`).removeClass("hide-border-bottom"))}),o.on("show.bs.collapse",function(){const o="h_"+$(this).attr("id").substring("l_".length);o&&($(`#${o} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${o} i.fas`).removeClass("rotate"),$(`#${o}`).addClass("hide-border-bottom"))})});

6
assets/js/dist/commons.min.js vendored Normal file
View File

@@ -0,0 +1,6 @@
/*!
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/
$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),s=$("#search-cancel"),t=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),d=$("#search-result-wrapper"),r=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),s.addClass("loaded")},off(){s.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),d.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(r.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),d.addClass("unloaded"),t.removeClass("visible"),a.removeClass("unloaded"),u.release(),i.val(""),e=!1)},isVisible:()=>e}}();function h(){return s.hasClass("loaded")}o.click(function(){p.on(),f.on(),i.focus()}),s.click(function(){p.off(),f.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?c.removeClass("unloaded"):f.off():""!==i.val()&&(f.on(),t.hasClass("visible")||t.addClass("visible"),h()&&c.addClass("unloaded"))}),t.on("click",function(){i.val(""),h()?(c.removeClass("unloaded"),r.empty()):f.off(),i.focus(),t.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const o=$("body");return{toggle(){!1===e?o.attr("sidebar-display",""):o.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),o=$("#toc-wrapper"),s=$(".access"),t=$("#search-input");let a,l=0;const n=5,d=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>d?(e.removeClass("topbar-down").addClass("topbar-up"),o.length>0&&o.removeClass("topbar-down"),s.length>0&&s.removeClass("topbar-down"),t.is(":focus")&&t.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),o.length>0&&o.addClass("topbar-down"),s.length>0&&s.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),s=e.text().trim();let t=o.length>0?o.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==t&&e.text(t):e.text()!==s&&e.text(s)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})});

Some files were not shown because too many files have changed in this diff Show More