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

Compare commits

..

163 Commits

Author SHA1 Message Date
Cotes Chung
41741dc336 Bump version to 3.3.0 2021-04-02 16:17:39 +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
Cotes Chung
493e1d934b Bump version to 2.7.2 2020-12-31 22:54:58 +08:00
Cotes Chung
b9104d0f4c Upgrade dependencies in Gemfile.lock 2020-12-31 22:38:30 +08:00
Cotes Chung
3c72298563 Improve the smooth scrolling
- Add smooth scrolling to the footnotes
- Add hash to URL
2020-12-31 21:37:17 +08:00
Henk van Achterberg
ca2194770c Update pages-deploy.yml.hook (#229)
This change will make the baseurl configuration/testing work. Previous version failed. Posts should have /index.html as suffix in my experience.
2020-12-30 22:22:42 +08:00
Cotes Chung
08fbd06c63 Optimize the DOM of post link on homepage 2020-12-29 15:39:29 +08:00
Dinesh Prasanth M K
a20fd5bf6f Fix the dir name for hosting posts 2020-12-29 06:06:36 +08:00
Cotes Chung
7a88347c63 Remove inline code extra content 2020-12-28 19:38:24 +08:00
Cotes Chung
813443b206 Improve GitHub stuff
- Add more events to the issue interceptor
- Reduce issue label
2020-12-28 02:33:06 +08:00
Cotes Chung
c381353f86 Use liquid to determine whether to render ToC 2020-12-28 02:30:32 +08:00
Cotes Chung
aa6c33526a Fix the compatibility of the smooth scrolling in Safari
Safari(at least on v14) does not support CSS property `scroll-behavior`
2020-12-28 02:28:57 +08:00
Cotes Chung
081e77d462 Bump version to 2.7.1 2020-12-26 00:45:16 +08:00
Cotes Chung
bca7a2a634 Update docs
-  Add description list sample
-  Improve doc content
2020-12-26 00:41:06 +08:00
Cotes Chung
505da84a26 Fix the position of the table scroll bar 2020-12-26 00:41:06 +08:00
Cotes Chung
dfba411d61 Jump to the anchor position smoothly 2020-12-26 00:41:06 +08:00
Cotes Chung
fa310d3190 Optimize typography
- Set the table width to 100% on small screens
- Optimize list style
- Optimize image style
- Make checkbox color lighter (light mode)
- Reduce the space for inline code
2020-12-26 00:41:06 +08:00
Cotes Chung
ef0c9ce770 Simplify sidebar style
Avoid element shifting when rendering
2020-12-26 00:41:06 +08:00
Cotes Chung
7429ef3539 Fix the Jekyll minimum version requirement
Starting from Jekyll v4.1.0, the filter `number_of_words` accepts optional parameters to handle CKJ characters
2020-12-21 23:50:54 +08:00
Cotes Chung
6d4abcc437 Stop local HTML compression 2020-12-21 23:50:54 +08:00
Cotes Chung
5bdea71622 Bump version to 2.7.0 2020-12-19 00:49:31 +08:00
Cotes Chung
8e0004146b Improve CSS selector for image 2020-12-19 00:18:30 +08:00
Cotes Chung
557413cc4c Simplify the image custom class statement 2020-12-19 00:18:30 +08:00
Cotes Chung
6dc6f2a7cf Improve code style 2020-12-18 21:05:47 +08:00
Cotes Chung
8e5d8b8931 Feature: display the language of code snippets 2020-12-18 20:52:39 +08:00
Cotes Chung
260a906b11 Optimize code snippet background color 2020-12-18 20:24:14 +08:00
Cotes Chung
5ffbfaec26 Beautify the pin label on home page 2020-12-17 15:30:49 +08:00
Cotes Chung
b9ffe15ffb Feature: Add reading time to posts 2020-12-17 15:30:49 +08:00
Cotes Chung
87ba30a393 Hire a new bot to deal with the issues 2020-12-17 14:33:52 +08:00
Cotes Chung
cb984aa021 Simplify checkbox with fontawesome icon 2020-12-15 15:20:40 +08:00
Cotes Chung
0225d28fd3 Beautify shape and color of checkbox 2020-12-15 00:39:50 +08:00
Cotes Chung
aba3d25d7a Always load browser default checkbox 2020-12-15 00:39:50 +08:00
Cotes Chung
dc88321ed5 Improve image style (#204) 2020-12-15 00:39:50 +08:00
Cotes Chung
cc24af11fc Revert "Improve image style (#204)"
This reverts commit 07d29ec9bf.
2020-12-14 14:02:32 +08:00
Cotes Chung
d70354021c Make table horizontal scroll (#206) 2020-12-14 02:13:31 +08:00
Cotes Chung
d61446fafc Create a more beautiful checkbox
The browser's default checkbox is too ugly, especially in dark mode
2020-12-14 02:13:31 +08:00
Cotes Chung
d0a8d072fd Add checkbox demo 2020-12-14 00:20:56 +08:00
Cotes Chung
9d59461632 Reduce the frequency of error reporting
The project maintainer determines whether it is a bug
2020-12-13 20:36:26 +08:00
Cotes Chung
cea339088b Improve the checkbox style (#207)
Hotfix: the solution of #203 will affect the layout `archives`
2020-12-13 01:45:52 +08:00
Cotes Chung
07d29ec9bf Improve image style (#204) 2020-12-13 00:43:19 +08:00
Alexandra Zaharia
464fa001b2 Add checkbox style to remove bogus rendered bullet (#203) 2020-12-13 00:35:45 +08:00
Cotes Chung
53a98feff3 Update pwa cache list 2020-12-11 23:08:57 +08:00
Cotes Chung
b8ee5a7b0c Fix underscores in the links of tags/categories (#199) 2020-12-11 23:05:36 +08:00
Cotes Chung
289ce1263d Fix detection of mermaid objects 2020-12-11 02:20:18 +08:00
Cotes Chung
63f57fbc12 Delay GA loading 2020-12-10 23:57:48 +08:00
Cotes Chung
cdaa79cf80 Improve JS loading sequence 2020-12-10 20:13:03 +08:00
Cotes Chung
d53769e52b Improve the dark-mode color of the italics in code snippet 2020-12-10 20:13:03 +08:00
Cotes Chung
7de13415e7 Update README & improve manual 2020-12-10 20:13:03 +08:00
Cotes Chung
d196645d88 Introduce the mermaid in docs 2020-12-10 06:39:03 +08:00
Cotes Chung
4d2f13c0d7 Integrate with mermaid-js 2020-12-10 05:00:01 +08:00
Cotes Chung
5ed39300cb Add gitattributes 2020-12-08 13:49:12 +08:00
Cotes Chung
d7d3bc9947 Simplify site config 2020-12-08 13:49:12 +08:00
Cotes Chung
cf3943342a Update the minimum version requirements of Jekyll
Jekyll allow custom sorting of collection documents from 4.x
2020-12-07 19:51:30 +08:00
Cotes Chung
59deef469d Improve travis config. 2020-12-07 02:19:50 +08:00
Cotes Chung
bb13b52d44 Simplify theme-mode config 2020-12-07 01:14:40 +08:00
Cotes Chung
8d4c555638 Fix gh-actions cache not being hit issue (#191) 2020-12-07 00:10:15 +08:00
Cotes Chung
cbf707dc56 Update runner tool
allow LAN access Jekyll
2020-12-06 14:17:41 +08:00
Cotes Chung
6335991164 Avoid mode switch button shifting 2020-12-06 14:09:47 +08:00
Cotes Chung
5d6014ecee Regular improvement for liquid code 2020-12-05 02:44:28 +08:00
Cotes Chung
13aca77275 Change mode-toggle icon 2020-12-05 01:40:01 +08:00
Cotes Chung
1172f1646d Restore the archive-title that was deleted by mistake 2020-12-04 14:45:17 +08:00
Cotes Chung
e27825d3eb Improve JS/CSS selector
Separate layout from tabs, and more friendly to tabs rename (#187)
2020-12-04 14:18:25 +08:00
Cotes Chung
36c4f32b17 Fix yaml syntax of workflow 2020-12-02 18:40:06 +08:00
Cotes Chung
6a326dc8e0 Improve the interceptor action
Avoid secondary runs
2020-11-30 22:04:52 +08:00
Cotes Chung
20c14c0207 Fix & rename CN version README 2020-11-30 22:04:52 +08:00
Cotes Chung
575b5c292a Bump version to 2.6.2 2020-11-29 12:32:27 +08:00
Cotes Chung
479bd72c9d Fix the 404 title on mobile devices 2020-11-29 12:25:46 +08:00
Cotes Chung
f2efae8b01 Improve the issue/pr interceptor 2020-11-28 21:48:59 +08:00
Cotes Chung
8b2e6d1bf5 Restore the runner tool 2020-11-27 23:50:22 +08:00
140 changed files with 3464 additions and 2681 deletions

16
.gitattributes vendored Normal file
View File

@@ -0,0 +1,16 @@
# Set default behavior to automatically normalize line endings.
* text=auto
# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf
# Force batch scripts to always use CRLF line endings so that if a repo is accessed
# in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.ico binary

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

@@ -1,7 +1,6 @@
---
name: Bug Report
about: Create a report to help us improve
labels: bug
---
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->

17
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
# Clean up the stale issues
daysUntilStale: 30
daysUntilClose: 1
exemptLabels:
- in progress
- pending
staleLabel: stale
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: false

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.6.x
- name: Bundle Caching
uses: actions/cache@v2
with:
path: ${{ env.GEMS_PATH }}
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle Install
run: |
bundle config path ${{ env.GEMS_PATH }}
bundle install --jobs 4 --retry 3
ruby-version: 2.7
bundler-cache: true
- name: Build Site
env:

View File

@@ -0,0 +1,20 @@
name: "Intercept bad issue/PRs"
on:
issues:
types: [opened]
pull_request:
types: [opened]
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\\]|\\[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\\]|\\[X\\]) (Bug fix|New feature|Breaking change|Documentation update)|@dependabot"
pr-close-message: ":wave: Hi @${pull_request.user.login},\n\nThis PR is being automatically closed because it does not follow the PR template."

View File

@@ -1,24 +0,0 @@
name: "Close stale issues"
on:
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- env:
DAYS_TO_STALE: ${{ 5 }}
DAYS_TO_CLOSE: ${{ 2 }}
uses: actions/stale@v3
with:
repo-token: ${{ secrets.GH_PAT }}
stale-issue-message: 'This issue is stale because it has been open ${{ env.DAYS_TO_STALE }} days with no activity. Remove stale label or comment or this will be closed in ${{ env.DAYS_TO_CLOSE }} days'
stale-issue-label: 'stale'
exempt-issue-labels: 'pending, in progress'
stale-pr-message: 'This PR is stale because it has been open ${{ env.DAYS_TO_STALE }} days with no activity. Remove stale label or comment or this will be closed in ${{ env.DAYS_TO_CLOSE }} days'
stale-pr-label: 'stale'
exempt-pr-labels: 'pending, in progress'
days-before-stale: ${{ env.DAYS_TO_STALE }}
days-before-close: ${{ env.DAYS_TO_CLOSE }}
# debug-only: true

View File

@@ -1,18 +0,0 @@
name: "Close Irregular Issues"
on:
issues:
types: [opened, edited]
jobs:
auto_close_issues:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Automatically close issues that don't follow the issue template
uses: lucasbento/auto-close-issues@v1.0.2
with:
github-token: ${{ secrets.GH_PAT }}
issue-close-message: "@${issue.user.login}: hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template. \n> Follow the template to edit this issue and it will automatically reopen."
closed-issues-label: "🙁 Not following issue 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,49 +20,34 @@ 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.6.x
- name: Bundle Caching
uses: actions/cache@v2
with:
path: ${{ env.GEMS_PATH }}
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle Install
run: |
bundle config path ${{ env.GEMS_PATH }}
bundle install --jobs 4 --retry 3
ruby-version: 2.7
bundler-cache: true
- name: Check baseurl
run: |
baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
if [[ -n $baseurl ]]; then
echo "SPEC_TEST=_site_no_baseurl" >> $GITHUB_ENV
echo "BASE_URL=$baseurl" >> $GITHUB_ENV
fi
- name: Build Site
env:
JEKYLL_ENV: production
run: |
bundle exec jekyll b
if [[ -n $SPEC_TEST ]]; then
# Bypass the defects of htmlproofer
bundle exec jekyll b -b "" -d "$SPEC_TEST"
fi
bundle exec jekyll b -d "_site$BASE_URL"
- name: Test Site
run: |
if [[ -n $SPEC_TEST ]]; then
bash tools/test.sh -d "$SPEC_TEST"
else
bash tools/test.sh
fi
- name: Deploy
run: |
if [[ -n $BASE_URL ]]; then
mv _site$BASE_URL _site-rename
rm -rf _site
mv _site-rename _site
fi
bash tools/deploy.sh

11
.gitignore vendored
View File

@@ -2,7 +2,14 @@
.*
!.github
# jekyll cache
# bundler cache
_site
Gemfile.lock
vendor
Gemfile.lock
# rubygem
*.gem
# npm dependencies
node_modules
package-lock.json

View File

@@ -1,34 +1,50 @@
os: linux
dist: bionic
language: minimal
jobs:
include:
- name: CD
language: ruby
rvm: 2.6.5
before_install:
- bundle config path 'vendor/bundle'
install:
- bundle install --quiet
rvm: 2.7.0
addons:
apt:
packages:
- libcurl4-openssl-dev # required to avoid SSL error (for htmlproofer)
script:
- git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
- eval "$BUILD_CMD"
branches:
only: production
git:
depth: false # for posts lastmod
# 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
branches:
only: /.*-stable$/
notifications:
email:
recipients:

View File

@@ -1,19 +1,11 @@
---
# 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
redirect_from:
- /norobots/
- /assets/
- /tabs/
- /categories/
- /tags/
- /posts/
dynamic_title: true
@@ -21,5 +13,9 @@ dynamic_title: true
<div class="lead">
<p>Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. </p>
<p><a href="{{ site.baseurl }}/">Head back Home</a> to try finding it again, or search for it on the <a href="{{ site.baseurl }}/tabs/archives">Archives page</a>.</p>
<p>
<a href="{{ '/' | relative_url }}">Head back Home</a>
to try finding it again, or search for it on the
<a href="{{ 'archives' | relative_url }}">Archives page</a>.
</p>
</div>

15
Gemfile
View File

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

137
README.md
View File

@@ -1,7 +1,8 @@
# Chirpy
Language: English | [简体中文](docs/README_zh-CN.md)
Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md)
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy)
[![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
@@ -9,17 +10,7 @@ Language: English | [简体中文](docs/README_zh-CN.md)
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)
[![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)
[![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info)
## Features
@@ -31,6 +22,7 @@ A minimal, sidebar, responsive web design Jekyll theme that focuses on text pres
- Automatically recommend related posts
- Syntax highlighting
- Mathematical expressions
- Mermaid diagram & flowchart
- Search
- Atom Feeds
- Disqus Comments
@@ -38,50 +30,68 @@ A minimal, sidebar, responsive web design Jekyll theme that focuses on text pres
- GA Pageviews reporting (Advanced)
- SEO and Performance Optimization
## Prerequisites
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
## 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** - Easy to update, isolate irrelevant project files so you can focus on writing.
- **Fork on GitHub** - Convenient for custom development, but difficult to update, only suitable for web developers.
### Installing the Theme Gem
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
Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
### Initialization
> **Hint**: To locate the installed themes gem, execute:
>
> ```console
> $ bundle info --path jekyll-theme-chirpy
> ```
Go to the root directory of the project and start initialization:
Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from theme's gem. We have prepared everything for you 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`
@@ -90,28 +100,26 @@ What it does is:
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
### 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 \
@@ -120,20 +128,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:
- 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 repoistory 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) throught _Settings__Options__GitHub Pages_:
![gh-pages-sources](https://raw.githubusercontent.com/cotes2020/jekyll-theme-chirpy/master/assets/img/sample/gh-pages-sources.png)
![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.
@@ -147,7 +167,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 \
@@ -159,7 +179,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.
### 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).
@@ -173,10 +193,25 @@ This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Boot
: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
Also, 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,32 @@
# 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 HTML language tag https://www.w3.org/International/questions/qa-choosing-language-tags
lang: en-US
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai
# jekyll-seo-tag settings https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# --------------------------
title: Chirpy # the main title
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 +34,9 @@ twitter:
username: twitter_username # change to your twitter username
social:
name: your_full_name # it will shows as the copyright owner in Footer
# Change to your full name.
# It will be displayed as the default author of the posts and the copyright owner in the Footer
name: your_full_name
email: example@doamin.com # change to your email address
links:
# The first element serves as the copyright owner's link
@@ -43,14 +49,6 @@ social:
google_site_verification: google_meta_tag_verification # change to your verification string
# --------------------------
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
# change below value to '/projectname'.
baseurl: ''
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai
google_analytics:
id: '' # Fill with your Google Analytics ID
pv:
@@ -62,36 +60,44 @@ google_analytics:
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
# Prefer color scheme setting, available values:
# Prefer color scheme setting.
#
# dual - Follow the system prefer color by default, and a toggle will display
# in the left bottom of Sidebar, which used for switch the theme between dark and light.
# Note: Keep empty will follow the system prefer color by default,
# and there will be a toggle to switch the theme between dark and light
# on the bottom left of the sidebar.
#
# Available options:
#
# light - Use the light color scheme
#
# dark - Use the dark color scheme
#
theme_mode: dual
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
markdown: kramdown
highlighter: rouge
# ------------ The following options are not recommended to be modified ------------------
kramdown:
input: GFM
syntax_highlighter: rouge
syntax_highlighter_opts: # Rouge Options https://github.com/jneen/rouge#full-options
css_class: 'highlight'
css_class: highlight
# default_lang: console
span:
line_numbers: false
@@ -100,7 +106,7 @@ kramdown:
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.
# Or you think you're smart enough to change other relevant URLs within this template.
permalink: /posts/:title/
collections:
@@ -118,58 +124,21 @@ defaults:
layout: post
comments: true # Enable comments in posts.
toc: true # Display TOC column in posts.
breadcrumb:
-
label: Posts
url: /
-
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:
@@ -179,16 +148,22 @@ compress_html:
profile: false
blanklines: false
ignore:
envs: []
envs: [development]
exclude:
- vendor
- Gemfile.lock
- Gemfile
- Gemfile.lock
- '*.gem'
- '*.gemspec'
- tools
- docs
- README.md
- LICENSE
- gulpfile.js
- node_modules
- package.json
- package-lock.json
jekyll-archives:
enabled: [categories, tags]
@@ -196,5 +171,5 @@ jekyll-archives:
category: category
tag: tag
permalinks:
tag: '/tags/:name/'
category: '/categories/:name/'
tag: /tags/:name/
category: /categories/:name/

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 +1,7 @@
# 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,19 +1,19 @@
# 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"
lastmod: Recent Update
trending_tags: Trending Tags
toc: Contents
post:
relate_posts: "Further Reading"
relate_posts: Further Reading
share: Share
button:
next: Newer
previous: Older
search_hint: "Search" # text show on search bar
search_hint: Search # text show on search bar
pin_prompt: Pinned # pinned prompt
read_time_unit: min # see posts' time to read

View File

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

View File

@@ -1,10 +1,4 @@
# License data.
#
# v2.1
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
# License data
license:
name: CC BY 4.0

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,55 +1,10 @@
<!--
CSS selector for site.
Chirpy v2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT Licensed
-->
{% if page.layout == 'home' %}
<link rel="preload" href="{{ '/assets/css/home.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/home.css' | relative_url }}">
{% elsif page.layout == 'page' %}
{% if page.collection == 'tabs' and page.title != 'About' %}
{% if page.title == 'Categories' %}
<link rel="preload" href="{{ '/assets/css/categories.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/categories.css' | relative_url }}">
{% elsif page.title == 'Tags' %}
<link rel="preload" href="{{ '/assets/css/tags.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/tags.css' | relative_url }}">
{% elsif page.title == 'Archives'%}
<link rel="preload" href="{{ '/assets/css/archives.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/archives.css' | relative_url }}">
{% endif %}
{% else %}
<link rel="preload" href="{{ '/assets/css/page.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/page.css' | relative_url }}">
{% endif %}
{% elsif page.layout == 'category' or page.layout == 'tag' %}
<link rel="preload" href="{{ '/assets/css/category-tag.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/category-tag.css' | relative_url }}">
{% elsif page.layout == 'post' %}
<link rel="preload" as="style" href="{{ '/assets/css/post.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/css/post.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
{% 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 %}
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css">
{% endif %}

View File

@@ -1,25 +1,22 @@
<!--
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 }}';
}
};

View File

@@ -1,10 +1,6 @@
<!--
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
-->
{% capture icon_url %}{{ site.baseurl }}/assets/img/favicons{% endcapture %}

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">
@@ -24,7 +20,8 @@
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>
<a href="https://github.com/cotes2020/jekyll-theme-chirpy"
target="_blank" rel="noopener">Chirpy</a>
theme.
</p>
</div>

View File

@@ -1,16 +1,14 @@
<!--
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 async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ site.google_analytics.id }}');
});
</script>

View File

@@ -1,15 +1,26 @@
<!--
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' %}
<meta name="pv-cache-enabled" content="{{ site.google_analytics.pv.enabled }}">
{% if site.google_analytics.pv.enabled %}
{% if site.google_analytics.pv.proxy_endpoint != ''
and site.google_analytics.pv.proxy_endpoint %}
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
{% endif %}
{% if site.google_analytics.pv.cache %}
<meta name="pv-cache-data" content="{{ '/assets/js/data/pageviews.json' | relative_url }}">
{% endif %}
{% endif %}
{% endif %}
{% seo title=false %}
@@ -61,7 +72,7 @@
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
<script async
<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 %}

