1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 13:44:15 +00:00

Compare commits

..

164 Commits

Author SHA1 Message Date
Cotes Chung
b7a483680e Bump version to 4.1.0 2021-07-22 00:51:20 +08:00
Cotes Chung
7ecb377c9b Update docs 2021-07-22 00:14:08 +08:00
Cotes Chung
a83e4c1b30 Optimize JS loading priority 2021-07-21 23:50:16 +08:00
Cotes Chung
0b29c0321f Add layout localization 2021-07-21 23:50:16 +08:00
Cotes Chung
2e76300d04 Revert "Delete useless SCSS snippets"
This reverts commit ab8cef9174.
2021-07-21 01:00:05 +08:00
Cotes Chung
20f2ff4b23 Update bot's reply message 2021-07-20 02:51:46 +08:00
Cotes Chung
899609a291 Switch to another issue bot 2021-07-20 02:26:03 +08:00
Cotes Chung
f56852a700 Fix breadcrumb for pagination 2021-07-20 02:08:28 +08:00
Cotes Chung
c969eaa040 Recover the missing image link identifier class 2021-07-20 02:08:28 +08:00
Cotes Chung
ab8cef9174 Delete useless SCSS snippets 2021-07-19 17:53:44 +08:00
Cotes Chung
b3ff6c79a6 Ignore the variables hook in the site file 2021-07-17 13:26:29 +08:00
Cotes Chung
7f8c19d480 Improve the code style on shell scripts
Double quote to prevent globbing and word splitting.
2021-07-11 17:26:49 +08:00
Cotes Chung
d52fa88337 Prevent the post date from shifting when loading 2021-07-11 17:04:13 +08:00
Cotes Chung
bea170cff0 Add fade in effect for lazy-loaded images 2021-07-11 15:05:18 +08:00
Cotes Chung
961ebb545b Set the dollar sign of code snippets to non-selectable 2021-07-08 21:19:33 +08:00
Cotes Chung
797450174d Dynamically detect the sass variables hook 2021-07-07 03:00:13 +08:00
FieryThunder
f0a2113a9f Fix typo of the issue template (#359) 2021-07-07 01:56:23 +08:00
Cotes Chung
c98a41317f Add a hook for custom variables (fix #355) 2021-07-04 23:24:30 +08:00
Cotes Chung
5f1e6e9350 Create the code language badge by Liquid
It prevents the language badges from flashing
2021-07-04 22:02:52 +08:00
Cotes Chung
65dbea9d3b Prevent image caption shifting
Before the image tag modified by JS, the caption will shift
2021-07-03 05:11:11 +08:00
Cotes Chung
fd97067ec3 Optimize the JS loading priorities 2021-07-03 05:11:11 +08:00
Cotes Chung
d5413a954f Update posts
- Set width and height for images
- Update the related tutorial
2021-07-03 05:11:11 +08:00
Cotes Chung
9359d6ef11 Ignore image links in html-proofer test 2021-07-02 17:14:40 +08:00
Cotes Chung
6d1d440c00 Preventing image reflow (fix #351) 2021-07-02 17:14:40 +08:00
Cotes Chung
08ec6cd3b5 Simplify the gitlab flow history 2021-06-24 21:30:05 +08:00
Cotes Chung
3ecb59deb1 Bump version to 4.0.2
(cherry picked from commit a6d4db251f)
2021-06-23 23:02:55 +08:00
Cotes Chung
885ed44646 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:00:46 +08:00
Cotes Chung
d31e677ca0 Fix git-ignore list (#343) 2021-06-04 19:43:45 +08:00
blacksheep-git
bf3b539d6d Update 2019-08-08-text-and-typography.md
Fixed typo from 'Setction' to 'Section'.
2021-05-28 10:30:25 -06:00
Cotes Chung
ab927e9954 Improve sidebar cursor position calculation (fix #338) 2021-05-27 01:05:01 +08:00
Cotes Chung
d5e08b05ab Remove PR filter from workflow
GitHub does not allow to run workflows on PR from first-time contributors.
see: <https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks>
2021-05-19 13:50:19 +08:00
Cotes Chung
eb247b8886 Improve the paginator design for the mobile screens (#331) 2021-05-19 11:09:52 +08:00
Cotes Chung
4fa7c6af6e Bump version to 4.0.1
(cherry picked from commit b887c439c6)
2021-05-08 03:26:04 +08:00
Cotes Chung
2cce0be8af Add the missing files to the gem 2021-05-08 03:19:13 +08:00
Cotes Chung
cf7d8a45ba Bump version to 4.0.0
(cherry picked from commit db82f71515)
2021-04-30 14:10:24 +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
Cotes Chung
d8a42d9bb4 Bump version to 3.0.2 2021-01-27 03:41:12 +08:00
Cotes Chung
c1b20d8f71 Fix bump tool 2021-01-27 03:40:17 +08:00
Cotes Chung
08ce9f6c7c Fix typo of docs 2021-01-27 03:13:26 +08:00
Cotes Chung
0b4e40bcdf Fix footer links 2021-01-27 02:51:50 +08:00
Cotes Chung
9ae2aee222 Improve the gh-actions CD script 2021-01-26 23:26:03 +08:00
Cotes Chung
ec522e5219 Bump version to 3.0.1 2021-01-26 22:28:35 +08:00
Cotes Chung
4ee8f20df2 Meaningless commit
RubyGems doesn't allow re-pushing the yanked version (3.0.0), so we have to bump a new patch version
2021-01-26 22:26:32 +08:00
Cotes Chung
7d7c0da31b Bump version to 3.0.0 2021-01-26 21:40:46 +08:00
Cotes Chung
4343f1a8f8 Update the usage instructions 2021-01-26 20:31:26 +08:00
Cotes Chung
b85980e1e2 Optimize the embedded list style 2021-01-26 20:24:47 +08:00
Cotes Chung
893db51ff0 Improve the copyrights of the assets 2021-01-26 20:24:47 +08:00
Cotes Chung
cbb3bd4be5 Set default values for site variables
good for gem-based first run
2021-01-26 20:24:47 +08:00
Cotes Chung
7ed3bef1b1 Add gem-based settings 2021-01-26 20:24:47 +08:00
Cotes Chung
da9f7b8218 Process JS files with gulp 2021-01-25 06:43:02 +08:00
Cotes Chung
0e9104a58f Fix a typo on css 2021-01-25 02:44:35 +08:00
Cotes Chung
b7266aceac Contact theme styles 2021-01-25 02:44:35 +08:00
Cotes Chung
28f36bee23 Make code block 100% screen width on mobile 2021-01-23 13:19:51 +08:00
Cotes Chung
994b3e32d3 Optimize image width of list on mobile screens 2021-01-23 13:18:02 +08:00
Cotes Chung
75e9feb687 Optimize url filters 2021-01-19 00:01:01 +08:00
Cotes Chung
ab0e3f6ee4 Fix PV display when baseurl exists 2021-01-19 00:01:01 +08:00
Cotes Chung
0194bbced9 Fix baseUrl on rss-feed (#259) 2021-01-18 22:17:03 +08:00
dependabot-preview[bot]
e92cc239c1 Bump html-proofer from 3.18.3 to 3.18.5 (#257)
Bumps [html-proofer](https://github.com/gjtorikian/html-proofer) from 3.18.3 to 3.18.5.
- [Release notes](https://github.com/gjtorikian/html-proofer/releases)
- [Commits](https://github.com/gjtorikian/html-proofer/compare/v3.18.3...v3.18.5)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-01-17 22:29:34 +08:00
Cotes Chung
da976ce088 Allow the PRs from dependabot 2021-01-17 22:23:34 +08:00
Cotes Chung
6490b0fcbd Fix avatar url when site.baseurl exists (#253) 2021-01-17 21:47:11 +08:00
Ryan TG
ef1d05d342 Fix typo in dark typography SCSS (#249) 2021-01-15 02:29:28 +08:00
Cotes Chung
e8170f8379 Prevent the URLs of code block from being clickable 2021-01-10 18:48:36 +08:00
Cotes Chung
93fcf50131 Add image CDN tutorial 2021-01-09 23:05:55 +08:00
Cotes Chung
66a132c462 Remove the image files 2021-01-09 23:05:55 +08:00
Cotes Chung
6e6633c2fc Add image CDN support & improve image lazy loading 2021-01-09 23:05:55 +08:00
Cotes Chung
594eaf5100 Fix nokogiri vulnerability
Upgrade nokogiri to 1.11.0.rc4  or later
2021-01-06 01:46:45 +08:00
Dinesh Prasanth M K
940db20c5c Add instructions to setup Page Views
This patch adds a new blog post to setup Page Views
using Google analytics superProxy.

Signed-off-by: Dinesh Prasanth M K <mkdineshprasanth@gmail.com>
2021-01-06 00:05:15 +08:00
181 changed files with 3839 additions and 3069 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

@@ -16,4 +16,4 @@ labels: question
- [ ] My question is based on the latest code of `master` branch.
## Description
<!-- Please describe your question in detial. -->
<!-- Please describe your question in detail. -->

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:

18
.github/workflows/issue-interceptor.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Intercept bad issues
on:
issues:
types: [opened, edited]
jobs:
auto_close_issues:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Auto close issues that did not follow template
uses: lucasbento/auto-close-issues@v1.0.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-close-message: ":wave: Hi @${issue.user.login},\n\nThis issue is being automatically closed because it does not follow the issue template. Please DO NOT open another similar issue, try to edit the current issue according to the template, then it will be reopened automatically."
closed-issues-label: "🙁 Not following issue template"

View File

@@ -1,20 +0,0 @@
name: "Intercept bad issue/PRs"
on:
issues:
types: [opened, reopened]
pull_request:
types: [opened, reopened]
jobs:
autoclose:
runs-on: ubuntu-latest
steps:
- name: Auto close issues/pr that did not follow template
uses: roots/issue-closer@v1.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-pattern: "\\[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"
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: |

15
.gitignore vendored
View File

@@ -1,7 +1,18 @@
# hidden files
.*
!.github
!.git*
!.editorconfig
!.nojekyll
!.travis.yml
# jekyll cache
# bundler cache
_site
vendor
Gemfile.lock
# rubygem
*.gem
# npm dependencies
node_modules
package-lock.json

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:

View File

@@ -1,25 +0,0 @@
---
# The 404 page
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT License
layout: page
title: "404: Page not found"
permalink: /404.html
redirect_from: # part of site.sitemap_exclude
- /norobots/
- /assets/
- /tabs/
- /categories/
- /tags/
- /posts/
dynamic_title: true
---
<div class="lead">
<p>Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. </p>
<p><a href="{{ 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>
</div>

15
Gemfile
View File

@@ -1,18 +1,11 @@
# frozen_string_literal: true
source "https://rubygems.org"
gem "jekyll", ">= 4.1.0", "< 5.0"
# plugins
group :jekyll_plugins do
gem "jekyll-paginate"
gem "jekyll-redirect-from"
gem "jekyll-seo-tag"
gem "jekyll-archives"
gem "jekyll-sitemap"
end
gemspec
group :test do
gem "html-proofer"
gem "html-proofer", "~> 3.18"
end
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem

View File

@@ -1,111 +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.3)
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.4.0)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
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)
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
jekyll (>= 4.1.0, < 5.0)
jekyll-archives
jekyll-paginate
jekyll-redirect-from
jekyll-seo-tag
jekyll-sitemap
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)
BUNDLED WITH
2.1.4

209
README.md
View File

@@ -1,118 +1,158 @@
# Chirpy
<div align="right">
<a href="https://github.com/cotes2020/jekyll-theme-chirpy#readme">EN</a> |
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md">中文 (简体)</a>
</div>
Language: English | [简体中文](docs/README.zh-CN.md)
<div align="center">
<h1>Chirpy Jekyll Theme</h1>
<p>
<a href="https://rubygems.org/gems/jekyll-theme-chirpy">
<img alt="Gem Version" src="https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen"></img>
</a>
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush">
<img alt="Build Status" src="https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push"></img>
</a>
<a href="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">
<img alt="Codacy Badge" src="https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b"></img>
</a>
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE">
<img alt="GitHub license" src="https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg"></img>
</a>
<a href="https://996.icu">
<img alt="996.icu" src="https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg"></img>
</a>
</p>
</div>
[![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)
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation. Designed to help you easily record and share your knowledge.
A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation. Designed to help you record and share your knowledge easily. [Live Demo »](https://chirpy.cotes.info)
[Live Demo »](https://chirpy.cotes.info)
[![Devices Mockup](https://raw.githubusercontent.com/cotes2020/jekyll-theme-chirpy/master/assets/img/sample/devices-mockup.png)](https://chirpy.cotes.info)
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [Credits](#credits)
- [Supporting](#supporting)
- [License](#license)
<p align="center">
<a href="https://chirpy.cotes.info">
<img alt="Devices Mockup" src="https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png"></img>
</a>
</p>
## Features
- Localized Layout
- Configurable Theme Mode
- Pinned Posts
- Configurable theme mode
- Double-level Categories
- Last modified date for posts
- Hierarchical Categories
- Last Modified Date for Posts
- Table of Contents
- Automatically recommend related posts
- Syntax highlighting
- Mathematical expressions
- Mermaid diagram & flowchart
- Automatically Recommend Related Posts
- Syntax Highlighting
- Mathematical Expressions
- Mermaid Diagram & Flowchart
- Search
- Atom Feeds
- Disqus Comments
- Google Analytics
- GA Pageviews reporting (Advanced)
- SEO and Performance Optimization
- GA Pageviews Reporting (Advanced)
- SEO & Performance Optimization
## Prerequisites
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`. Please note that the version of `Ruby` must meet the requirements of the theme on [RubyGems.org](https://rubygems.org/gems/jekyll-theme-chirpy).
## Installation
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub, rename the repository to `USERNAME.github.io` (where `USERNAME` is your GitHub username), and then open terminal and clone the fork to local by:
There are two ways to get the theme:
```terminal
$ git clone https://github.com/USERNAME/USERNAME.github.io.git -b master --single-branch
- **[Install from RubyGems](#install-from-rubygems)** - Easy to update, isolate irrelevant project files so you can focus on writing.
- **[Fork on GitHub](#fork-on-github)** - Convenient for custom development, but difficult to update, only suitable for web developers.
### Install from RubyGems
Add this line to your Jekyll site's `Gemfile`:
```ruby
gem "jekyll-theme-chirpy"
```
### Setting up the local envrionment
And add this line to your Jekyll site's `_config.yml`:
If you would like to run or build the project on your local machine, please follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
Before running or building for the first time, please complete the installation of the Jekyll plugins. Go to the root directory of project and run:
```terminal
$ bundle install
```yaml
theme: jekyll-theme-chirpy
```
`bundle` will automatically install all the dependencies specified by `Gemfile`.
### Setting up Docker environment (optional)
If you're a loyal fan of [**Docker**](https://www.docker.com/) or just too lazy to install the packages mentioned in [_Setting up the local envrionment_](#setting-up-the-local-envrionment), please make sure you have **Docker Engine** installed and running, and then get Docker image `jekyll/jekyll` from Docker Hub by the following command:
And then execute:
```console
$ docker pull jekyll/jekyll
$ bundle
```
## Usage
Next, go to the installed local theme path:
### Initialization
```console
$ cd "$(bundle info --path jekyll-theme-chirpy)"
```
Go to the root directory of the project and start initialization:
And then copy the critical files (for details, see [starter project][starter]) from the theme's gem to your Jekyll site.
> ⚠️ **Watch out for duplicate files!**
>
If your Jekyll site is created by the `jekyll new` command, there will be `index.markdown` and `about.markdown` in the root directory of your site. Please be sure to remove them, otherwise they will overwrite the `index.html` and `_tabs/about.html` from this project, resulting in blank or messy pages.
As an alternative, which we recommend, you can create a Jekyll site [**using the starter template**][use-starter] to save time copying files from the theme's gem. We've prepared everything you need there!
### Fork on GitHub
[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:
```console
$ bundle
```
And then execute:
```console
$ bash tools/init.sh
```
> **Note**: If you not intend to deploy it on GitHub Pages, append parameter option `--no-gh` at the end of the above command.
> **Note**: If you don't plan to deploy your site on GitHub Pages, append parameter option `--no-gh` at the end of the above command.
What it does is:
1. Remove some files or directories from your repository:
- `.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`.
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
### Configuration
Generally, go to `_config.yml` and configure the variables as needed. Some of them are typical options:
Update the variables of `_config.yml` as needed. Some of them are typical options:
- `url`
- `avatar`
- `timezone`
- `theme_mode`
- `lang`
### Run Locally
### Customing Stylesheet
If you need to customize stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file.
Starting from `v4.1.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it.
### Running Local Server
You may want to preview the site contents before publishing, so just run it by:
```terminal
```console
$ bundle exec jekyll s
```
Then open a browser and visit to <http://localhost:4000>.
### Run on Docker
Run the site on Docker with the following command:
Or run the site on Docker with the following command:
```terminal
$ docker run -it --rm \
@@ -121,20 +161,32 @@ $ docker run -it --rm \
jekyll serve
```
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. For example, `/project`.
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`.
Assuming you have already gone through the [initialization](#initialization), you can now choose ONE of the following methods to deploy your website.
Now you can choose ONE of the following methods to deploy your Jekyll site.
#### Deploy on GitHub Pages
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the Pages service.
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the GH Pages service.
1. Push any commit to `origin/master` 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.
Quickly check the files needed for GitHub Actions build:
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://raw.githubusercontent.com/cotes2020/jekyll-theme-chirpy/master/assets/img/sample/gh-pages-sources.png)
- 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.
And then rename your repository to `<GH-USERNAME>.github.io` on GitHub.
Now publish your Jekyll site by:
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.
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_:
![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.
@@ -148,7 +200,7 @@ Go to the root of the source project, build your site by:
$ JEKYLL_ENV=production bundle exec jekyll b
```
Or, build the site with Docker by:
Or build the site with Docker by:
```terminal
$ docker run -it --rm \
@@ -160,9 +212,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
## 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). Please note that the tutorials on the demo website or Wiki are based on the latest release, and the features of `master` branch usually ahead of the documentation.
## Contributing
@@ -170,14 +222,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.
## Supporting
Last but not least, thank [JetBrains][jb] for providing the open source license.
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.
## Sponsoring
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!
[![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,28 +1,39 @@
# The Site Settings
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT licensed
# 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 language of the site layout http://www.lingoes.net/en/translator/langcode.htm
# Go to folder '_data/locales' to check the available language options
lang: en
# The lang attribute of HTML http://www.lingoes.net/en/translator/langcode.htm
# We can specify a language different from the layout of the content.
# If it is not assigned, the site will use the value of 'lang' instead.
content_lang: ''
# 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
tagline: A text-focused Jekyll theme. # it will display as the sub-title
tagline: A text-focused Jekyll theme # it will display as the sub-title
description: >- # used by seo meta and the atom feed
A minimal, portfolio, sidebar,
bootstrap Jekyll theme with responsive web design
and focuses on text presentation.
# fill in the base hostname & protocol for your site, e.g., 'https://username.github.io'
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
url: ''
author: your_full_name # change to your full name
avatar: /assets/img/sample/avatar.jpg # support internet resources
github:
username: github_username # change to your github username
@@ -30,7 +41,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
@@ -41,31 +54,16 @@ social:
# - https://www.linkedin.com/in/username
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.
#
@@ -76,16 +74,31 @@ disqus:
# Available options:
#
# light - Use the light color scheme
#
# dark - Use the dark color scheme
#
theme_mode: # <light|dark>
theme_mode: # [light|dark]
# The CDN endpoint for images.
# Notice that once it is assigned, the CDN url
# will be added to all image (site avatar & posts' images) paths starting with '/'
#
# e.g. 'https://cdn.com'
img_cdn: ''
# the avatar on sidebar, support local or CORS resources
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
@@ -97,10 +110,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
@@ -116,58 +125,24 @@ 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:
sass_dir: /assets/css
style: compressed
compress_html:
@@ -180,13 +155,15 @@ compress_html:
envs: [development]
exclude:
- vendor
- Gemfile.lock
- Gemfile
- '*.gem'
- '*.gemspec'
- tools
- docs
- README.md
- LICENSE
- gulpfile.js
- node_modules
- '*.json'
jekyll-archives:
enabled: [categories, tags]
@@ -196,3 +173,6 @@ jekyll-archives:
permalinks:
tag: /tags/:name/
category: /categories/:name/
# Outdated configuration warning
outdated: '-- Missing configuration options! --'

View File

@@ -1,8 +1,4 @@
# The contact options.
# v2.3
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
-
type: github

View File

@@ -1,11 +0,0 @@
# The date format
# v2.1
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
post:
long: "%b %e, %Y"
short: "%b %e"

View File

@@ -1,20 +0,0 @@
# The label text of site.
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT Licensed
panel:
lastmod: Recent Update
trending_tags: Trending Tags
toc: Contents
post:
relate_posts: Further Reading
button:
next: Newer
previous: Older
search_hint: Search # text show on search bar
pin_prompt: Pinned # pinned prompt

87
_data/locales/en.yml Normal file
View File

@@ -0,0 +1,87 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Post
category: Category
tag: Tag
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Home
categories: Categories
tags: Tags
archives: Archives
about: About
# text displayed in the search bar
search:
hint: search
cancel: Cancel
panel:
lastmod: Recent Update
trending_tags: Trending Tags
toc: Contents
# The liquid date format http://strftime.net/
date_format:
tooltip: '%a, %b %e, %Y, %l:%M %p %z'
post:
long: '%b %e, %Y'
short: '%b %e'
archive_month: '%b'
copyright:
# Shown at the bottom of the post
license:
template: This post is licensed under :LICENSE_NAME by the author.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Some rights reserved.
verbose: >-
Except where otherwise noted, the blog posts on this site are licensed
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
hint_template: :HEAD_BAK to try finding it again, or search for it on the :ARCHIVES_PAGE.
head_back: Head back Home
archives_page: Archives page
# ----- Posts related labels -----
post:
published: 'on'
updated: Updated
timeago:
day: d ago
hour: hr ago
minute: min ago
just_now: just now
words: words
pageview_measure: views
read_time:
unit: min
prompt: read
relate_posts: Further Reading
share: Share
button:
next: Newer
previous: Older
copy:
title: Copy link
succeed: Link copied successfully!
# pinned prompt of posts list on homepage
pin_prompt: Pinned
# categories page
categories:
category_measure: categories
post_measure: posts

86
_data/locales/zh-CN.yml Normal file
View File

@@ -0,0 +1,86 @@
# The layout text of site
# ----- Commons label -----
layout:
post: 文章
category: 分类
tag: 标签
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: 首页
categories: 分类
tags: 标签
archives: 归档
about: 关于
# text displayed in the search bar
search:
hint: 搜索
cancel: 取消
panel:
lastmod: 最近更新
trending_tags: 热门标签
toc: 目录
# The liquid date format http://strftime.net/
date_format:
tooltip: '%a, %F, %R %z'
post:
long: '%F'
short: '%m-%d'
archive_month: '%m月'
copyright:
# Shown at the bottom of the post
license:
template: 本文由作者按照 :LICENSE_NAME 进行授权
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: 保留部分权利。
verbose: >-
除非另有说明,本网站上的博客文章均由作者按照知识共享署名 4.0 国际 (CC BY 4.0) 许可协议进行授权。
meta: 本站由 :PLATFORM 生成,采用 :THEME 主题。
not_found:
statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。
hint_template: :HEAD_BAK尝试再次查找它或在:ARCHIVES_PAGE上搜索它。
head_back: 返回主页
archives_page: 归档页面
# ----- Posts related labels -----
post:
published: 发表于
updated: 更新于
timeago:
day: 天前
hour: 小时前
minute: 分钟前
just_now: 刚刚
words:
pageview_measure: 次浏览
read_time:
unit: 分钟
prompt: 阅读
relate_posts: 相关文章
share: 分享
button:
next: 下一篇
previous: 上一篇
copy:
title: 分享链接
succeed: 链接已复制!
# pinned prompt of posts list on homepage
pin_prompt: 顶置
# categories page
categories:
category_measure: 个分类
post_measure: 篇文章

View File

@@ -1,3 +0,0 @@
name: Chirpy
version: 2.7.2
homepage: https://github.com/cotes2020/jekyll-theme-chirpy/

View File

@@ -1,7 +0,0 @@
# words per minute
wpm: 180
# minimum value
min_time: 1
prompt: min

View File

@@ -1,17 +0,0 @@
# License data.
#
# v2.1
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
license:
name: CC BY 4.0
link: "https://creativecommons.org/licenses/by/4.0/"
brief: Some rights reserved.
verbose: >-
Except where otherwise noted, the blog posts on this site are licensed
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.

View File

@@ -1,12 +1,5 @@
# Sharing options at the bottom of the post.
# Icons from <https://fontawesome.com/>
#
# v2.1
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
label: "Share"
platforms:
-

View File

@@ -1,26 +1,15 @@
<!--
CSS selector for site.
Chirpy v2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT Licensed
-->
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
{% if page.layout == 'category' or page.layout == 'tag' %}
{% assign style = 'category-tag' %}
{% else %}
{% assign style = page.layout %}
{% if site.toc and page.toc %}
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css">
{% endif %}
{% assign src = style | prepend: '/assets/css/' | append: '.css' | relative_url %}
<link rel="preload" href="{{ src }}" as="style">
<link rel="stylesheet" href="{{ src }}">
{% if page.layout == 'post' %}
{% if site.toc and page.toc %}
<link rel="preload" as="style" href="{{ '/assets/css/lib/bootstrap-toc.min.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/css/lib/bootstrap-toc.min.css' | relative_url }}" />
{% 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

@@ -1,28 +1,25 @@
<!--
The Disqus lazy loading.
Powered by: https://osvaldas.info/lazy-loading-disqus-comments
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
MIT License
Powered by: <https://github.com/osvaldasvalutis/disqusLoader.js>
-->
<div id="disqus" class="pt-2 pb-2">
<p class="font-italic text-center text-muted small">
<p class="text-center text-muted small pb-5">
Comments powered by <a href="https://disqus.com/">Disqus</a>.
</p>
</div>
<script src="{{ site.baseurl }}/assets/js/lib/jquery.disqusloader.min.js"></script>
<script src="{{ '/assets/js/lib/jquery.disqusloader.min.js' | relative_url }}"></script>
<script>
var options = {
const options = {
scriptUrl: '//{{ site.disqus.shortname }}.disqus.com/embed.js',
disqusConfig: function() {
this.page.url = '{{ site.url | append: site.baseurl | append: page.url }}';
this.page.title = '{{ page.title }}';
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url }}';
}
};
$.disqusLoader('#disqus', options);
</script>
</script>

View File

@@ -1,36 +1,17 @@
<!--
The Favicons for Web, Android, Microsoft, and iOS (iPhone and iPad) Apps
Generated by: https://www.favicon-generator.org/
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
Published under the MIT license
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

@@ -1,9 +1,5 @@
<!--
The Footer
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
-->
<footer class="d-flex w-100 justify-content-center">
@@ -12,20 +8,30 @@
<p class="mb-0">
© {{ 'now' | date: "%Y" }}
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
{% if site.data.rights.brief %}
{% if site.data.locales[site.lang].copyright.brief %}
<span data-toggle="tooltip" data-placement="top"
title="{{ site.data.rights.verbose }}">{{ site.data.rights.brief }}</span>
title="{{ site.data.locales[site.lang].copyright.verbose }}">{{ site.data.locales[site.lang].copyright.brief }}</span>
{% else %}
<span class="text-muted">{{ site.outdated }}</span>
{% endif %}
</p>
</div>
<div class="footer-right">
<p class="mb-0">
Powered by
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
with
<a href="{{ site.data.meta.homepage }}" target="_blank" rel="noopener">{{ site.data.meta.name }}</a>
theme.
{% capture _platform %}
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
{% endcapture %}
{% capture _theme %}
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
{% endcapture %}
{{ site.data.locales[site.lang].meta
| default: 'Powered by :PLATFORM with :THEME theme.'
| replace: ':PLATFORM', _platform | replace: ':THEME', _theme
}}
</p>
</div>

View File

@@ -1,9 +1,5 @@
<!--
The GA snippet
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
-->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>

View File

@@ -1,15 +1,29 @@
<!--
The Head
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme" content="{{ site.data.meta.name }} v{{ site.data.meta.version }}">
{% if page.layout == 'home' or page.layout == 'post' %}
<!-- i18n for timeago.js -->
<meta name="layout-lang" content="{{ site.lang | default: "en" }}">
<meta name="day-prompt" content="{{ site.data.locales[site.lang].post.timeago.day | default: "d ago" }}">
<meta name="hour-prompt" content="{{ site.data.locales[site.lang].post.timeago.hour | default: "hr ago" }}">
<meta name="minute-prompt" content="{{ site.data.locales[site.lang].post.timeago.minute | default: "min ago" }}">
<meta name="justnow-prompt" content="{{ site.data.locales[site.lang].post.timeago.just_now | default: "just now" }}">
{% 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 %}
@@ -34,36 +48,29 @@
<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 %}
<!-- JavaScripts -->
<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
<script defer
src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4/dist/js/bootstrap.min.js"></script>
{% include js-selector.html %}
</head>

View File

@@ -1,27 +1,61 @@
<!--
JS selector for site.
Chirpy v2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT Licensed
-->
{% if page.layout == 'home' or page.layout == 'post' or page.layout == 'categories' %}
{% assign js = page.layout %}
{% else %}
{% assign js = "page" %}
<!-- layout specified -->
{% if page.layout == 'home' or page.layout == 'post' %}
{% 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 defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
{% endif %}
{% endif %}
{% assign js_src = js | prepend: '/assets/js/' | append: '.min.js' | relative_url %}
{% if page.layout == 'post' or page.layout == 'page' %}
<!-- image lazy-loading & popup -->
<script src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js"></script>
{% endif %}
<script async src="{{ js_src }}"></script>
{% if page.layout == 'home'
or page.layout == 'categories'
or page.layout == 'post'
or page.layout == 'page' %}
{% assign type = page.layout %}
{% else %}
{% assign type = "commons" %}
{% endif %}
{% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %}
<script defer src="{{ js | relative_url }}"></script>
{% 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 %}
<!-- commons -->
<script src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.16.1,npm/bootstrap@4/dist/js/bootstrap.min.js"></script>
{% if jekyll.environment == 'production' %}
<!-- PWA -->
<script defer src="{{ '/app.js' | relative_url }}"></script>

View File

@@ -1,8 +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-wrapper img');
const observer = lozad(imgs);
observer.observe();
</script>

View File

@@ -1,7 +1,8 @@
<!--
mermaid-js loader
-->
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js"></script>
<script>
$(function() {
let initTheme = "default";

View File

@@ -1,10 +1,5 @@
<!--
Switch the mode between dark and light.
v2.1
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT License
-->
<i class="mode-toggle fas fa-adjust"></i>

View File

@@ -1,9 +1,5 @@
{% comment %}
Remove the line number of the code snippet.
v2.2
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
Published under the MIT License
{% endcomment %}
{% assign content = include.content %}

View File

@@ -0,0 +1,13 @@
{% comment %}
Remove the zero padding from a month/day string
{% endcomment %}
{% assign ret = include.date_str %}
{% assign _first_chat = ret | slice: 0 %}
{% if _first_chat == '0' %}
{% assign _last_idx = ret.size | minus: 1 %}
{% assign ret = ret | slice: 1, _last_idx %}
{% endif %}
{{ ret | replace: ' 0', ' ' }}

View File

@@ -1,9 +1,5 @@
<!--
The Pannel on right side (Desktop views)
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
-->
<div id="panel-wrapper" class="col-xl-3 pl-2 text-muted topbar-down">
@@ -15,7 +11,7 @@
{% if update_list.size > 0 %}
<div id="access-lastmod" class="post">
<span>{{- site.data.label.panel.lastmod -}}</span>
<span>{{- site.data.locales[site.lang].panel.lastmod | default: 'Recent Update' -}}</span>
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %}
@@ -34,7 +30,7 @@
{% if trending_tags.size > 0 %}
<div id="access-tags">
<span>{{- site.data.label.panel.trending_tags -}}</span>
<span>{{- site.data.locales[site.lang].panel.trending_tags | default: 'Trending Tags' -}}</span>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% for tag_name in trending_tags %}
@@ -48,9 +44,11 @@
</div> <!-- .access -->
{% if include.toc %}
<!-- BS-toc.js will be loaded at medium priority -->
<script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script>
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<span class="pl-3 pt-2 mb-2">
{{- site.data.label.panel.toc -}}
{{- site.data.locales[site.lang].panel.toc | default: 'Contents' -}}
</span>
<nav id="toc" data-toggle="toc"></nav>
</div>

View File

@@ -1,31 +1,30 @@
<!--
Navigation buttons at the bottom of the post.
v2.1
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT License
-->
<div class="post-navigation d-flex justify-content-between">
{% if page.previous.url %}
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary">
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
prompt="{{ site.data.locales[site.lang].post.button.previous | default: 'previous' }}">
<p>{{ page.previous.title }}</p>
</a>
{% else %}
<span class="btn btn-outline-primary disabled">
<span class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[site.lang].post.button.previous | default: 'previous' }}">
<p>-</p>
</span>
{% endif %}
{% if page.next.url %}
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary">
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
prompt="{{ site.data.locales[site.lang].post.button.next | default: 'next' }}">
<p>{{ page.next.title }}</p>
</a>
{% else %}
<span class="btn btn-outline-primary disabled">
<span class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[site.lang].post.button.next | default: 'next' }}">
<p>-</p>
</span>
{% endif %}
</div>
</div>

View File

@@ -1,19 +1,15 @@
<!--
The paginator for post list on HomgPage.
v2.1
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT License
-->
<ul class="pagination mt-4 mb-0 pl-lg-2">
<ul class="pagination align-items-center mt-4 mb-0 pl-lg-2">
<!-- left arrow -->
{% if paginator.previous_page %}
{% assign prev_url = paginator.previous_page_path | relative_url %}
{% else %}
{% assign prev_url = "#" %}
{% endif %}
<li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
<a class="page-link btn-box-shadow" href="{{ prev_url }}" aria-label="previous-page">
<i class="fas fa-angle-left"></i>
@@ -70,12 +66,19 @@
{% endfor %}
<!-- mobile pagination -->
<li class="page-index align-middle">
<span>{{ paginator.page }}</span>
<span class="text-muted">/ {{ paginator.total_pages }}</span>
</li>
<!-- right arrow -->
{% if paginator.next_page_path %}
{% assign next_url = paginator.next_page_path | relative_url %}
{% else %}
{% assign next_url = "#" %}
{% endif %}
<li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}">
<a class="page-link btn-box-shadow" href="{{ next_url }}" aria-label="next-page">
<i class="fas fa-angle-right"></i>

View File

@@ -1,17 +1,12 @@
<!--
Post sharing snippet
v2.1
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
Published under the MIT License
-->
<div class="share-wrapper">
<span class="share-label text-muted mr-1">{{ site.data.share.label }}</span>
<span class="share-label text-muted mr-1">{{ site.data.locales[site.lang].post.share | default: 'Share' }}</span>
<span class="share-icons">
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
{% assign url = page.url | relative_url | prepend: site.url %}
{% assign url = page.url | absolute_url %}
{% for share in site.data.share.platforms %}
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
@@ -21,8 +16,10 @@
</a>
{% endfor %}
<i class="fa-fw fas fa-link small" onclick="copyLink()"
data-toggle="tooltip" data-placement="top" title="Copy link"></i>
<i class="fa-fw fas fa-link small" onclick="copyLink('', '{{ site.data.locales[site.lang].post.button.copy.succeed }}')"
data-toggle="tooltip" data-placement="top"
title="{{ site.data.locales[site.lang].post.button.copy.title }}">
</i>
</span>
</div>

View File

@@ -1,15 +1,29 @@
<!--
Calculate the post's reading time, and display the word count in tooltip
-->
{% assign words = include.content | strip_html | number_of_words: "auto" %}
{% assign read_time = words | divided_by: site.data.read_time.wpm %}
<!-- words per minute -->
{% assign wpm = 180 %}
{% assign min_time = 1 %}
{% assign read_time = words | divided_by: wpm %}
{% unless read_time > 0 %}
{% assign read_time = site.data.read_time.min_time %}
{% assign read_time = min_time %}
{% endunless %}
{% capture read_prompt %}
{{- site.data.locales[site.lang].post.read_time.prompt | default: "read" -}}
{% endcapture %}
<!-- return element -->
<span class="readtime" data-toggle="tooltip" data-placement="bottom" title="{{ words }} words">
{{- read_time -}}{{" "}}{{- site.data.read_time.prompt -}}
<span class="readtime" data-toggle="tooltip" data-placement="bottom"
title="{{ words }} {{ site.data.locales[site.lang].post.words | default: "words" }}">
{{- read_time -}}{{" "}}{{- site.data.locales[site.lang].post.read_time.unit | default: "min" -}}
{%- if include.prompt -%}
{% unless site.lang contains 'zh' %}{{" "}}{% endunless %}{{ read_prompt }}
{%- endif -%}
</span>

View File

@@ -8,6 +8,7 @@
In order to allow a wide table to scroll horizontally,
we suround the markdown table with `<div class="table-wrapper">` and `</div>`
-->
{% if _content contains '<table>' %}
{% assign _content = _content
| replace: '<table>', '<div class="table-wrapper"><table>'
@@ -21,6 +22,7 @@
https://github.com/penibelst/jekyll-compress-html/issues/101
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
-->
{% if _content contains '<pre class="highlight">' %}
{% assign _content = _content
| replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
@@ -29,11 +31,100 @@
{% endif %}
<!-- Add attribute 'hide-bullet' to the checkbox list -->
{% if _content contains '<li class="task-list-item"><' %}
{% assign _content = _content
| replace: '"task-list-item"><', '"task-list-item" hide-bullet><'
%}
{% endif %}
<!-- images -->
{% if _content contains '<img src="' %}
<!-- add CDN prefix if it exists -->
{% if site.img_cdn != '' %}
{% assign img_path_replacement = '<img src="' | append: site.img_cdn | append: '/' %}
{% else %}
{% assign img_path_replacement = '<img src="' | append: site.baseurl | append: '/' %}
{% endif %}
{% assign _content = _content | replace: '<img src="/', img_path_replacement %}
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% assign _content = _content | replace: '<img src="', '<img data-proofer-ignore data-src="' %}
<!-- add image placehoder to prevent layout reflow -->
{% assign _img_content = nil %}
{% assign _images = _content | split: '<img ' %}
{% for _img in _images %}
{% if forloop.first %}
{% assign _img_content = _img %}
{% continue %}
{% endif %}
{% assign _width = nil %}
{% assign _height = nil %}
{% assign _attrs = _img | split: '>' | first | split: ' ' %}
{% for _attr in _attrs %}
{% capture _key %}{{ _attr | split: '=' | first }}{% endcapture %}
{% capture _value %}{{ _attr | split: '=' | last | replace: '"', '' }}{% endcapture %}
{% case _key %}
{% when 'width' %}
{% assign _width = _value %}
{% when 'height' %}
{% assign _height = _value %}
{% endcase %}
{% if _width and _height %}
{% capture _svg %}data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{_width}} {{_height}}'%3E%3C/svg%3E{% endcapture %}
{% assign _img_content = _img_content | append: '<img src="' | append: _svg | append: '" ' | append: _img %}
{% break %}
{% endif %}
{% endfor %}
{% unless _width and _height %}
{% assign _img_content = _img_content | append: '<img ' | append: _img %}
{% endunless %}
{% endfor %}
{% assign _content = _img_content %}
{% endif %}
<!-- Add lang-badge for code snippets -->
{% if _content contains '<div class="language-' %}
{% assign _code_splits = _content | split: '<div class="language-' %}
{% assign _new_content = nil %}
{% for _snippet in _code_splits %}
{% if forloop.first %}
{% assign _new_content = _snippet %}
{% else %}
{% assign _lang = _snippet | split: ' ' | first %}
{% capture _tag_head %}<div lang="{{_lang}}" class="language-{% endcapture %}
{% assign _new_content = _new_content | append: _tag_head | append: _snippet %}
{% endif %}
{% endfor %}
{% if _new_content %}
{% assign _content = _new_content %}
{% endif %}
{% endif %}
<!-- return -->
{{ _content }}

View File

@@ -1,11 +1,6 @@
<!--
Recommend the other 3 posts according to the tags and categories of the current post,
if the number is not enough, use the other latest posts to supplement.
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
Published under the MIT License
-->
<!-- The total size of related posts -->
@@ -85,7 +80,8 @@
{% if index_list.size > 0 %}
<div id="related-posts" class="mt-5 mb-2 mb-sm-4">
<h3 class="pt-2 mt-1 mb-4 ml-1" data-toc-skip>{{ site.data.label.post.relate_posts }}</h3>
<h3 class="pt-2 mt-1 mb-4 ml-1"
data-toc-skip>{{ site.data.locales[site.lang].post.relate_posts | default: 'Further Reading' }}</h3>
<div class="card-deck mb-4">
{% for entry in index_list %}
{% assign index = entry | plus: 0 %}

View File

@@ -1,17 +1,14 @@
<!--
Jekyll Simple Search loader
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
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>
@@ -25,8 +22,25 @@
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('search-results'),
json: '{{ site.baseurl }}/assets/js/data/search.json',
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>
</script>

View File

@@ -1,14 +1,10 @@
<!--
The Search results
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
-->
<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 }}</h4>
<h4 class="text-muted mb-4">{{ site.data.locales[site.lang].panel.trending_tags | default: 'Trending Tags' }}</h4>
{% include trending-tags.html %}

View File

@@ -1,39 +1,38 @@
<!--
The Side Bar
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
-->
<div id="sidebar" class="d-flex flex-column align-items-end">
<div id="sidebar" class="d-flex flex-column align-items-end" lang="{{lang}}">
<div class="profile-wrapper text-center">
<div id="avatar">
<a href="{{ site.baseurl }}/" alt="avatar" class="mx-auto">
{% assign avatar_url = site.avatar %}
{% capture start %}{{ site.avatar | slice: 0 }}{% endcapture %}
{% if start == '/' %}
{% assign avatar_url = avatar_url | prepend: site.baseurl %}
{% endif %}
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto">
{% capture avatar_url %}
{%- if site.avatar contains '://' -%}
{{ site.avatar }}
{%- elsif site.img_cdn != '' and site.img_cdn -%}
{{ site.avatar | prepend: site.img_cdn }}
{%- else -%}
{{ site.avatar | relative_url }}
{%- endif -%}
{% endcapture %}
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'">
</a>
</div>
<div class="site-title mt-3">
<a href="{{ '/' | relative_url }}">{{- site.title -}}</a>
<a href="{{ '/' | relative_url }}">{{ site.title }}</a>
</div>
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
<div class="site-subtitle font-italic">{{ site.tagline }}</div>
</div><!-- .profile-wrapper -->
<ul class="w-100">
<!-- home -->
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
<a href="{{ '/' | relative_url }}" class="nav-link">
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
<span>{{ "HOME" }}</span>
<span>{{ site.data.locales[site.lang].tabs.home | default: "home" | upcase }}</span>
</a>
</li>
<!-- the real tabs -->
@@ -41,7 +40,9 @@
<li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
<a href="{{ tab.url | relative_url }}" class="nav-link">
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
<span>{{ tab.title | upcase }}</span>
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
<span>{{ site.data.locales[site.lang].tabs.[tab_name] | default: tab_name | upcase }}</span>
</a>
</li> <!-- .nav-item -->
{% endfor %}

View File

@@ -1,27 +1,27 @@
<!--
Date format snippet
v2.4.1
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT License
See: /assets/js/_utils/timeage.js
-->
{% assign tooltip_df = site.data.locales[site.lang].date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
{% assign post_long_df = site.data.locales[site.lang].date_format.post.long | default: '%b %e, %Y' %}
{% assign post_short_df = site.data.locales[site.lang].date_format.post.short | default: '%b %e' %}
{% if include.preposition %}
{{ include.preposition }}
{% endif %}
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
{% if include.tooltip %}
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: site.data.date_format.tooltip }}"
title="{{ include.date | date: tooltip_df }}"
{% endif %}>
{% assign this_year = site.time | date: "%Y" %}
{% assign post_year = include.date | date: "%Y" %}
{% if post_year == this_year %}
{{ include.date | date: site.data.date_format.post.short }}
{% else %}
{{ include.date | date: site.data.date_format.post.long }}
{% endif %}
{%- assign this_year = site.time | date: "%Y" -%}
{%- assign post_year = include.date | date: "%Y" -%}
{%- if post_year == this_year -%}
{{ include.date | date: post_short_df }}
{%- else -%}
{{ include.date | date: post_long_df }}
{%- endif -%}
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
</span>
</span>

View File

@@ -1,28 +1,51 @@
<!--
The Top Bar
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
-->
<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 %}
<span>
<a href="{{ site.baseurl }}{{ item.url | remove: '.html'}}">
{{ item.label }}
</a>
</span>
{% assign paths = page.url | split: '/' %}
{% if paths.size == 0 or page.layout == 'home' %}
<!-- index page -->
<span>{{ site.data.locales[site.lang].tabs.home | default: 'home' | capitalize }}</span>
{% else %}
{% for item in paths %}
{% if forloop.first %}
<span>
<a href="{{ '/' | relative_url }}">
{{ site.data.locales[site.lang].tabs.home | default: 'home' | capitalize }}
</a>
</span>
{% elsif forloop.last %}
{% if page.collection == 'tabs' %}
<span>{{ site.data.locales[site.lang].tabs[item] | default: page.title }}</span>
{% else %}
<span>{{ page.title }}</span>
{% endif %}
{% else %}
<span>{{ item.label }}</span>
{% unless page.layout == 'post' %}
<span>
<a href="{{ item | relative_url }}">
{{ site.data.locales[site.lang].tabs[item] | default: page.title }}
</a>
</span>
{% endunless %}
{% endif %}
{% endfor %}
{% unless page.layout == "home" %}
<span>{{ page.title }}</span>
{% endunless %}
{% endif %}
</span><!-- endof #breadcrumb -->
@@ -30,11 +53,12 @@
<div id="topbar-title">
{% if page.layout == 'home' %}
{{- site.title -}}
{% elsif page.dynamic_title %}
{{- page.title -}}
{{- site.data.locales[site.lang].title | default: site.title -}}
{% elsif page.collection == 'tabs' %}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[site.lang].tabs[tab_key] | default: page.title -}}
{% else %}
{{- page.layout | capitalize -}}
{{- site.data.locales[site.lang].layout[page.layout] | default: page.layout | capitalize -}}
{% endif %}
</div>
@@ -42,10 +66,10 @@
<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 }}...">
aria-label="search" autocomplete="off" placeholder="{{ site.data.locales[site.lang].search.hint | default: 'Search' | capitalize }}...">
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span>
<span id="search-cancel" >Cancel</span>
<span id="search-cancel" >{{ site.data.locales[site.lang].search.cancel | default: 'Cancel' }}</span>
</div>
</div>

View File

@@ -1,9 +1,5 @@
{% comment %}
The trending tags list
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
MIT Licensed
{% endcomment %}
{% assign MAX = 10 %}

View File

@@ -1,9 +1,5 @@
{% comment %}
Get the last 5 posts from lastmod list.
v2.2
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT License
{% endcomment %}
{% assign MAX_SIZE = 5 %}

View File

@@ -1,34 +1,28 @@
/*
* This script make #search-result-wrapper switch to unloaded or shown automatically.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT License
*/
$(function() {
var btnSbTrigger = $("#sidebar-trigger");
var btnSearchTrigger = $("#search-trigger");
var btnCancel = $("#search-cancel");
var btnClear = $("#search-cleaner");
const btnSbTrigger = $("#sidebar-trigger");
const btnSearchTrigger = $("#search-trigger");
const btnCancel = $("#search-cancel");
const btnClear = $("#search-cleaner");
var main = $("#main");
var topbarTitle = $("#topbar-title");
var searchWrapper = $("#search-wrapper");
var resultWrapper = $("#search-result-wrapper");
var results = $("#search-results");
var input = $("#search-input");
var hints = $("#search-hints");
const main = $("#main");
const topbarTitle = $("#topbar-title");
const searchWrapper = $("#search-wrapper");
const resultWrapper = $("#search-result-wrapper");
const results = $("#search-results");
const input = $("#search-input");
const hints = $("#search-hints");
/*--- Actions in small screens (Sidebar unloaded) ---*/
var scrollBlocker = (function() {
var offset = 0;
const scrollBlocker = (function () {
let offset = 0;
return {
block() {
offset = $(window).scrollTop();
offset = window.scrollY;
$("html,body").scrollTop(0);
},
release() {
$("html,body").scrollTop(offset);
@@ -39,7 +33,10 @@ $(function() {
};
}());
var mobileSearchBar = (function() {
/*--- Actions in small screens (Sidebar unloaded) ---*/
const mobileSearchBar = (function () {
return {
on() {
btnSbTrigger.addClass("unloaded");
@@ -58,37 +55,38 @@ $(function() {
};
}());
var resultSwitch = (function() {
var visable = false;
const resultSwitch = (function () {
let visible = false;
return {
on() {
if (!visable) {
resultWrapper.removeClass("unloaded");
main.addClass("hidden");
visable = true;
if (!visible) {
// the block method must be called before $(#main) unloaded.
scrollBlocker.block();
resultWrapper.removeClass("unloaded");
main.addClass("unloaded");
visible = true;
}
},
off() {
if (visable) {
if (visible) {
results.empty();
if (hints.hasClass("unloaded")) {
hints.removeClass("unloaded");
}
resultWrapper.addClass("unloaded");
btnClear.removeClass("visable");
main.removeClass("hidden");
btnClear.removeClass("visible");
main.removeClass("unloaded");
// now the release method must be called after $(#main) display
scrollBlocker.release();
input.val("");
visable = false;
scrollBlocker.release();
visible = false;
}
},
isVisable() {
return visable;
isVisible() {
return visible;
}
};
@@ -130,7 +128,7 @@ $(function() {
resultSwitch.on();
if (!btnClear.hasClass("visible")) {
btnClear.addClass("visable");
btnClear.addClass("visible");
}
if (isMobileView()) {
@@ -149,7 +147,7 @@ $(function() {
resultSwitch.off();
}
input.focus();
btnClear.removeClass("visable");
btnClear.removeClass("visible");
});
});

View File

@@ -1,17 +1,13 @@
/**
* Expand or close the sidebar in mobile screens.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT License
*/
$(function() {
var sidebarUtil = (function() {
const sidebarUtil = (function () {
const ATTR_DISPLAY = "sidebar-display";
var isExpanded = false;
var body = $("body");
let isExpanded = false;
const body = $("body");
return {
toggle() {

View File

@@ -1,9 +1,5 @@
/**
* Initial Bootstrap Tooltip.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2019 Cotes Chung
* MIT License
*/
$(function () {
$("[data-toggle=\"tooltip\"]").tooltip();

View File

@@ -0,0 +1,69 @@
/*
* Hide Header on scroll down
*/
$(function() {
const topbarWrapper = $("#topbar-wrapper");
const toc = $("#toc-wrapper");
const access = $(".access");
const searchInput = $("#search-input");
let didScroll;
let lastScrollTop = 0;
const delta = 5;
const topbarHeight = topbarWrapper.outerHeight();
function hasScrolled() {
var st = $(this).scrollTop();
/* Make sure they scroll more than delta */
if (Math.abs(lastScrollTop - st) <= delta) {
return;
}
if (st > lastScrollTop && st > topbarHeight) {
/* Scroll Down */
topbarWrapper.removeClass("topbar-down").addClass("topbar-up");
if (toc.length > 0) {
toc.removeClass("topbar-down");
}
if (access.length > 0) {
access.removeClass("topbar-down");
}
if (searchInput.is(":focus")) {
searchInput.blur(); /* remove focus */
}
} else if (st + $(window).height() < $(document).height()) {
/* Scroll Up */
topbarWrapper.removeClass("topbar-up").addClass("topbar-down");
if (toc.length > 0) {
toc.addClass("topbar-down");
}
if (access.length > 0) {
access.addClass("topbar-down");
}
}
lastScrollTop = st;
}
$(window).scroll(function(event) {
if ($("#topbar-title").is(":hidden")) { /* Not in small screens */
didScroll = true;
}
});
setInterval(function() {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);
});

View File

@@ -1,16 +1,16 @@
/*
* Topbar title auto change while scrolling in mobile screens.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT License
* Top bar title auto change while scrolling in mobile screens.
*/
$(function() {
var DEFAULT = $("#topbar-title").text().trim();
var title = ($("div.post>h1").length > 0) ?
$("div.post>h1").text().trim() : $("h1").text().trim();
const topbarTitle = $("#topbar-title");
const postTitle = $("div.post>h1");
const DEFAULT = topbarTitle.text().trim();
let title = (postTitle.length > 0) ?
postTitle.text().trim() : $("h1").text().trim();
if ($("#page-category").length || $("#page-tag").length) {
/* The title in Category or Tag page will be "<title> <count_of_posts>" */
@@ -22,26 +22,26 @@ $(function() {
/* Replace topbar title while scroll screens. */
$(window).scroll(function () {
if ($("#post-list").length /* in Home page */
|| $("div.post>h1").is(":hidden") /* is tab pages */
|| $("#topbar-title").is(":hidden") /* not mobile screens */
|| postTitle.is(":hidden") /* is tab pages */
|| topbarTitle.is(":hidden") /* not mobile screens */
|| $("#sidebar.sidebar-expand").length) { /* when the sidebar trigger is clicked */
return false;
}
if ($(this).scrollTop() >= 95) {
if ($("#topbar-title").text() !== title) {
$("#topbar-title").text(title);
if (topbarTitle.text() !== title) {
topbarTitle.text(title);
}
} else {
if ($("#topbar-title").text() !== DEFAULT) {
$("#topbar-title").text(DEFAULT);
if (topbarTitle.text() !== DEFAULT) {
topbarTitle.text(DEFAULT);
}
}
});
/* Click title remove hover effect. */
$("#topbar-title").click(function() {
topbarTitle.click(function() {
$("body,html").animate({scrollTop: 0}, 800);
});
});
});

5
_javascript/copyright Normal file
View File

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

View File

@@ -0,0 +1,30 @@
/*
* Tab 'Categories' expand/close effect.
*/
$(function() {
const childPrefix = "l_";
const parentPrefix = "h_";
const collapse = $(".collapse");
/* close up top-category */
collapse.on("hide.bs.collapse", function () { /* Bootstrap collapse events. */
const parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
if (parentId) {
$(`#${parentId} .far.fa-folder-open`).attr("class", "far fa-folder fa-fw");
$(`#${parentId} i.fas`).addClass("rotate");
$(`#${parentId}`).removeClass("hide-border-bottom");
}
});
/* expand the top category */
collapse.on("show.bs.collapse", function() {
const parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
if (parentId) {
$(`#${parentId} .far.fa-folder`).attr("class", "far fa-folder-open fa-fw");
$(`#${parentId} i.fas`).removeClass("rotate");
$(`#${parentId}`).addClass("hide-border-bottom");
}
});
});

View File

@@ -1,22 +1,22 @@
/*
* Copy current page url to clipboard.
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT License
*/
function copyLink(url) {
function copyLink(url, msg) {
if (!url || 0 === url.length) {
url = window.location.href;
}
var $temp = $("<input>");
const $temp = $("<input>");
$("body").append($temp);
$temp.val(url).select();
document.execCommand("copy");
$temp.remove();
alert("Link copied successfully!");
let feedback = "Link copied successfully!";
if (msg && msg.length > 0) {
feedback = msg;
}
alert(feedback);
}

View File

@@ -0,0 +1,47 @@
/**
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;
}
/* lazy loading */
const imgList = document.querySelectorAll(`${IMG_SCOPE} img[data-src]`);
const observer = lozad(imgList);
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

@@ -0,0 +1,81 @@
/*
Safari doesn't support CSS `scroll-behavior: smooth`,
so here is a compatible solution for all browser to smooth scrolling
See: <https://css-tricks.com/snippets/jquery/smooth-scrolling/>
Warning: It must be called after all `<a>` tags (e.g., the dynamic TOC) are ready.
*/
$(function() {
$("a[href*='#']")
.not("[href='#']")
.not("[href='#0']")
.click(function(event) {
if (this.pathname.replace(/^\//, "") === location.pathname.replace(/^\//, "")) {
if (location.hostname === this.hostname) {
const REM = 16; /* 16px */
const hash = decodeURI(this.hash);
let isFnRef = RegExp(/^#fnref:/).test(hash);
let isFn = RegExp(/^#fn:/).test(hash);
let selector = hash.includes(":") ? hash.replace(/\:/, "\\:") : hash;
let target = $(selector);
if (target.length) {
event.preventDefault();
if (history.pushState) { /* add hash to URL */
history.pushState(null, null, hash);
}
let curOffset = $(this).offset().top;
let destOffset = target.offset().top;
const scrollUp = (destOffset < curOffset);
const topbarHeight = $("#topbar-wrapper").outerHeight();
if (scrollUp && isFnRef) {
/* Avoid the top-bar covering `fnref` when scrolling up
because `fnref` has no `%anchor`(see: module.scss) style. */
destOffset -= (topbarHeight + REM / 2);
}
$("html,body").animate({
scrollTop: destOffset
}, 800, () => {
const $target = $(target);
$target.focus();
const SCROLL_MARK = "scroll-focus";
/* clean up old scroll mark */
if ($(`[${SCROLL_MARK}=true]`).length) {
$(`[${SCROLL_MARK}=true]`).attr(SCROLL_MARK, false);
}
/* Clean :target links */
if ($(":target").length) { /* element that visited by the URL with hash */
$(":target").attr(SCROLL_MARK, false);
}
/* set scroll mark to footnotes */
if (isFn || isFnRef) {
$target.attr(SCROLL_MARK, true);
}
if ($target.is(":focus")) { /* Checking if the target was focused */
return false;
} else {
$target.attr("tabindex", "-1"); /* Adding tabindex for elements not focusable */
$target.focus(); /* Set focus again */
}
});
}
}
}
}); /* click() */
});

View File

@@ -0,0 +1,74 @@
/*
* Calculate the Timeago
*/
$(function() {
const timeagoElem = $(".timeago");
let toRefresh = timeagoElem.length;
let intervalId = void 0;
const locale = $("meta[name=layout-lang]").attr("content");
const dPrompt = $("meta[name=day-prompt]").attr("content");
const hrPrompt = $("meta[name=hour-prompt]").attr("content");
const minPrompt = $("meta[name=minute-prompt]").attr("content");
const justnowPrompt = $("meta[name=justnow-prompt]").attr("content");
function timeago(isoDate, dateStr) {
let now = new Date();
let past = new Date(isoDate);
if (past.getFullYear() !== now.getFullYear()
|| past.getMonth() !== now.getMonth()) {
return dateStr;
}
let seconds = Math.floor((now - past) / 1000);
let day = Math.floor(seconds / 86400);
if (day >= 1) {
toRefresh -= 1;
return ` ${day} ${dPrompt}`;
}
let hour = Math.floor(seconds / 3600);
if (hour >= 1) {
return ` ${hour} ${hrPrompt}`;
}
let minute = Math.floor(seconds / 60);
if (minute >= 1) {
return ` ${minute} ${minPrompt}`;
}
return justnowPrompt;
}
function updateTimeago() {
$(".timeago").each(function() {
if ($(this).children("i").length > 0) {
let dateStr = $(this).clone().children().remove().end().text();
let node = $(this).children("i");
let iosDate = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */
$(this).text(timeago(iosDate, dateStr));
$(this).append(node);
}
});
if (toRefresh === 0 && typeof intervalId !== "undefined") {
clearInterval(intervalId); /* stop interval */
}
return toRefresh;
}
if (toRefresh === 0) {
return;
}
if (updateTimeago() > 0) { /* run immediately */
intervalId = setInterval(updateTimeago, 60000); /* run every minute */
}
});

View File

@@ -1,15 +1,10 @@
---
layout: page
# The Archives of posts.
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT License
---
<div id="archives" class="pl-xl-2">
{% for post in site.posts %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
@@ -22,9 +17,10 @@ layout: page
<li>
<div>
{% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %}
{% capture this_month %}{{ post.date | date: "%b" }}{% endcapture %}
{% capture _mth_df %}{{ site.data.locales[site.lang].date_format.post.archive_month | default: "%b" }}{% endcapture %}
{% capture this_month %}{{ post.date | date: _mth_df }}{% endcapture %}
<span class="date day">{{ this_day }}</span>
<span class="date month small text-muted">{{ this_month }}</span>
<span class="date month small text-muted">{% include no-zero-date.html date_str=this_month %}</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div>
</li>

View File

@@ -1,14 +1,8 @@
---
layout: page
# All the Categories of posts
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT License
---
{% assign HEAD_PREFIX = "h_" %}
{% assign LIST_PREFIX = "l_" %}
@@ -38,28 +32,23 @@ layout: page
<div class="card categories">
<!-- top-category -->
<div class="card-header d-flex justify-content-between hide-border-bottom"
id="{{ HEAD_PREFIX }}{{ group_index }}">
<div id="{{ HEAD_PREFIX }}{{ group_index }}"
class="card-header d-flex justify-content-between hide-border-bottom">
<span>
{% if sub_categories_size > 0 %}
<i class="far fa-folder-open fa-fw"></i>
{% else %}
<i class="far fa-folder fa-fw"></i>
{% endif %}
<a href="{{ site.baseurl }}/categories/{{ category_name | slugify | url_encode }}/"
class="ml-1 mr-2">
{{ category_name }}
</a>
<i class="far fa-folder{% if sub_categories_size > 0 %}-open{% endif %} fa-fw"></i>
{% capture _category_url %}/categories/{{ category_name | slugify | url_encode }}/{% endcapture %}
<a href="{{ _category_url | relative_url }}" class="ml-1 mr-2">{{ category_name }}</a>
<!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %}
{{ sub_categories_size }}
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
{{ site.data.locales[site.lang].categories.category_measure | default: 'categories' }},
{% endif %}
{{ top_posts_size }}
post{% if top_posts_size > 1 %}s{% endif %}
{{ site.data.locales[site.lang].categories.post_measure | default: 'posts' }}
</span>
</span>
@@ -85,11 +74,14 @@ layout: page
{% for sub_category in sub_categories %}
<li class="list-group-item">
<i class="far fa-folder fa-fw"></i>
<a href="{{ site.baseurl }}/categories/{{ sub_category | slugify | url_encode }}/"
class="ml-1 mr-2">{{ sub_category }}</a>
{% capture _sub_ctg_url %}/categories/{{ sub_category | slugify | url_encode }}/{% endcapture %}
<a href="{{ _sub_ctg_url | relative_url }}" class="ml-1 mr-2">{{ sub_category }}</a>
{% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light">{{ posts_size }}
post{% if posts_size > 1 %}s{% endif %}
<span class="text-muted small font-weight-light">
{{ posts_size }}
{{ site.data.locales[site.lang].categories.post_measure | default: 'posts' }}
</span>
</li>
{% endfor %}

View File

@@ -1,9 +1,6 @@
---
layout: page
# The Category layout
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# MIT Licensed
---
<div id="page-category">
@@ -14,11 +11,13 @@ layout: page
</h1>
<ul class="post-content pl-0">
{% assign post_df = site.data.locales[site.lang].date_format.post.long | default: '%b %e, %Y' %}
{% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
<span class="text-muted small">{{ post.date | date: post_df }}</span>
</li>
{% endfor %}
</ul>

View File

@@ -1,10 +1,6 @@
---
layout: compress
# Default layout
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT Licensed
---
<!DOCTYPE html>
@@ -15,7 +11,7 @@ layout: compress
{% endif %}
{% endcapture %}
<html lang="{{ site.lang | split: "_" | first | default: "en" }}" {{ prefer_mode }}>
<html lang="{{ site.content_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %}
@@ -50,6 +46,8 @@ layout: compress
{% include search-loader.html %}
{% include js-selector.html %}
</body>
</html>

View File

@@ -1,15 +1,11 @@
---
layout: page
# The Home page layout
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT Licensed
---
{% assign pinned = site.posts | where: "pin", "true" %}
{% assign default = site.posts | where_exp: "item", "item.pin != true" %}
{% assign pinned = site.posts | where_exp: "item", "item.pin == true" %}
{% assign default = site.posts | where_exp: "item", "item.pin != true" %}
{% assign posts = "" | split: "" %}
<!-- Get pinned posts -->
@@ -43,7 +39,6 @@ layout: page
{% endfor %}
{% endif %}
<div id="post-list">
{% for post in posts %}
@@ -72,7 +67,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>
@@ -83,7 +78,7 @@ layout: page
{% if post.pin %}
<div class="pin">
<i class="fas fa-thumbtack fa-fw"></i>
<span>{{ site.data.label.pin_prompt }}</span>
<span>{{ site.data.locales[site.lang].post.pin_prompt | default: 'Pinned' }}</span>
</div>
{% endif %}

View File

@@ -1,17 +1,20 @@
---
layout: default
# The page layout
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT License
---
<div class="row">
<div class="col-12 col-lg-11 col-xl-8">
<div id="page" class="post pb-5 pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4 mb-md-4">
{% if page.dynamic_title %}
<h1 class="dynamic-title">{{ page.title }}</h1>
<h1 class="dynamic-title">
{% if page.collection == 'tabs' %}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[site.lang].tabs[tab_key] | default: page.title -}}
{% else %}
{{- page.title -}}
{% endif %}
</h1>
<div class="post-content">
{{ content }}
</div>

View File

@@ -1,10 +1,6 @@
---
layout: default
# The posts' layout
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT Licensed
---
<div class="row">
@@ -18,28 +14,31 @@ 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>
{% capture _preposition %}{{ site.data.locales[site.lang].post.published | default: 'on' }}{% endcapture %}
{% include timeago.html date=page.date tooltip=true preposition=_preposition %}
</div>
<div>
<!-- lastmod -->
{% if page.last_modified_at %}
<span>
Updated
{{ site.data.locales[site.lang].post.updated | default: 'Updated' }}
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
</span>
{% endif %}
<!-- read time -->
{% include read-time.html content=content %}
{% include read-time.html content=content prompt=true %}
<!-- page views -->
{% if site.google_analytics.pv.enabled %}
<span id="pv" class="pageviews"><i class="fas fa-spinner fa-spin fa-fw"></i></span>
{% 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>
{{ site.data.locales[site.lang].post.pageview_measure | default: "views" }}
{% endif %}
</div>
@@ -47,27 +46,24 @@ layout: default
</div> <!-- .post-meta -->
<div class="post-content">
{%- capture img_placehodler -%}
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
{%- endcapture -%}
{% if page.image %}
<img src="{{ img_placehodler }}" data-src="{{ page.image }}" class="preview-img">
{% if page.image.src %}
<img src="{{ page.image.src }}"
class="preview-img"
alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %}width="{{ page.image.width }}"{% endif %}
{% if page.image.height %}height="{{ page.image.height }}"{% endif %}>
{% endif %}
<!-- Using lozad. See: <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% if content contains '<img src=' %}
{% assign replacement = '<img src="' | append: img_placehodler | append: '" data-src=' %}
{{ content | replace: '<img src=', replacement }}
{% else %}
{{ content }}
{% endif %}
{{ content }}
</div>
<div class="post-tail-wrapper text-muted">
<!-- categories -->
{% if page.categories.size > 0 %}
<div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw mr-1"></i>
{% for category in page.categories %}
@@ -92,13 +88,18 @@ layout: default
<div class="post-tail-bottom
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
{% if site.data.rights.license %}
<div class="license-wrapper">
This post is licensed under
<a href="{{ site.data.rights.license.link }}">{{ site.data.rights.license.name }}</a>
by the author.
</div>
{% if site.data.locales[site.lang].copyright.license.template %}
{% capture _replacement %}
<a href="{{ site.data.locales[site.lang].copyright.license.link }}">
{{ site.data.locales[site.lang].copyright.license.name }}
</a>
{% endcapture %}
{{ site.data.locales[site.lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
{% else %}
<span class="text-muted small">{{ site.outdated }}</span>
{% endif %}
</div>
{% include post-sharing.html %}
@@ -140,5 +141,3 @@ layout: default
</div> <!-- .col-* -->
</div> <!-- .row -->
{% include lozad.html %}

View File

@@ -1,10 +1,6 @@
---
layout: page
# The layout for Tag page
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT Licensed
---
<div id="page-tag">
@@ -14,11 +10,13 @@ layout: page
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
</h1>
<ul class="post-content pl-0">
{% assign post_df = site.data.locales[site.lang].date_format.post.long | default: '%b %e, %Y' %}
{% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
<span class="text-muted small">{{ post.date | date: post_df }}</span>
</li>
{% endfor %}
</ul>

View File

@@ -1,11 +1,6 @@
---
layout: page
# All the Tags of posts.
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT License
---
<div id="tags" class="d-flex flex-wrap ml-xl-2 mr-xl-2">

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env ruby
#
# Check for changed posts
Jekyll::Hooks.register :posts, :post_init do |post|
commit_num = `git rev-list --count HEAD "#{ post.path }"`

View File

@@ -6,7 +6,10 @@ categories: [Blogging, Demo]
tags: [typography]
math: true
mermaid: true
image: /assets/img/sample/devices-mockup.png
image:
src: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
width: 850
height: 585
---
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.
@@ -49,14 +52,13 @@ Fluttering and dancing in the breeze.
### Unordered list
- Chapter
- Setcion
- Section
- Paragraph
### Task list
- [ ] TODO
- [x] Completed
- Hold on
- [ ] Defeat COVID-19
- [x] Vaccine production
- [ ] Economic recovery
@@ -97,34 +99,34 @@ Click the hook will locate the footnote[^footnote], and here is another footnote
- Default (with caption)
![Desktop View](/assets/img/sample/mockup.png)
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="972" height="589" }
_Full screen width and center alignment_
<br>
- Specify width
- Shadow
![Desktop View](/assets/img/sample/mockup.png){: width="400"}
_400px image width_
![Window shadow](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/window.png){: .shadow width="1548" height="864" style="max-width: 90%" }
_shadow effect (visible in light mode)_
<br>
- Left aligned
![Desktop View](/assets/img/sample/mockup.png){: width="350" .normal}
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="972" height="589" style="max-width: 70%" .normal}
<br>
- Float to left
![Desktop View](/assets/img/sample/mockup.png){: width="240" .left}
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="972" height="589" style="max-width: 200px" .left}
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
<br>
- Float to right
![Desktop View](/assets/img/sample/mockup.png){: width="240" .right}
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="972" height="589" style="max-width: 200px" .right}
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
<br>
@@ -146,7 +148,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,14 +84,21 @@ 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 attribute `src`, `width`, `height` and `alt` for the image:
```yaml
---
image: /path/to/image-file
image:
src: /path/to/image/file
width: 1000 # in pixels
height: 400 # in pixels
alt: image alternative text
---
```
Except for `alt`, all other options are necessary, especially the `width` and `height`, which are related to user experience and web page loading performance. Later section ["Image size"](#image-size) will also mention this.
### Image caption
Add italics to the next line of an imagethen it will become the caption and appear at the bottom of the image:
@@ -103,10 +110,10 @@ _Image Caption_
### Image size
You can specify the width (and height) of a image with `width`:
In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="400"}
![Desktop View](/assets/img/sample/mockup.png){: width="700" height="400" }
```
### Image position
@@ -118,23 +125,53 @@ By default, the image is centered, but you can specify the position by using one
Image will be left aligned in below sample:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="350" .normal}
![Desktop View](/assets/img/sample/mockup.png){: .normal }
```
- **Float to the left**
```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="240" .left}
![Desktop View](/assets/img/sample/mockup.png){: .left }
```
- **Float to the right**
```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="240" .right}
![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.
### 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
If you host the images on the CDN, you can save the time of repeatedly writing the CDN url by assigning the variable `img_cdn` of `_config.yml` file:
```yaml
img_cdn: https://cdn.com
```
Once `img_cdn` is assigned, the CDN url will be added to the path of all images (images of site avatar and posts) starting with `/`.
For instance, when using images:
```markdown
![The flower](/path/to/flower.png)
```
The parsing result will automatically add the CDN prefix `https://cdn.com` before the image path:
```html
<img src="https://cdn.com/path/to/flower.png" alt="The flower">
```
## Pinned Posts
You can pin one or more posts to the top of the home page, and the fixed posts are sorted in reverse order according to their release date. Enable by:

View File

@@ -7,104 +7,140 @@ tags: [getting started]
pin: true
---
## Prerequisites
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`. Please note that the version of `Ruby` must meet the requirements of the theme on [RubyGems.org](https://rubygems.org/gems/jekyll-theme-chirpy).
## Installation
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub, rename the repository to `USERNAME.github.io` (where `USERNAME` is your GitHub username), and then open terminal and clone the fork to local by:
There are two ways to get the theme:
```terminal
$ git clone https://github.com/USERNAME/USERNAME.github.io.git -b master --single-branch
- **[Install from RubyGems](#install-from-rubygems)** - Easy to update, isolate irrelevant project files so you can focus on writing.
- **[Fork on GitHub](#fork-on-github)** - Convenient for custom development, but difficult to update, only suitable for web developers.
### Install from RubyGems
Add this line to your Jekyll site's `Gemfile`:
```ruby
gem "jekyll-theme-chirpy"
```
### Setting up the local envrionment
And add this line to your Jekyll site's `_config.yml`:
If you would like to run or build the project on your local machine, please follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
Before running or building for the first time, please complete the installation of the Jekyll plugins. Go to the root directory of project and run:
```terminal
$ bundle install
```yaml
theme: jekyll-theme-chirpy
```
`bundle` will automatically install all the dependencies specified by `Gemfile`.
### Setting up Docker environment (optional)
If you're a loyal fan of [**Docker**](https://www.docker.com/) or just too lazy to install the packages mentioned in [_Setting up the local envrionment_](#setting-up-the-local-envrionment), please make sure you have **Docker Engine** installed and running, and then get Docker image `jekyll/jekyll` from Docker Hub by the following command:
And then execute:
```console
$ docker pull jekyll/jekyll
$ bundle
```
## Usage
Next, go to the installed local theme path:
### Initialization
```console
$ cd "$(bundle info --path jekyll-theme-chirpy)"
```
Go to the root directory of the project and start initialization:
And then copy the critical files (for details, see [starter project][starter]) from the theme's gem to your Jekyll site.
> ⚠️ **Watch out for duplicate files!**
>
If your Jekyll site is created by the `jekyll new` command, there will be `index.markdown` and `about.markdown` in the root directory of your site. Please be sure to remove them, otherwise they will overwrite the `index.html` and `_tabs/about.html` from this project, resulting in blank or messy pages.
As an alternative, which we recommend, you can create a Jekyll site [**using the starter template**][use-starter] to save time copying files from the theme's gem. We've prepared everything you need there!
### Fork on GitHub
[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:
```console
$ bundle
```
And then execute:
```console
$ bash tools/init.sh
```
> **Note**: If you not intend to deploy it on GitHub Pages, append parameter option `--no-gh` at the end of the above command.
> **Note**: If you don't plan to deploy your site on GitHub Pages, append parameter option `--no-gh` at the end of the above command.
What it does is:
1. Remove some files or directories from your repository:
- `.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`.
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
### Configuration
Generally, go to `_config.yml` and configure the variables as needed. Some of them are typical options:
Update the variables of `_config.yml` as needed. Some of them are typical options:
- `url`
- `avatar`
- `timezone`
- `theme_mode`
- `lang`
### Run Locally
### Customing Stylesheet
If you need to customize stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file.
Starting from `v4.1.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it.
### Running Local Server
You may want to preview the site contents before publishing, so just run it by:
```terminal
```console
$ bundle exec jekyll s
```
Then open a browser and visit to <http://localhost:4000>.
### Run on Docker
Run the site on Docker with the following command:
Or run the site on Docker with the following command:
```terminal
$ docker run --rm -it \
$ docker run -it --rm \
--volume="$PWD:/srv/jekyll" \
-p 4000:4000 jekyll/jekyll \
jekyll serve
```
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. For example, `/project`.
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`.
Assuming you have already gone through the [initialization](#initialization), you can now choose ONE of the following methods to deploy your website.
Now you can choose ONE of the following methods to deploy your Jekyll site.
#### Deploy on GitHub Pages
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the Pages service.
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the GH Pages service.
1. Push any commit to `origin/master` 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.
Quickly check the files needed for GitHub Actions build:
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](/assets/img/sample/gh-pages-sources.png){: width="650" class="normal"}
- 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.
And then rename your repository to `<GH-USERNAME>.github.io` on GitHub.
Now publish your Jekyll site by:
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.
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_:
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png){: width="850" height="153" }
3. Visit your website at the address indicated by GitHub.
@@ -118,7 +154,7 @@ Go to the root of the source project, build your site by:
$ JEKYLL_ENV=production bundle exec jekyll b
```
Or, build the site with Docker by:
Or build the site with Docker by:
```terminal
$ docker run -it --rm \
@@ -129,3 +165,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](/assets/img/sample/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](/assets/img/sample/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
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/`.
- `browserconfig.xml`
- `site.webmanifest`
The following table helps you understand the changes to the icon file:
Now, copy the remaining image files (`PNG` and `ICO`) to cover the original files in the folder `assets/img/favicons/` of your Jekyll site.
> ✓ means keep, ✗ means delete.
The following table will helps you understand the changes to the favicon files:
| 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

@@ -0,0 +1,236 @@
---
title: Enable Google Page Views
author: Dinesh Prasanth Moluguwan Krishnamoorthy
date: 2021-01-03 18:32:00 -0500
categories: [Blogging, Tutorial]
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.*` 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
### Create GA account and property
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
### Create Data Stream
With your property created, you now need to set up Data Stream to track your blog traffic. After you signup, the prompt should automatically take you to creating your first **Data Stream**. If not, follow these steps:
1. Go to **Admin** on the left column
2. Select the desired property from the drop down on the second column
3. Click on **Data Streams**
4. Add a stream and click on **Web**
5. Enter your blog's URL
It should look like this:
![google-analytics-data-stream](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/01-google-analytics-data-stream.png){: width="1086" height="542"}
Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml` file
```yaml
google_analytics:
id: 'G-V6XXXXXXX' # fill in your Google Analytics ID
# Google Analytics pageviews report settings
pv:
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.
![google-analytics-realtime](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/02-google-analytics-realtime.png){: width="616" height="557"}
## Setup Page Views
There is a detailed [tutorial](https://developers.google.com/analytics/solutions/google-analytics-super-proxy) available to set up Google Analytics superProxy. But, if you are interested to just quickly get your Chirpy-based blog display page views, follow along. These steps were tested on a Linux machine. If you are running Windows, you can use Git bash terminal to run Unix-like commands.
### Setup Google App Engine
1. Visit <https://console.cloud.google.com/appengine>
2. Click on **Create Application**
3. Click on **Create Project**
4. Enter the name and choose the data center close to you
5. Select **Python** language and **Standard** environment
6. Enable billing account. Yeah, you have to link your credit card. But, you won't be billed unless you exceed your free quota. For a simple blog, free quota is more than sufficient.
7. Go to your App Engine dashboard on your browser and select **API & Services** from the left navigation menu
8. Click on **Enable APIs and Services** button on the top
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_
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`
12. Note down the **Your Client ID** and **Your Client Secret**. You'll need this in the next section.
13. Download and install the cloud SDK for your platform: <https://cloud.google.com/sdk/docs/quickstart>
14. Run the following commands:
```console
[root@bc96abf71ef8 /]# gcloud init
~snip~
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=XYZ.apps.googleusercontent.com&redirect_uri=ABCDEFG
Enter verification code: <VERIFICATION CODE THAT YOU GET AFTER YOU VISIT AND AUTHENTICATE FROM THE ABOVE LINK>
You are logged in as: [blah_blah@gmail.com].
Pick cloud project to use:
[1] chirpy-test-300716
[2] Create a new project
Please enter numeric choice or text value (must exactly match list
item): 1
[root@bc96abf71ef8 /]# gcloud info
# Your selected project info should be displayed here
```
### Setup Google Analytics superProxy
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
- 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.
4. Enter any random key for `XSRF_KEY`, your `config.py` should look similar to this
```python
#!/usr/bin/python2.7
__author__ = 'pete.frisella@gmail.com (Pete Frisella)'
# OAuth 2.0 Client Settings
AUTH_CONFIG = {
'OAUTH_CLIENT_ID': 'YOUR_CLIENT_ID',
'OAUTH_CLIENT_SECRET': 'YOUR_CLIENT_SECRET',
'OAUTH_REDIRECT_URI': '%s%s' % (
'https://chirpy-test-XXXXXX.ue.r.appspot.com',
'/admin/auth'
)
}
# 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.
5. From inside the src/ directory, deploy the app
```console
[root@bc96abf71ef8 src]# gcloud app deploy
Services to deploy:
descriptor: [/tmp/google-analytics-super-proxy/src/app.yaml]
source: [/tmp/google-analytics-super-proxy/src]
target project: [chirpy-test-XXXX]
target service: [default]
target version: [VESRION_NUM]
target url: [https://chirpy-test-XXXX.ue.r.appspot.com]
Do you want to continue (Y/n)? Y
Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 1 file to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...done.
Setting traffic split for service [default]...done.
Deployed service [default] to [https://chirpy-test-XXXX.ue.r.appspot.com]
You can stream logs from the command line by running:
$ gcloud app logs tail -s default
To view your application in the web browser run:
$ gcloud app browse
```
6. Visit the deployed service. Add a `/admin` to the end of the URL.
7. Click on **Authorize Users** and make sure to add yourself as a managed user.
8. If you get any errors, please Google it. The errors are self-explanatory and should be easy to fix.
If everything went good, you'll get this screen:
![superProxy-deployed](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/03-superProxy-deployed.png){: width="1366" height="354"}
### Create Google Analytics Query
Head to `https://PROJECT_ID.REGION_ID.r.appspot.com/admin` and create a query after verifying the account. **GA Core Reporting API** query request can be created in [Query Explorer](https://ga-dev-tools.appspot.com/query-explorer/).
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!@=`.
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`.
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.
After the query is saved on GAE, a **Public Endpoint** (public access address) will be generated, and we will get the query result in JSON format when accessing it. Finally, click <kbd>Enable Endpoint</kbd> in **Public Request Endpoint** to make the query effective, and click <kbd>Start Scheduling</kbd> in **Scheduling** to start the scheduled task.
![superproxy-query](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/04-superproxy-query.png){: width="1100" height="126"}
## Configure Chirpy to Display Page View
Once all the hard part is done, it is very easy to enable the Page View on Chirpy theme. Your superProxy dashboard should look something like below and you can grab the required values.
![superproxy-dashboard](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/05-superproxy-dashboard.png){: width="1210" height="694"}
Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
```yaml
google_analytics:
id: 'G-V6XXXXXXX' # fill in your Google Analytics ID
pv:
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
cache_path: # the local PV cache data, friendly to visitors from GFW region
```
Now, you should see the Page View enabled on your blog.
## Reference
[^ga-filters]: [Google Analytics Core Reporting API: Filters](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters)
[chirpy-homepage]: https://github.com/cotes2020/jekyll-theme-chirpy/

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,13 +1,9 @@
/*
* The syntax highlight.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT Licensed
*/
@import "_colors/light-syntax";
@import "_colors/dark-syntax";
@import "colors/light-syntax";
@import "colors/dark-syntax";
html:not([mode]),
html[mode=light] {
@@ -43,8 +39,6 @@ html[mode=dark] {
padding: 1.5rem;
}
$code-font-size: 0.85rem;
div > pre {
@extend %code-snippet-bg;
@extend %code-snippet-radius;
@@ -69,6 +63,28 @@ div > pre {
}
overflow: auto;
pre {
margin-bottom: 0;
font-size: $code-font-size;
line-height: 1.4rem;
word-wrap: normal; /* Fixed Safari overflow-x */
}
table {
padding: 0;
border: 0;
td pre {
overflow: visible; /* Fixed iOS safari overflow-x */
word-break: normal; /* Fixed iOS safari linenos code break */
}
}
td {
padding: 0;
border: 0;
}
.lineno {
margin-left: 0.2rem;
padding-right: 0.5rem;
@@ -83,24 +99,12 @@ div > pre {
-o-user-select: none;
user-select: none;
}
pre {
margin-bottom: 0;
font-size: $code-font-size;
line-height: 1.4rem;
word-wrap: normal; /* Fixed Safari overflow-x */
}
table {
padding: 0;
border: 0;
td pre {
overflow: visible; /* Fixed iOS safari overflow-x */
word-break: normal; /* Fixed iOS safari linenos code break */
}
}
td {
padding: 0;
border: 0;
/* set the dollar sign to non-selectable */
.gp {
user-select: none;
}
} //.highlight
code {
@@ -132,6 +136,15 @@ code {
td.rouge-code {
padding: 1.5rem 1.5rem 1.5rem 1rem;
// Prevent some browser extends from
// changing the URL string of code block.
a {
color: inherit !important;
border-bottom: none !important;
pointer-events: none;
}
}
/* Hide line numbers for default, console, and terminal code snippets */
@@ -152,7 +165,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;
@@ -165,3 +178,9 @@ div[class^='language-']::before {
right: 3.1rem;
}
}
@media (min-width: 1650px) {
div[class^='language-']::before {
right: 3.5rem;
}
}

View File

@@ -0,0 +1,34 @@
/*
* The SCSS variables
*/
/* sidebar */
$sidebar-width: 260px !default; // the basic width
$sidebar-width-small: 210px !default; // screen width: >= 850px, <= 1199px (iPad landscape)
$sidebar-width-large: 350px !default; // screen width: >= 1650px
/* tabs of sidebar */
$tab-count: 5 !default; // backward compatible (version <= 4.0.2)
$tab-height: 3.2rem !default;
$tab-cursor-height: 1.6rem !default;
$cursor-width: 3px !default; // the cursor width of the selected tab
/* other framework sizes */
$topbar-height: 3rem !default;
$footer-height: 5rem !default;
$footer-height-mobile: 6rem !default; // screen width: <= 576px
$main-content-max-width: 1150px !default;
$panel-max-width: 300px !default;
$post-extend-min-height: 35rem !default;
/* syntax highlight */
$code-font-size: 0.85rem !default;

View File

@@ -1,10 +1,6 @@
/*!
* The syntax dark mode styles.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT Licensed
*/
/*
* The syntax dark mode styles.
*/
@mixin dark-syntax {
/* ----- My styles ------ */

View File

@@ -1,10 +1,6 @@
/*!
* The main dark mode styles
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT Licensed
*/
/*
* The main dark mode styles
*/
@mixin dark-scheme {
/* framework */
@@ -19,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);
@@ -52,7 +49,7 @@
--btn-paginator-border-color: var(--btn-border-color);
--btn-paginator-shadow: var(--main-wrapper-bg);
--pin-bg: rgb(34 35 37);
--pin-color: iherit;
--pin-color: inherit;
/* Posts */
--toc-highlight: rgb(116, 178, 243);

View File

@@ -1,10 +1,6 @@
/*!
* The syntax light mode code snippet colors.
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
/*
* The syntax light mode code snippet colors.
*/
@mixin light-syntax {
/* see: <https://raw.githubusercontent.com/jwarby/pygments-css/master/github.css> */
@@ -72,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

@@ -1,10 +1,6 @@
/*!
* The syntax light mode typography colors
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
/*
* The syntax light mode typography colors
*/
@mixin light-scheme {
/* Common */
@@ -13,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

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

View File

@@ -1,13 +1,6 @@
---
# Style for Archives
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
{% include_relative _addon/main.scss %}
/*
Style for Archives
*/
%date-timeline {
content: "";
@@ -21,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;
@@ -66,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;
@@ -104,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

@@ -1,13 +1,6 @@
---
# Style for Tab Categories
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
{% include_relative _addon/main.scss %}
/*
Style for Tab Categories
*/
%category-icon-color {
color: gray;
@@ -18,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;
@@ -36,12 +37,6 @@
@extend %category-icon-color;
}
i {
&.far, &.fas {
font-size: 86%; // fontawesome icons
}
}
} // .categories
.category-trigger {
@@ -49,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

@@ -1,18 +1,18 @@
---
# Style for page Category and Tag
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
/*
Style for page Category and Tag
*/
.dash {
margin: 0 .5rem .6rem .5rem;
border-bottom: 2px dotted var(--dash-color);
}
{% include_relative _addon/main.scss %}
#page-category, #page-tag {
#page-category,
#page-tag {
ul > li {
line-height: 1.5rem;
padding: 0.6rem 0;
&::before { // dot
background: #999;
width: 5px;
@@ -24,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 */
}
}
@@ -43,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

@@ -1,12 +1,54 @@
---
# Style for Homepage
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
/*
Style for Homepage
*/
{% include_relative _addon/main.scss %}
.pagination {
color: var(--btn-patinator-text-color);
font-family: 'Lato', sans-serif;
a:hover {
text-decoration: none;
}
.page-item {
.page-link {
color: inherit;
width: 2.5rem;
height: 2.5rem;
padding: 0;
display: -webkit-box;
-webkit-box-pack: center;
-webkit-box-align: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
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%;
}
} // .page-item
} // .pagination
#post-list {
margin-top: 1rem;
@@ -17,6 +59,10 @@
padding-bottom: 1rem;
border-bottom: 1px solid var(--main-border-color);
a:hover {
@extend %link-hover;
}
h1 {
font-size: 1.4rem;
margin: 0;
@@ -61,64 +107,18 @@
} // #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 {
justify-content: center;
justify-content: space-evenly;
.page-item {
&:not(:first-child):not(:last-child) {
display: none;
}
}
}
}
@@ -146,11 +146,24 @@
.pagination {
font-size: 0.85rem;
.page-item .page-link {
width: 2.2rem;
height: 2.2rem;
.page-item {
&:not(:last-child) {
margin-right: 0.7rem;
}
.page-link {
width: 2rem;
height: 2rem;
}
}
}
.page-index {
display: none;
}
} // .pagination
}

View File

@@ -1,21 +1,10 @@
---
# Post-specific style
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
{% include_relative _addon/main.scss %}
{% include_relative _addon/syntax.scss %}
$prompt-older: "{{ site.data.label.post.button.previous }}";
$prompt-newer: "{{ site.data.label.post.button.next }}";
/*
Post-specific style
*/
@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);
}
@@ -34,25 +23,20 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
padding-right: $pr;
}
.post .post-meta {
#post-wrapper .post-meta {
> div:nth-child(2) {
> span:not(:first-child)::before {
@include dot;
}
}
#pv::after {
content: " views";
}
.readtime::after {
content: " read";
}
}
.post-content {
.preview-img {
margin-top: 0;
margin-bottom: 2.5rem;
@include align-center;
margin-top: 0;
margin-bottom: 2.5rem !important;
}
}
@@ -72,25 +56,50 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
.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 {
@@ -100,29 +109,6 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
white-space: normal;
}
a, span {
&::before {
color: var(--text-muted-color);
font-size: 0.65rem;
text-transform: uppercase;
}
&:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
left: 0.5px;
&::before {
content: $prompt-older
}
}
&:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
right: 0.5px;
&::before {
content: $prompt-newer
}
}
}
} // .post-navigation
@keyframes fade-up {
@@ -153,17 +139,20 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
}
}
#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 {
@@ -179,7 +168,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
&: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);
}
}
@@ -204,7 +193,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
ul {
list-style-type: none;
padding-inline-start: 1.5rem;
>li::before {
> li::before {
background: #c2c9d4;
width: 5px;
height: 5px;
@@ -230,12 +219,13 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
}
%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 {
@@ -244,12 +234,12 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
}
&:hover {
text-decoration: none;
>i {
> i {
@extend %btn-share-hovor;
}
}
}
>i {
> i {
padding-top: 0.35rem;
&:hover {
@extend %btn-share-hovor;
@@ -257,7 +247,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
}
.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));
@@ -278,9 +268,9 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
} // .share-wrapper
.share-label {
@include label(inherit, 400, inherit);
&::after {
content: ":";
}
@@ -288,60 +278,61 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
.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;
}
}
.post-content > div[class^='language-'] {
@include ml-mr(-1.25rem);
border-radius: 0;
&::before { // the lang badge
right: 1rem;
}
}
}
@media all and (max-width: 768px) {
.post img {
.post-content > p > img {
max-width: calc(100% + 1rem);
}
}
@media all and (min-width: 768px) {
.post {
#post-wrapper {
.post-meta {
>div:not(:first-child)::before {
@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

@@ -1,13 +1,6 @@
---
# Styles for Tab Tags
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
{% include_relative _addon/main.scss %}
/*
Styles for Tab Tags
*/
.tag {
border-radius: 0.7em;

View File

@@ -0,0 +1,3 @@
/*
Appending custom SCSS variables will override the default ones in `_sass/addon/variables.scsss`
*/

View File

@@ -2,12 +2,6 @@
title: About
icon: fas fa-info
order: 4
# The About page
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT License
---

31
assets/404.html Normal file
View File

@@ -0,0 +1,31 @@
---
layout: page
title: "404: Page not found"
permalink: /404.html
redirect_from:
- /norobots/
- /assets/
- /posts/
dynamic_title: true
---
<div class="lead">
{%- capture _head_back -%}
<a href="{{ '/' | relative_url }}">{{ site.data.locales[site.lang].not_found.head_back }}</a>
{%- endcapture -%}
{%- capture _archives_page -%}
<a href="{{ 'archives' | relative_url }}">{{ site.data.locales[site.lang].not_found.archives_page }}</a>
{%- endcapture -%}
<p>{{site.data.locales[site.lang].not_found.statment }}</p>
<p>{{ site.data.locales[site.lang].not_found.hint_template
| replace: ':HEAD_BAK', _head_back
| replace: ':ARCHIVES_PAGE', _archives_page }}
</p>
</div>

View File

@@ -1,27 +0,0 @@
/*
* Mainly scss variables
*
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
/* --- ↓ width and height ---- */
$tab-height: 3.2rem;
$tab-cursor-height: 1.6rem;
$sidebar-width-small: 210px;
$sidebar-width-medium: 260px;
$sidebar-width-large: 350px;
$topbar-height: 3rem;
$footer-height: 5rem;
$main-content-max-width: 1150px;
$panel-max-width: 300px;
$post-extend-min-height: 35rem;

View File

@@ -1,4 +0,0 @@
/*!
* Bootstrap Table of Contents v1.0.1 (http://afeld.github.io/bootstrap-toc/)
* Copyright 2015 Aidan Feldman
* Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */nav[data-toggle=toc] .nav>li>a{display:block;padding:4px 20px;font-size:13px;font-weight:500;color:#767676}nav[data-toggle=toc] .nav>li>a:focus,nav[data-toggle=toc] .nav>li>a:hover{padding-left:19px;color:#563d7c;text-decoration:none;background-color:transparent;border-left:1px solid #563d7c}nav[data-toggle=toc] .nav-link.active,nav[data-toggle=toc] .nav-link.active:focus,nav[data-toggle=toc] .nav-link.active:hover{padding-left:18px;font-weight:700;color:#563d7c;background-color:transparent;border-left:2px solid #563d7c}nav[data-toggle=toc] .nav-link+ul{display:none;padding-bottom:10px}nav[data-toggle=toc] .nav .nav>li>a{padding-top:1px;padding-bottom:1px;padding-left:30px;font-size:12px;font-weight:400}nav[data-toggle=toc] .nav .nav>li>a:focus,nav[data-toggle=toc] .nav .nav>li>a:hover{padding-left:29px}nav[data-toggle=toc] .nav .nav>li>.active,nav[data-toggle=toc] .nav .nav>li>.active:focus,nav[data-toggle=toc] .nav .nav>li>.active:hover{padding-left:28px;font-weight:500}nav[data-toggle=toc] .nav-link.active+ul{display:block}

View File

@@ -1,10 +0,0 @@
---
# The default style for layout Page
# v2.2
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT License
---
{% include_relative _addon/main.scss %}
{% include_relative _addon/syntax.scss %}

12
assets/css/style.scss Normal file
View File

@@ -0,0 +1,12 @@
---
---
/*
If the number of TAB files has changed, the following variable is required.
And it must be defined before `@import`.
*/
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
@import "{{ site.theme }}";
/* append your custom style below */

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