View File

@@ -1,41 +1,56 @@
<!--
JS selector for site.
Chirpy v2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT Licensed
-->
{% if page.layout == 'home' %}
{% if page.layout == 'home' or page.layout == 'post' %}
{% if site.google_analytics.pv.enabled %}
<!-- pv-report needs countup.js -->
<script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>
<script async src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
{% endif %}
{% endif %}
<script async src="{{ '/assets/js/home.min.js' | relative_url }}"></script>
{% if page.layout == 'home'
or page.layout == 'post'
or page.layout == 'categories' %}
{% assign type = page.layout %}
{% else %}
{% assign type = "page" %}
{% endif %}
{% elsif page.layout == 'post' %}
<script async src="{{ '/assets/js/post.min.js' | relative_url }}"></script>
{% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %}
<script defer src="{{ js | relative_url }}"></script>
{% if page.math %}
<!-- MathJax -->
<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 async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>
{% endif %}
{% elsif page.layout == 'page' %}
{% if page.title == 'Categories' and page.collection == 'tabs' %}
<script async src="{{ '/assets/js/categories.min.js' | relative_url }}"></script>
{% else %}
<script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
{% endif %}
{% else %}
<script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
{% endif %}
{% if jekyll.environment == 'production' %}
<!-- PWA -->
<script defer src="{{ '/app.js' | relative_url }}"></script>
<!-- GA -->
{% if site.google_analytics.id %}
{% include google-analytics.html %}
{% endif %}
{% endif %}

View File

@@ -1,8 +1,10 @@
<!-- image lazy load: https://github.com/ApoorvSaxena/lozad.js -->
<!--
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 imgs = document.querySelectorAll('.post-content img');
const observer = lozad(imgs);
observer.observe();
</script>

29
_includes/mermaid.html Normal file
View File

@@ -0,0 +1,29 @@
<!--
mermaid-js loader
-->
<script src="https://cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js"></script>
<script>
$(function() {
let initTheme = "default";
if ($("html[mode=dark]").length > 0
|| ($("html[mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches ) ) {
initTheme = "dark";
}
let mermaidConf = {
theme: initTheme /* <default|dark|forest|neutral> */
};
/* Markdown converts to HTML */
$("pre").has("code.language-mermaid").each(function() {
let svgCode = $(this).children().html();
$(this).addClass("unloaded");
$(this).after(`<div class=\"mermaid\">${svgCode}</div>`);
});
mermaid.initialize(mermaidConf);
});
</script>

View File

@@ -1,14 +1,8 @@
<!--
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-sun" dark-mode-invisible></i>
<i class="mode-toggle fas fa-moon" light-mode-invisible></i>
<i class="mode-toggle fas fa-adjust"></i>
<script type="text/javascript">
@@ -18,8 +12,8 @@
static get LIGHT_MODE() { return "light"; }
constructor() {
if (this.mode != null) {
if (this.mode == ModeToggle.DARK_MODE) {
if (this.hasMode) {
if (this.isDarkMode) {
if (!this.isSysDarkPrefer) {
this.setDark();
}
@@ -34,8 +28,8 @@
/* always follow the system prefers */
this.sysDarkPrefers.addListener(function() {
if (self.mode != null) {
if (self.mode == ModeToggle.DARK_MODE) {
if (self.hasMode) {
if (self.isDarkMode) {
if (!self.isSysDarkPrefer) {
self.setDark();
}
@@ -48,6 +42,8 @@
self.clearMode();
}
self.updateMermaid();
});
} /* constructor() */
@@ -80,6 +76,33 @@
get mode() { return sessionStorage.getItem(ModeToggle.MODE_KEY); }
/* get the current mode on screen */
get modeStatus() {
if (this.isDarkMode
|| (!this.hasMode && this.isSysDarkPrefer) ) {
return ModeToggle.DARK_MODE;
} else {
return ModeToggle.LIGHT_MODE;
}
}
updateMermaid() {
if (typeof mermaid !== "undefined") {
let expectedTheme = (this.modeStatus === ModeToggle.DARK_MODE? "dark" : "default");
let config = { theme: expectedTheme };
/* re-render the SVG <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344> */
$(".mermaid").each(function() {
let svgCode = $(this).prev().children().html();
$(this).removeAttr("data-processed");
$(this).html(svgCode);
});
mermaid.initialize(config);
mermaid.init(undefined, ".mermaid");
}
}
flipMode() {
if (this.hasMode) {
if (this.isSysDarkPrefer) {
@@ -105,6 +128,8 @@
}
}
this.updateMermaid();
} /* flipMode() */
} /* ModeToggle */
@@ -112,7 +137,9 @@
let toggle = new ModeToggle();
$(".mode-toggle").click(function() {
toggle.flipMode();
});
</script>

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

@@ -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.label.panel.lastmod | default: 'Recent Update' -}}</span>
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %}
@@ -34,12 +30,12 @@
{% if trending_tags.size > 0 %}
<div id="access-tags">
<span>{{- site.data.label.panel.trending_tags -}}</span>
<span>{{- site.data.label.panel.trending_tags | default: 'Trending Tags' -}}</span>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% for tag in trending_tags %}
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
{% for tag_name in trending_tags %}
{% assign url = tag_name | slugify | url_encode | prepend: "/tags/" | append: "/" %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag_name }}</a>
{% endfor %}
</div>
@@ -47,10 +43,12 @@
{% endif %}
</div> <!-- .access -->
{% if page.layout == 'post' and site.toc and page.toc %}
{% 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.label.panel.toc | default: 'Contents' -}}
</span>
<nav id="toc" data-toggle="toc"></nav>
</div>

View File

@@ -1,29 +1,28 @@
<!--
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.label.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.label.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.label.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.label.post.button.next | default: 'next' }}">
<p>-</p>
</span>
{% endif %}

View File

@@ -1,10 +1,5 @@
<!--
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">

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.label.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 %}

19
_includes/read-time.html Normal file
View File

@@ -0,0 +1,19 @@
<!--
Calculate the post's reading time, and display the word count in tooltip
-->
{% assign words = include.content | strip_html | number_of_words: "auto" %}
<!-- words per minute -->
{% assign wpm = 180 %}
{% assign min_time = 1 %}
{% assign read_time = words | divided_by: wpm %}
{% unless read_time > 0 %}
{% assign read_time = min_time %}
{% endunless %}
<!-- return element -->
<span class="readtime" data-toggle="tooltip" data-placement="bottom" title="{{ words }} words">
{{- read_time -}}{{" "}}{{- site.data.label.read_time_unit | default: "min" -}}
</span>

View File

@@ -5,23 +5,62 @@
{% assign _content = include.content %}
<!--
Suroundding the markdown table with '<div class="table-wrapper">. and '</div>'
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>' %}
{% assign _content = _content | replace: '</table>', '</table></div>' %}
{% assign _content = _content | replace: '</table></div></code>', '</table></code>' %}
{% assign _content = _content
| replace: '<table>', '<div class="table-wrapper"><table>'
| replace: '</table>', '</table></div>'
| replace: '</table></div></code>', '</table></code>'
%}
{% endif %}
<!--
Fixed kramdown code highlight rendering:
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' %}
{% assign _content = _content | replace: '</code></pre></div>', '</code></div>' %}
{% assign _content = _content
| replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
| replace: '</code></pre></div>', '</code></div>'
%}
{% 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 %}
{% if _content contains '<img src="' %}
{% 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 lozad = true %}
{% assign img_placehodler
= 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' %}
{% assign lozad_replacement = '<img src="'
| append: img_placehodler
| append: '" data-src="' %}
{% assign _content = _content | replace: '<img src="', lozad_replacement %}
{% endif %}
<!-- return -->
{{ _content }}
{% if lozad %}
{% include lozad.html %}
{% endif %}

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.label.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>

View File

@@ -1,19 +1,15 @@
<!--
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.label.panel.trending_tags | default: 'Trending Tags' }}</h4>
{% include trending-tags.html %}
{% for tag in trending_tags %}
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
{% capture url %}/tags/{{ tag | slugify | url_encode }}/{% endcapture %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
{% endfor %}

View File

@@ -1,45 +1,45 @@
<!--
The Side Bar
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2017-2019 Cotes Chung
MIT License
-->
<div id="nav-wrapper">
<div id="sidebar" class="d-flex flex-column align-items-end">
<div id="profile-wrapper" class="d-flex flex-column">
<div id="avatar" class="d-flex justify-content-center">
<a href="{{ site.baseurl }}/" alt="avatar">
{% assign avatar_url = site.avatar %}
{% capture start %}{{ site.avatar | slice: 0 }}{% endcapture %}
{% if start == '/' %}
{% assign avatar_url = avatar_url | prepend: site.baseurl %}
{% endif %}
<div class="profile-wrapper text-center">
<div id="avatar">
<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="profile-text mt-3">
<div class="site-title">
<div class="site-title mt-3">
<a href="{{ '/' | relative_url }}">{{- site.title -}}</a>
</div>
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
</div>
</div><!-- #profile-wrapper -->
<ul class="nav flex-column">
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
</div><!-- .profile-wrapper -->
<ul class="w-100">
<!-- home -->
<li class="nav-item d-flex justify-content-center {% if page.layout == 'home' %}active{% endif %}">
<a href="{{ '/' | relative_url }}" class="nav-link d-flex justify-content-center align-items-center w-100">
<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>
</a>
</li>
<!-- the real tabs -->
{% for tab in site.tabs %}
<li class="nav-item d-flex justify-content-center {% if tab.url == page.url %}active{% endif %}">
<a href="{{ tab.url | relative_url }}" class="nav-link d-flex justify-content-center align-items-center w-100">
<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>
</a>
@@ -48,16 +48,7 @@
</ul> <!-- ul.nav.flex-column -->
</div><!-- #nav-wrapper -->
<div class="sidebar-bottom d-flex flex-wrap justify-content-around mt-4">
{% if site.theme_mode == "dual" %}
<span id="mode-toggle-wrapper">
{% include mode-toggle.html %}
</span>
<span class="icon-border"></span>
{% endif %}
<div class="sidebar-bottom mt-auto d-flex flex-wrap justify-content-center">
{% for entry in site.data.contact %}
{% capture url %}
@@ -75,11 +66,26 @@
{%- endif -%}
{% endcapture %}
{% if url != '' %}
<a href="{{ url }}" aria-label="{{ entry.type }}" {% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
{% if url %}
<a href="{{ url }}" aria-label="{{ entry.type }}"
{% unless site.theme_mode %}class="order-{{ forloop.index | plus: 2 }}"{% endunless %}
{% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
<i class="{{ entry.icon }}"></i>
</a>
{% endif %}
{% endfor %}
</div>
{% unless site.theme_mode %}
{% if site.data.contact.size > 0 %}
<span class="icon-border order-2"></span>
{% endif %}
<span id="mode-toggle-wrapper" class="order-1">
{% include mode-toggle.html %}
</span>
{% endunless %}
</div> <!-- .sidebar-bottom -->
</div><!-- #sidebar -->

View File

@@ -1,25 +1,29 @@
<!--
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.date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
{% assign post_short_df = site.data.date_format.post.short | default: '%b %e' %}
<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 }}"
{% endif %}>
title="{{ include.date | date: tooltip_df }}"
{% endif %}
{% if include.prefix %}prefix="{{ include.prefix }} "{% endif%}
{% if include.prep %}prep="{{ include.prep }}"{% endif %} >
{% assign this_year = site.time | date: "%Y" %}
{% assign post_year = include.date | date: "%Y" %}
{% if post_year == this_year %}
{{ include.date | date: site.data.date_format.post.short }}
{{ include.date | date: post_short_df }}
{% else %}
{{ include.date | date: site.data.date_format.post.long }}
{{ include.date | date: post_long_df }}
{% endif %}
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>

View File

@@ -1,28 +1,46 @@
<!--
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 %}
{% assign paths = page.url | split: '/' %}
{% if paths.size == 0 %}
<!-- index page -->
<span>{{ 'Posts' }}</span>
{% else %}
{% for item in paths %}
{% if forloop.first %}
{% unless page.layout == 'post' %}
<span>
<a href="{{ site.baseurl }}{{ item.url | remove: '.html'}}">
{{ item.label }}
<a href="{{ '/' | relative_url }}">{{ 'Home' }}</a>
</span>
{% endunless %}
{% elsif forloop.last %}
<span>{{ page.title }}</span>
{% else %}
<span>
{% assign url = item %}
{% if item == 'posts' and page.layout == 'post' %}
{% assign url = '/' %}
{% endif %}
<a href="{{ url | relative_url }}">
{{ item | capitalize }}
</a>
</span>
{% else %}
<span>{{ item.label }}</span>
{% endif %}
{% endfor %}
{% unless page.layout == "home" %}
<span>{{ page.title }}</span>
{% endunless %}
{% endif %}
</span><!-- endof #breadcrumb -->
@@ -31,7 +49,7 @@
<div id="topbar-title">
{% if page.layout == 'home' %}
{{- site.title -}}
{% elsif page.collection == 'tabs' %}
{% elsif page.dynamic_title %}
{{- page.title -}}
{% else %}
{{- page.layout | capitalize -}}
@@ -42,7 +60,7 @@
<span id="search-wrapper" class="align-items-center">
<i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search"
aria-label="search" placeholder="{{ site.data.label.search_hint }}...">
aria-label="search" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span>
<span id="search-cancel" >Cancel</span>

View File

@@ -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 %}
@@ -15,7 +11,7 @@
{% assign size = tag | last | size %}
{% assign size_list = size_list | push: size %}
{% assign tag_str = tag | first | replace: " ", "-" | append: "::" | append: size %}
{% assign tag_str = tag | first | append: "::" | append: size %}
{% assign tag_list = tag_list | push: tag_str %}
{% endfor %}

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 %}

36
_layouts/archives.html Normal file
View File

@@ -0,0 +1,36 @@
---
layout: page
# The Archives of posts.
---
<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 %}
{% if forloop.first %}
{% assign last_day = "" %}
{% assign last_month = "" %}
<span class="lead">{{this_year}}</span>
<ul class="list-unstyled">
{% endif %}
<li>
<div>
{% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %}
{% capture this_month %}{{ post.date | date: "%b" }}{% endcapture %}
<span class="date day">{{ this_day }}</span>
<span class="date month small text-muted">{{ this_month }}</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div>
</li>
{% if forloop.last %}
</ul>
{% elsif this_year != pre_year %}
</ul>
<span class="lead">{{pre_year}}</span>
<ul class="list-unstyled">
{% assign last_day = "" %}
{% assign last_month = "" %}
{% endif %}
{% endfor %}
</div>

100
_layouts/categories.html Normal file
View File

@@ -0,0 +1,100 @@
---
layout: page
# All the Categories of posts
---
{% assign HEAD_PREFIX = "h_" %}
{% assign LIST_PREFIX = "l_" %}
{% assign group_index = 0 %}
{% assign sort_categories = site.categories | sort %}
{% for category in sort_categories %}
{% assign category_name = category | first %}
{% assign posts_of_category = category | last %}
{% assign first_post = posts_of_category | first %}
{% if category_name == first_post.categories[0] %}
{% assign sub_categories = "" | split: "" %}
{% for post in posts_of_category %}
{% assign second_category = post.categories[1] %}
{% if second_category %}
{% unless sub_categories contains second_category %}
{% assign sub_categories = sub_categories | push: second_category %}
{% endunless %}
{% endif %}
{% endfor %}
{% assign sub_categories = sub_categories | sort %}
{% assign sub_categories_size = sub_categories | size %}
<div class="card categories">
<!-- top-category -->
<div class="card-header d-flex justify-content-between hide-border-bottom"
id="{{ HEAD_PREFIX }}{{ group_index }}">
<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>
<!-- 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 %},
{% endif %}
{{ top_posts_size }}
post{% if top_posts_size > 1 %}s{% endif %}
</span>
</span>
<!-- arrow -->
{% if sub_categories_size > 0%}
<a href="#{{ LIST_PREFIX }}{{ group_index }}" data-toggle="collapse"
aria-expanded="true" aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
class="category-trigger hide-border-bottom">
<i class="fas fa-fw fa-angle-down"></i>
</a>
{% else %}
<span data-toggle="collapse" class="category-trigger hide-border-bottom disabled">
<i class="fas fa-fw fa-angle-right"></i>
</span>
{% endif %}
</div> <!-- .card-header -->
<!-- Sub-categories -->
{% if sub_categories_size > 0 %}
<div id="{{ LIST_PREFIX }}{{ group_index }}" class="collapse show" aria-expanded="true">
<ul class="list-group">
{% 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>
{% 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>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div> <!-- .card -->
{% assign group_index = group_index | plus: 1 %}
{% endif %}
{% 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_long_df = site.data.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_long_df }}</span>
</li>
{% endfor %}
</ul>

View File

@@ -1,35 +1,23 @@
---
layout: compress
# Default layout
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT Licensed
---
<!DOCTYPE html>
{% if site.lang %}
{% assign lang = site.lang | split: "_" | first %}
{% else %}
{% assign lang = 'en' %}
{% endif %}
{% capture prefer_mode %}
{% if site.theme_mode != "dual" %}
{% if site.theme_mode %}
mode="{{ site.theme_mode }}"
{% endif %}
{% endcapture %}
<html lang="{{ lang }}" {{ prefer_mode }} >
<html lang="{{ site.lang | default: "en-US" }}" {{ prefer_mode }}>
{% include head.html %}
<body data-spy="scroll" data-target="#toc">
<div id="sidebar" class="d-flex flex-column">
{% include sidebar.html %}
</div>
{% include topbar.html %}
@@ -46,6 +34,10 @@ layout: compress
</div> <!-- #main-wrapper -->
{% if page.mermaid %}
{% include mermaid.html %}
{% endif %}
<div id="mask"></div>
<a id="back-to-top" href="#" aria-label="back-to-top" class="btn btn-lg btn-box-shadow" role="button">
@@ -54,10 +46,6 @@ layout: compress
{% include search-loader.html %}
{% if site.google_analytics.id and jekyll.environment == 'production' %}
{% include google-analytics.html %}
{% endif %}
</body>
</html>

View File

@@ -1,10 +1,6 @@
---
layout: page
# The Home page layout
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT Licensed
---
@@ -49,13 +45,10 @@ layout: page
{% for post in posts %}
<div class="post-preview">
<div class="d-flex justify-content-between pr-xl-2">
<h1><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h1>
{% if post.pin == true %}
<i class="fas fa-thumbtack fa-fw text-muted mt-1 ml-2 mt-xl-2" data-toggle="tooltip" data-placement="left"
title="Pinned"></i>
{% endif %}
</div>
<h1>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</h1>
<div class="post-content">
<p>
{% include no-linenos.html content=post.content %}
@@ -63,11 +56,17 @@ layout: page
</p>
</div>
<div class="post-meta text-muted">
<div class="post-meta text-muted d-flex justify-content-between">
<div>
<!-- posted date -->
<i class="far fa-clock fa-fw"></i>
<i class="far fa-calendar fa-fw"></i>
{% include timeago.html date=post.date tooltip=true %}
<!-- time to read -->
<i class="far fa-clock fa-fw"></i>
{% include read-time.html content=post.content %}
<!-- page views -->
{% if site.google_analytics.pv.enabled %}
<i class="far fa-eye fa-fw"></i>
@@ -76,6 +75,16 @@ layout: page
</span>
{% endif %}
</div>
{% if post.pin %}
<div class="pin">
<i class="fas fa-thumbtack fa-fw"></i>
<span>{{ site.data.label.pin_prompt | default: 'Pinned' }}</span>
</div>
{% endif %}
</div> <!-- .post-meta -->
</div> <!-- .post-review -->
{% endfor %}

View File

@@ -1,10 +1,6 @@
---
layout: default
# The page layout
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT License
---
<div class="row">

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,52 +14,41 @@ layout: default
<div class="post-meta text-muted d-flex flex-column">
<!-- Published date and author -->
<div>
Posted
{% include timeago.html date=page.date tooltip=true %}
by
<span class="author">
{% if page.author %}
{{ page.author }}
{% else %}
{{ site.author }}
{% endif %}
<span class="semi-bold">
{{ page.author | default: site.social.name }}
</span>
{% include timeago.html date=page.date prep="on" tooltip=true %}
</div>
<div>
<!-- lastmod -->
{% if page.last_modified_at %}
<div>
Updated
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
</div>
<span>
{% include timeago.html date=page.last_modified_at
class="lastmod" prefix="Updated" tooltip=true %}
</span>
{% endif %}
<!-- read time -->
{% include read-time.html content=content %}
<!-- page views -->
{% if site.google_analytics.pv.enabled %}
<div>
<span id="pv" class="pageviews"><i class="fas fa-spinner fa-spin fa-fw"></i></span>
views
</div>
{% endif %}
</div>
</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="post-preview-img">
{% if page.image.src %}
<img src="{{ page.image.src }}" class="preview-img" alt="{{ page.image.alt | default: "Preview Image" }}">
{% 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 %}
</div>
<div class="post-tail-wrapper text-muted">
@@ -73,7 +58,7 @@ layout: default
<div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw mr-1"></i>
{% for category in page.categories %}
<a href='{{ site.baseurl }}/categories/{{ category | replace: ' ', '-' | downcase | url_encode }}/'>{{ category }}</a>
<a href='{{ site.baseurl }}/categories/{{ category | slugify | url_encode }}/'>{{ category }}</a>
{%- unless forloop.last -%}, {%- endunless -%}
{% endfor %}
</div>
@@ -84,7 +69,7 @@ layout: default
<div class="post-tags">
<i class="fa fa-tags fa-fw mr-1"></i>
{% for tag in page.tags %}
<a href="{{ site.baseurl }}/tags/{{ tag | replace: ' ', '-' | downcase | url_encode }}/"
<a href="{{ site.baseurl }}/tags/{{ tag | slugify | url_encode }}/"
class="post-tag no-text-decoration" >
{{- tag -}}
</a>
@@ -113,7 +98,15 @@ layout: default
</div> <!-- #post-wrapper -->
{% include panel.html %}
{% assign enable_toc = false %}
{% if site.toc and page.toc %}
{% if content contains '<h2' or content contains '<h3' %}
{% assign enable_toc = true %}
{% endif %}
{% endif %}
{% include panel.html toc=enable_toc %}
</div> <!-- .row -->
@@ -134,5 +127,3 @@ layout: default
</div> <!-- .col-* -->
</div> <!-- .row -->
{% include lozad.html %}

View File

@@ -1,12 +1,9 @@
---
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">
<h1 class="pl-lg-2">
<i class="fa fa-tag fa-fw text-muted"></i>
@@ -14,11 +11,13 @@ layout: page
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
</h1>
<ul class="post-content pl-0">
{% assign post_long_df = site.data.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_long_df }}</span>
</li>
{% endfor %}
</ul>

21
_layouts/tags.html Normal file
View File

@@ -0,0 +1,21 @@
---
layout: page
# All the Tags of posts.
---
<div id="tags" class="d-flex flex-wrap ml-xl-2 mr-xl-2">
{% assign tags = "" | split: "" %}
{% for t in site.tags %}
{% assign tags = tags | push: t[0] %}
{% endfor %}
{% assign sorted_tags = tags | sort_natural %}
{% for t in sorted_tags %}
<div>
<a class="tag" href="{{ site.baseurl }}/tags/{{ t | slugify | url_encode }}/">{{ t }}<span class="text-muted">{{ site.tags[t].size }}</span></a>
</div>
{% endfor %}
</div>

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

@@ -5,25 +5,25 @@ date: 2019-08-08 11:33:00 +0800
categories: [Blogging, Demo]
tags: [typography]
math: true
image: /assets/img/sample/devices-mockup.png
mermaid: true
image:
src: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
---
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
## Titles
---
# H1 - heading
# H1
<h2 data-toc-skip>H2 - heading</h2>
<h2 data-toc-skip>H2</h2>
<h3 data-toc-skip>H3</h3>
<h4>H4</h4>
<h3 data-toc-skip>H3 - heading</h3>
<h4>H4 - heading</h4>
---
<br>
## Paragraph
@@ -39,21 +39,38 @@ Beside the lake, beneath the trees,
Fluttering and dancing in the breeze.
## List
## Lists
### Ordered list
1. first item
2. second item
3. third item
1. Firstly
2. Secondly
3. Thirdly
### Unordered list
- item 1
- sub item 1
- sub item 2
- Chapter
- Setcion
- Paragraph
### Task list
- [ ] TODO
- [x] Completed
- Hold on
- [ ] Defeat COVID-19
- [x] Vaccine production
- [ ] Economic recovery
- [ ] People smile again
### Description list
Sun
: the star around which the earth orbits
Moon
: the natural satellite of the earth, visible by reflected light from the sun
- item 2
## Block Quote
@@ -61,53 +78,68 @@ Fluttering and dancing in the breeze.
## Tables
| Company | contact | Country |
| Company | Contact | Country |
|:-----------------------------|:-----------------|--------:|
| Alfreds Futterkiste | Maria Anders | Germany |
| Island Trading | Helen Bennett | UK |
| Magazzini Alimentari Riuniti | Giovanni Rovelli | Italy |
## Link
## Links
<http://127.0.0.1:4000>
## Footnote
Click the hook will locate the footnote[^footnote].
Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2].
## Images
By default, the image is centered and the image caption can be displayed at the bottom:
- Default (with caption)
![Desktop View](/assets/img/sample/mockup.png)
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png)
_Full screen width and center alignment_
You can change the size of the picture:
<br>
![Desktop View](/assets/img/sample/mockup.png){: width="400"}
- Specify width
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="400"}
_400px image width_
In addition, you can use class `normal` , `left` and `right` to specify the image position (but in these case, the image caption is prohibited), for example:
<br>
- Normal position
- Left aligned
![Desktop View](/assets/img/sample/mockup.png){: width="350" class="normal"}
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="350" .normal}
- Float to the left
<br>
![Desktop View](/assets/img/sample/mockup.png){: width="240" class="left"}
- Float to left
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="240" .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."
- Float to the right
<br>
![Desktop View](/assets/img/sample/mockup.png){: width="240" class="right"}
- Float to right
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="240" .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."
## Inline code
<br>
## Mermaid SVG
```mermaid
gantt
title Adding GANTT diagram functionality to mermaid
apple :a, 2017-07-20, 1w
banana :crit, b, 2017-07-23, 1d
cherry :active, c, after b a, 1d
```
This is an example of `Inline Code`.
## Mathematics
@@ -115,11 +147,17 @@ 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} $$
## Code Snippet
## Inline code
This is an example of `Inline Code`.
## Code block
### Common
@@ -132,14 +170,6 @@ This is a common code snippet, without syntax highlight and line number.
#### Console
```console
$ date
Sun Nov 3 15:11:12 CST 2019
```
#### Terminal
```terminal
$ env |grep SHELL
SHELL=/usr/local/bin/bash
PYENV_SHELL=bash
@@ -173,38 +203,18 @@ fi;
```
{% endraw %}
#### HTML
#### Java
```html
<div class="sidenav">
<a href="#contact">Contact</a>
<button class="dropdown-btn">Dropdown
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-container">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
<a href="#contact">Search</a>
</div>
```java
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
// Write out any hidden serialization magic
s.defaultWriteObject();
for (E e: map.keySet()) s.writeObject(e);
}
```
**Horizontal Scrolling**
```html
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading" id="{{ category_name }}">
<i class="far fa-folder"></i>
<p>This is a very long long long long long long long long long long long long long long long long long long long long long line.</p>
</a>
</div>
</div>
</div>
```
## Reverse Footnote
[^footnote]: The footnote source.
[^footnote]: The footnote source
[^fn-nth-2]: The 2nd footnote source

View File

@@ -8,7 +8,7 @@ tags: [writing]
## Naming and Path
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION` and put it in the `_post/` of the root directory. Please note that the `EXTENSION` must be one of `md` and `markdown`. From `v2.4.1`, you can create sub-directories under `_posts/` to categorize posts.
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION` and put it in the `_posts/` of the root directory. Please note that the `EXTENSION` must be one of `md` and `markdown`.
## Front Matter
@@ -68,16 +68,97 @@ math: true
---
```
## Preview Image
## Mermaid
If you want to add an image to the top of the post contents, specify the url for the image by:
[**Mermaid**](https://github.com/mermaid-js/mermaid) is a great diagrams generation tool. To enable it on your post, add the following to the YAML block:
```yml
---
mermaid: true
---
```
Then you can use it like other markdown language: surround the graph code with ```` ```mermaid ```` and ```` ``` ````.
## Images
### Preview image
If you want to add an image to the top of the post contents, specify the url and alt attribute for the image:
```yaml
---
image: /path/to/image-file
image:
src: /path/to/image/file
alt: image alternative text
---
```
### Image caption
Add italics to the next line of an imagethen it will become the caption and appear at the bottom of the image:
```markdown
![img-description](/path/to/image)
_Image Caption_
```
### Image size
You can specify the width (and height) of a image with `width`:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="400"}
```
### Image position
By default, the image is centered, but you can specify the position by using one of class `normal` , `left` and `right`. For example:
- **Normal position**
Image will be left aligned in below sample:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .normal}
```
- **Float to the left**
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .left}
```
- **Float to the right**
```markdown
![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.
### 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:
@@ -90,7 +171,7 @@ pin: true
## Code Block
Markdown symbols <code class="highlighter-rouge">```</code> can easily create a code block as following examples.
Markdown symbols ```` ``` ```` can easily create a code block as following examples.
```
This is a common code snippet, without syntax highlight and line number.
@@ -98,7 +179,7 @@ This is a common code snippet, without syntax highlight and line number.
## Specific Language
Using <code class="highlighter-rouge">```language</code> you will get code snippets with line numbers and syntax highlight.
Using ```` ```language ```` you will get code snippets with line numbers and syntax highlight.
> **Note**: The Jekyll style `{% raw %}{%{% endraw %} highlight LANGUAGE {% raw %}%}{% endraw %}` or `{% raw %}{%{% endraw %} highlight LANGUAGE linenos {% raw %}%}{% endraw %}` are not allowed to be used in this theme !

View File

@@ -7,51 +7,68 @@ 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`.
## 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** - Easy to update, isolate irrelevant project files so you can focus on writing.
- **Fork on GitHub** - Convenient for custom development, but difficult to update, only suitable for web developers.
### Installing the Theme Gem
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
Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
### Initialization
> **Hint**: To locate the installed themes gem, execute:
>
> ```console
> $ bundle info --path jekyll-theme-chirpy
> ```
Go to the root directory of the project and start initialization:
Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from theme's gem. We have prepared everything for you 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`
@@ -60,51 +77,60 @@ What it does is:
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
### 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:
- 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 repoistory 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) throught _Settings__Options__GitHub Pages_:
![gh-pages-sources](/assets/img/sample/gh-pages-sources.png){: width="650" class="normal"}
![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.
@@ -118,7 +144,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 +155,7 @@ $ docker run -it --rm \
```
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook

View File

@@ -11,11 +11,11 @@ In [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/), the image fi
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.
![upload-image](/assets/img/sample/upload-image.png)
![upload-image](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190811/upload-image.png)
Click button <kbd>Create Favicon</kbd> and wait a moment for the website to generate the icons of various sizes automatically.
![download-icons](/assets/img/sample/download-icons.png){: width="600"}
![download-icons](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190811/download-icons.png){: width="600"}
Download the generated package, unzip and delete the following two from the extracted files:

View File

@@ -0,0 +1,244 @@
---
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` disabled unless you have a good reason. If your website has low traffic, the page views count would discourage you to write more blogs. With that said, let's start with the setup.
## 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)
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 with your Google Analytics ID
pv:
# The Google Analytics pageviews switch.
enabled: false
# the next options only valid when `google_analytics.pv` is enabled.
proxy_url: ''
proxy_endpoint: ''
cache: false # pv data local cache, good for the users from GFW area.
```
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)
## 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)
### 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)
## 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)
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-XXXXXXXXXX' # Fill with your Google Analytics ID
pv:
# The Google Analytics pageviews switch.
enabled: true
# the next options only valid when `google_analytics.pv` is enabled.
proxy_url: 'https://PROJECT_ID.REGION_ID.r.appspot.com'
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
cache: false # pv data local cache, good for the users from GFW area.
```
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,10 +1,5 @@
/*
* 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 --------- */
@@ -17,6 +12,7 @@
%table-cell {
padding: 0.4rem 1rem;
font-size: 95%;
white-space: nowrap;
}
%link-hover {
@@ -38,6 +34,7 @@
}
%heading {
color: var(--heading-color);
font-weight: 400;
font-family: 'Lato', 'Microsoft Yahei', sans-serif;
}
@@ -64,7 +61,6 @@
color: $color;
transition: color 0.35s ease-in-out;
user-select: none;
margin: 0 0.25rem;
}
@mixin icon-round($diameter) {
@@ -96,11 +92,11 @@
color: $color;
font-size: $font-size;
font-weight: $font-weight;
font-family: 'Roboto Condensed', 'Microsoft Yahei', sans-serif;
}
@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] {
@@ -36,11 +32,11 @@ html[mode=dark] {
}
%code-snippet-radius {
border-radius: 5px;
border-radius: 6px;
}
%code-snippet-padding {
padding: 0.8rem 1rem;
padding: 1.5rem;
}
$code-font-size: 0.85rem;
@@ -56,6 +52,7 @@ div > pre {
@extend %code-snippet-radius;
color: var(--highlighter-rouge-color);
margin-top: 0.5rem;
margin-bottom: 1.2em; /* Override BS Inline-code style */
}
@@ -69,8 +66,8 @@ div > pre {
overflow: auto;
.lineno {
margin: 0.8rem 0;
padding: 0 0.5rem;
margin-left: 0.2rem;
padding-right: 0.5rem;
min-width: 2.2rem;
text-align: right;
color: var(--highlight-lineno-color);
@@ -111,7 +108,6 @@ code {
&.highlighter-rouge {
font-size: $code-font-size;
padding: 3px 5px;
margin: 0 0.15rem;
border-radius: 4px;
background-color: var(--inline-code-bg);
}
@@ -131,8 +127,16 @@ code {
}
td.rouge-code {
padding-left: 1rem;
padding-right: 1rem;
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 */
@@ -149,3 +153,26 @@ div {
}
}
}
div[class^='language-']::before {
content: attr(lang);
position: absolute;
right: 2rem;
margin-top: 3px;
font-size: 0.7rem;
font-weight: 600;
color: var(--highlight-lineno-color);
text-transform: uppercase;
}
@media (min-width: 768px) {
div[class^='language-']::before {
right: 3.1rem;
}
}
@media (min-width: 1650px) {
div[class^='language-']::before {
right: 3.5rem;
}
}

View File

@@ -1,15 +1,10 @@
/*
* Mainly scss variables
*
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
/* --- ↓ width and height ---- */
$tab-height: 3.3rem;
$tab-height: 3.2rem;
$tab-cursor-height: 1.6rem;
$sidebar-width-small: 210px;

View File

@@ -1,29 +1,25 @@
/*!
/*
* The syntax dark mode styles.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT Licensed
*/
@mixin dark-syntax {
/* ----- My styles ------ */
--highlight-bg-color: #272822;
--highlight-bg-color: #252525;
--highlighter-rouge-color: #de6b18;
--highlight-lineno-color: #6c6c6d;
--highlight-lineno-border-color: #3c4042;
--inline-code-bg: var(--highlight-bg-color);
--highlight-lineno-border-color: #303435;
--inline-code-bg: #272822;
.highlight {
.gp { color: #818c96; }
}
pre { color: #818c96; } /* override Bootstrap */
pre { color: #bfbfbf; } /* override Bootstrap */
kbd { background-color: black; }
/* syntax highlight colors from https://raw.githubusercontent.com/jwarby/pygments-css/master/monokai.css */
.highlight pre { background-color: #272822; }
.highlight .hll { background-color: #272822; }
.highlight pre { background-color: var(--highlight-bg-color); }
.highlight .hll { background-color: var(--highlight-bg-color); }
.highlight .c { color: #75715e; } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010; } /* Error */
.highlight .k { color: #66d9ef; } /* Keyword */
@@ -35,7 +31,7 @@
.highlight .cp { color: #75715e; } /* Comment.Preproc */
.highlight .c1 { color: #75715e; } /* Comment.Single */
.highlight .cs { color: #75715e; } /* Comment.Special */
.highlight .ge { font-style: italic; } /* Generic.Emph */
.highlight .ge { color: inherit; font-style: italic; } /* Generic.Emph */
.highlight .gs { font-weight: bold; } /* Generic.Strong */
.highlight .kc { color: #66d9ef; } /* Keyword.Constant */
.highlight .kd { color: #66d9ef; } /* Keyword.Declaration */

View File

@@ -1,9 +1,5 @@
/*!
/*
* The main dark mode styles
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT Licensed
*/
@mixin dark-scheme {
@@ -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);
@@ -32,6 +29,8 @@
--btn-box-shadow: var(--main-wrapper-bg);
--card-header-bg: rgb(51, 50, 50);
--label-color: rgb(108, 117, 125);
--checkbox-color: rgb(118 120 121);
--checkbox-checked-color: var(--link-color);
/* Sidebar */
--nav-cursor-color: rgb(183, 182, 182);
@@ -49,6 +48,8 @@
--btn-text-color: var(--text-color);
--btn-paginator-border-color: var(--btn-border-color);
--btn-paginator-shadow: var(--main-wrapper-bg);
--pin-bg: rgb(34 35 37);
--pin-color: inherit;
/* Posts */
--toc-highlight: rgb(116, 178, 243);

View File

@@ -1,9 +1,5 @@
/*!
/*
* The syntax light mode code snippet colors.
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
@mixin light-syntax {
@@ -72,7 +68,7 @@
/* --- custom light colors --- */
--highlight-bg-color: #f7f7f7;
--highlighter-rouge-color: #353a3d;
--highlighter-rouge-color: #505050;
--highlight-lineno-color: #c2c6cc;
--highlight-lineno-border-color: #e9ecef;
--inline-code-bg: #f3f3f3;

View File

@@ -1,9 +1,5 @@
/*!
/*
* The syntax light mode typography colors
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/
@mixin light-scheme {
@@ -13,7 +9,8 @@
--main-wrapper-bg: white;
--main-border-color: #f3f3f3;
--btn-border-color: #e9ecef;
--text-color: #333333;
--text-color: #4a4a4a;
--heading-color: black;
--blockquote-border-color: #eee;
--blockquote-text-color: #9a9a9a;
--link-color: #2a408e;
@@ -23,8 +20,10 @@
--tb-border-color: #eaeaea;
--button-bg: #fff;
--btn-backtotop-color: #686868;
--btn-backtotop-border-color: #f1f1f1; //--main-border-color,
--btn-backtotop-border-color: #f1f1f1;
--btn-box-shadow: #eaeaea;
--checkbox-color: #c5c5c5;
--checkbox-checked-color: #07a8f7;
/* Sidebar */
--sidebar-bg: radial-gradient(
@@ -50,12 +49,14 @@
--btn-text-color: #f8f8f8;
--btn-paginator-border-color: #f1f1f1;
--btn-paginator-shadow: #4b92d2;
--pin-bg: #f5f5f5;
--pin-color: #999fa4;
/* Posts */
--btn-share-hover-color: var(--link-color);
--card-border-color: #f1f1f1;
--card-box-shadow: rgba(234, 234, 234, 0.7686274509803922);
--label-color: #808080;
--label-color: #616161;
--relate-post-date: rgba(30, 55, 70, 0.4);
--tag-bg: rgba(0, 0, 0, 0.075);
--tag-border: #dee2e6;

View File

@@ -0,0 +1,23 @@
/*!
* The styles for Jekyll theme Chirpy
*
* Chirpy v3.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung
* MIT Licensed
*/
@import
"colors/light-typography",
"colors/dark-typography",
"addon/module",
"addon/variables",
"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: "";
@@ -19,43 +12,15 @@
background-color: var(--timeline-color);
}
%date-font {
font-family: 'Roboto Condensed', sans-serif;
}
#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;
@extend %date-font;
position: relative;
left: 8px;
&:not(:first-child) {
position: relative;
left: 4px;
&::after {
left: 67px;
}
}
&::after {
/* Year dot */
&::after { /* Year dot */
content: "";
display: block;
position: relative;
@@ -72,15 +37,71 @@
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;
&.month {
width: 1.4rem;
text-align: center;
@extend %date-font;
~ a::before {
/* A dot for Month and Day */
content: "";
@@ -110,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 {

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;
}
#page-category,
#page-tag,
#access-lastmod {
a:hover {
#page-category &,
#page-tag &,
#access-lastmod & {
@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,57 +1,6 @@
---
# Style for Homepage
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
{% include_relative _addon/main.scss %}
#post-list {
margin-top: 1rem;
padding-right: 0.5rem;
.post-preview {
padding-top: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--main-border-color);
h1 {
font-size: 1.4rem;
margin: 0;
~i { // pinned icon
font-size: 0.86rem;
}
}
.post-meta {
i {
font-size: 0.73rem;
&:not(:first-child) { // post-meta icons on the homepage
margin-left: 1.5rem;
}
}
}
.post-content {
margin-top: 0.6rem;
margin-bottom: 0.6rem;
color: var(--post-list-text-color);
>p {
/* Make preview shorter on the homepage */
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
} // .post-preview
} // #post-list
/*
Style for Homepage
*/
.pagination {
font-size: 1rem;
@@ -77,7 +26,7 @@
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
&:hover {
background-color: var(--btn-paginator-hover-color)
background-color: var(--btn-paginator-hover-color);
}
}
&.active {
@@ -107,12 +56,63 @@
} // .pagination
@media all and (max-width: 576px) {
#post-list .post-meta>span i:not(:first-child) {
margin-left: 1rem;
#post-list {
margin-top: 1rem;
padding-right: 0.5rem;
.post-preview {
padding-top: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--main-border-color);
a:hover {
@extend %link-hover;
}
h1 {
font-size: 1.4rem;
margin: 0;
}
.post-meta {
i {
font-size: 0.73rem;
}
span:not(:last-child) {
margin-right: 1.2rem;
}
}
.post-content {
margin-top: 0.6rem;
margin-bottom: 0.6rem;
color: var(--post-list-text-color);
> p {
/* Make preview shorter on the homepage */
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
.pin {
> i {
transform: rotate(45deg);
padding-left: 3px;
color: var(--pin-color);
}
> span {
display: none;
}
}
} // .post-preview
} // #post-list
/* Hide SideBar and TOC */
@media all and (max-width: 830px) {
.pagination {
@@ -125,6 +125,21 @@
#post-list {
margin-top: 1.5rem;
.post-preview .post-meta {
.pin {
background: var(--pin-bg);
border-radius: 5px;
line-height: 1.4rem;
height: 1.3rem;
margin-top: 3px;
padding-left: 1px;
padding-right: 6px;
> span {
display: inline;
}
}
}
}
.pagination {

View File

@@ -1,17 +1,6 @@
---
# 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 {
@@ -27,25 +16,39 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
border-color: var(--btn-border-color);
}
@mixin dot($pl: 0.2rem, $pr: 0.4rem) {
content: "\2022";
color: rgba(158, 158, 158, 0.8);
padding-left: $pl;
padding-right: $pr;
}
.timeago::before {
content: attr(prefix);
}
#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 {
> ol, > ul, > dl {
padding-left: 2rem;
li+li {
margin-top: 0.3rem;
}
}
li {
> ol, > ul, > dl { // sub list
padding-left: 2rem;
}
> p {
margin: 1rem 0 0.8rem;
}
}
.post-preview-img {
margin-top: 0;
margin-bottom: 2.5rem;
.preview-img {
@include align-center;
margin-top: 0;
margin-bottom: 2.5rem !important;
}
}
@@ -65,25 +68,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 {
@@ -93,29 +121,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 {
@@ -137,7 +142,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
position: sticky;
top: 4rem;
transition: top 0.2s ease-in-out;
animation: fade-up .8s;
animation: fade-up 0.8s;
&.topbar-down {
top: 6rem;
}
@@ -152,7 +157,6 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
padding-bottom: 0.5rem;
}
/* --- Related Posts --- */
#related-posts {
@@ -160,19 +164,19 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
@include label(1.1rem, 600);
}
.card {
border: 1px solid var(--card-border-color);
border-color: var(--card-border-color);
background-color: var(--card-bg);
box-shadow: 0 0 5px 0 var(--card-box-shadow);
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
h3 {
color: var(--text-color);
}
&:hover {
-webkit-transform: translate3d(0, -3px, 0);
transform: translate3d(0, -3px, 0);
box-shadow: 0 20px 35px -4px rgba(0, 0, 0, 0.15);
box-shadow: 0 10px 15px -4px rgba(0, 0, 0, 0.15);
}
}
@@ -229,6 +233,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
.share-wrapper {
vertical-align: middle;
user-select: none;
.share-icons {
font-size: 1.2rem;
a {
@@ -250,7 +255,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));
@@ -271,9 +276,9 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
} // .share-wrapper
.share-label {
@include label(inherit, 400, inherit);
&::after {
content: ":";
}
@@ -287,15 +292,12 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
@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;
@@ -305,23 +307,29 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
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 {
content: "\2022";
color: rgba(158, 158, 158, 0.8);
font-weight: bold;
padding-left: 0.5rem;
padding-right: 0.3rem;
@include dot(0.5rem, 0.2rem);
}
&.flex-column {
-webkit-box-orient: horizontal !important;
@@ -333,12 +341,6 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
} // .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

@@ -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
---

View File

@@ -1,42 +1,7 @@
---
layout: archives
title: Archives
icon: fas fa-archive
order: 3
# 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 %}
{% if forloop.first %}
{% assign last_day = "" %}
{% assign last_month = "" %}
<span class="lead">{{this_year}}</span>
<ul class="list-unstyled">
{% endif %}
<li>
<div>
{% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %}
{% capture this_month %}{{ post.date | date: "%b" }}{% endcapture %}
<span class="date day">{{ this_day }}</span>
<span class="date month small text-muted">{{ this_month }}</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div>
</li>
{% if forloop.last %}
</ul>
{% elsif this_year != pre_year %}
</ul>
<span class="lead">{{pre_year}}</span>
<ul class="list-unstyled">
{% assign last_day = "" %}
{% assign last_month = "" %}
{% endif %}
{% endfor %}
</div>

View File

@@ -1,106 +1,6 @@
---
layout: categories
title: Categories
icon: fas fa-stream
order: 1
# 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_" %}
{% assign group_index = 0 %}
{% assign sort_categories = site.categories | sort %}
{% for category in sort_categories %}
{% assign category_name = category | first %}
{% assign posts_of_category = category | last %}
{% assign first_post = posts_of_category | first %}
{% if category_name == first_post.categories[0] %}
{% assign sub_categories = "" | split: "" %}
{% for post in posts_of_category %}
{% assign second_category = post.categories[1] %}
{% if second_category %}
{% unless sub_categories contains second_category %}
{% assign sub_categories = sub_categories | push: second_category %}
{% endunless %}
{% endif %}
{% endfor %}
{% assign sub_categories = sub_categories | sort %}
{% assign sub_categories_size = sub_categories | size %}
<div class="card categories">
<!-- top-category -->
<div class="card-header d-flex justify-content-between hide-border-bottom"
id="{{ HEAD_PREFIX }}{{ group_index }}">
<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 | replace: ' ', '-' | downcase | url_encode }}/"
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 %},
{% endif %}
{{ top_posts_size }}
post{% if top_posts_size > 1 %}s{% endif %}
</span>
</span>
<!-- arrow -->
{% if sub_categories_size > 0%}
<a href="#{{ LIST_PREFIX }}{{ group_index }}" data-toggle="collapse"
aria-expanded="true" aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
class="category-trigger hide-border-bottom">
<i class="fas fa-fw fa-angle-down"></i>
</a>
{% else %}
<span data-toggle="collapse" class="category-trigger hide-border-bottom disabled">
<i class="fas fa-fw fa-angle-right"></i>
</span>
{% endif %}
</div> <!-- .card-header -->
<!-- Sub-categories -->
{% if sub_categories_size > 0 %}
<div id="{{ LIST_PREFIX }}{{ group_index }}" class="collapse show" aria-expanded="true">
<ul class="list-group">
{% 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 | replace: ' ', '-' | downcase | url_encode }}/"
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>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div> <!-- .card -->
{% assign group_index = group_index | plus: 1 %}
{% endif %}
{% endfor %}

View File

@@ -1,31 +1,6 @@
---
layout: tags
title: Tags
icon: fas fa-tags
order: 2
# All the Tags of posts.
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2017-2019 Cotes Chung
# MIT License
---
{% comment %}
'site.tags' looks like a Map, e.g. site.tags.MyTag.[ Post0, Post1, ... ]
Print the {{ site.tags }} will help you to understand it.
{% endcomment %}
<div id="tags" class="d-flex flex-wrap ml-xl-2 mr-xl-2">
{% assign tags = "" | split: "" %}
{% for t in site.tags %}
{% assign tags = tags | push: t[0] %}
{% endfor %}
{% assign sorted_tags = tags | sort_natural %}
{% for t in sorted_tags %}
<div>
<a class="tag" href="{{ site.baseurl }}/tags/{{ t | replace: ' ', '-' | downcase | url_encode }}/">{{ t }}<span class="text-muted">{{ site.tags[t].size }}</span></a>
</div>
{% endfor %}
</div>

4
app.js
View File

@@ -1,9 +1,5 @@
---
layout: compress
# Chirpy v2.2
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
---
/* Registering Service Worker */

View File

@@ -1,7 +0,0 @@
/*
* The field 'font-display' is added for Google-fonts.
*
* See: <https://fonts.google.com/>
*/
@import url('https://fonts.googleapis.com/css2?family=Lato&family=Roboto+Condensed:wght@400;700&family=Source+Sans+Pro:wght@400;600;700;900&display=swap');

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 %}

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

@@ -0,0 +1,7 @@
---
---
// see: /_sass/addon/commons.scss
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
@import "jekyll-theme-chirpy";

View File

@@ -2,10 +2,6 @@
layout: compress
# A part of the Favicons
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>

View File

@@ -2,10 +2,6 @@
layout: compress
#
# A part of the Favicons
# Chirpy v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
---
{% assign icon_url = "/assets/img/favicons" | relative_url %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -1,21 +0,0 @@
/*!
Aggregation of common JS.
Chirpy@2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT License
*/
{% include_relative _commons/back-to-top.js %}
{% include_relative _commons/search-display.js %}
{% include_relative _commons/sidebar.js %}
{% include_relative _commons/topbar-switch.js %}
{% include_relative _commons/topbar-title.js %}
{% include_relative _commons/copy-link.js %}
{% include_relative _utils/tooltip-loader.js %}

View File

@@ -1,18 +1,20 @@
/*
Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
*/
$(window).scroll(function() {
if ($(this).scrollTop() > 50
&& $("#sidebar-trigger").css("display") === "none") {
$(function() {
$(window).scroll(() => {
if ($(this).scrollTop() > 50 &&
$("#sidebar-trigger").css("display") === "none") {
$("#back-to-top").fadeIn();
} else {
$("#back-to-top").fadeOut();
}
});
$(function() {
$("#back-to-top").click(function() {
$("body,html").animate({scrollTop: 0}, 800);
$("#back-to-top").click(() => {
$("body,html").animate({
scrollTop: 0
}, 800);
return false;
});
});

View File

@@ -0,0 +1,12 @@
/*
* Create a more beautiful checkbox
*/
$(function() {
/* hide browser default checkbox */
$("input[type=checkbox]").addClass("unloaded");
/* create checked checkbox */
$("input[type=checkbox][checked]").before("<i class=\"fas fa-check-circle checked\"></i>");
/* create normal checkbox */
$("input[type=checkbox]:not([checked])").before("<i class=\"far fa-circle\"></i>");
});

View File

@@ -1,9 +1,5 @@
/*
* Copy current page url to clipboard.
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT License
*/
function copyLink(url) {
@@ -11,7 +7,7 @@ function copyLink(url) {
url = window.location.href;
}
var $temp = $("<input>");
const $temp = $("<input>");
$("body").append($temp);
$temp.val(url).select();
document.execCommand("copy");

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();

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