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

Compare commits

...

232 Commits

Author SHA1 Message Date
Cotes Chung
4c45f3788e Merge branch 'master' into production 2022-06-09 17:59:55 +08:00
Cotes Chung
baad801066 chore(release): 5.2.0 2022-06-09 17:59:27 +08:00
Cotes Chung
7f18cdc1fd build: fix the preview mode for release tool 2022-06-09 17:59:25 +08:00
Cotes Chung
fd0f983bbe chore: optimize the layout of main content and search input 2022-06-09 03:46:47 +08:00
Cotes Chung
35cadf969d perf(categories): support singular and plural forms of locale (#595)
resolves #595
2022-06-08 19:02:18 +08:00
Raymond Wright
cc6398c104 docs: fix typo in English locale file (#594) 2022-06-08 16:48:11 +08:00
Cotes Chung
5d6e8c5ef6 perf: improve the responsive design for ultrawide screens (#540)
Resolves #540
2022-06-08 16:15:38 +08:00
Cotes Chung
20caace68a fix(PWA): avoid repeated notification of SW update 2022-06-08 16:09:18 +08:00
Cotes Chung
ac1731d123 Merge branch 'feature/enhance-pwa' 2022-06-05 00:10:49 +08:00
Cotes Chung
106c981bac feat: add option to turn off PWA (#527) 2022-06-05 00:10:20 +08:00
Cotes Chung
d127183b97 feat(PWA): add Service Worker update notification 2022-06-04 23:54:06 +08:00
bibi2233
54124d5134 fix: assets URL is missing baseurl in self-hosted mode (#591) 2022-06-02 20:55:34 +08:00
Cotes Chung
76a1b6a068 fix(theme mode): SCSS syntax error (#588)
Fixes #588
2022-05-30 05:50:46 +08:00
Cotes Chung
91308ae567 refactor: decouple the Archives from 404 page (#576)
Resolves #576
2022-05-24 23:47:24 +08:00
Cotes Chung
12f1e6fe89 refactor(tags): avoid URL errors caused by improper site.baseurl settings
Resolves #580
2022-05-24 16:33:42 +08:00
Six Jonathan
94e81447af feat: add fr-FR support to locales (#582) 2022-05-24 16:31:50 +08:00
Cotes Chung
b7ad538ce2 Merge branch 'feature/improve-post-meta' 2022-04-26 05:05:15 +08:00
Cotes Chung
097bb23530 docs: add description for preview image 2022-04-26 04:55:38 +08:00
Cotes Chung
2bd6efa95a feat: support showing description of preview image
Also moved the image position to the metadata area
2022-04-26 04:55:38 +08:00
Cotes Chung
135a16f13e perf: avoid post pageviews from shifting while loading 2022-04-26 04:55:37 +08:00
Cotes Chung
6d35f5f8da perf: avoid the layout shift for post datetime 2022-04-26 04:55:37 +08:00
Cotes Chung
42c44a8bc1 refactor: simplify travis config 2022-04-17 17:02:32 +08:00
Cotes
138c537010 Merge pull request #541 from ZakKemble/fix-various
Fix various
2022-04-14 23:58:37 +08:00
Zak Kemble
59e955745f fix: spurious header closing tags
`right` already contains the closing tag
2022-04-14 16:50:13 +01:00
Zak Kemble
4f590e2bba fix: p is not allowed in span 2022-04-14 16:50:13 +01:00
Zak Kemble
6900d9f2bc fix: follow paginate_path config for pagination
Using "paginate_path: /page/:num/" to generate "/page/2/" paths would still generate invalid
pagination links to "/page2/"
2022-04-14 16:50:13 +01:00
Jayitha
30787fc4cf fix: horizontal scroll for long equations (#545) 2022-04-03 04:10:34 +08:00
Galen Rice
5402523ae5 fix: force checkout of gh-pages branch (#544)
When using the theme starter, which uses a git submodule,
assets loaded from that submodule are "untracked" files in the pages branch working tree.
The build can fail at this line due to Git, saying "the following untracked working tree files would be overwritten by checkout".

Adding `-f` forces the checkout, overwriting all files.
The other deploy steps then take over and rewrite the files as needed.
2022-04-02 19:22:48 +08:00
Cotes Chung
156c02a91a Merge branch 'feature/commitlint-config' 2022-04-02 19:21:52 +08:00
Cotes Chung
6ca66366d5 build(git-ignore): add missing item
When using the theme starter, which uses a git submodule,
assets loaded from that submodule are "untracked" files in the pages branch working tree.
The build can fail at this line due to Git, saying "the following untracked working tree files would be overwritten by checkout".

Adding `-f` forces the checkout, overwriting all files.
The other deploy steps then take over and rewrite the files as needed.
2022-04-02 19:18:32 +08:00
Cotes Chung
0740b857c6 build(deps): disables the rule body-max-line-length 2022-04-02 19:13:54 +08:00
Zak Kemble
58928dbc90 fix: alt is not a valid attribute for 'a' tag 2022-03-27 18:01:24 +01:00
Cotes Chung
0542b5149c fix: remove whitespace from avatar URL (#537)
Fix #537
2022-03-22 21:13:39 +08:00
Cotes Chung
e68108014a style: add indentation 2022-03-22 21:13:39 +08:00
Camilo Martínez Burgos
efe75adf27 feat: add es-ES support to locales (#533)
Using the already existing locales in the chirpy repository, I added a new locale file in Spanish.
2022-03-17 02:22:46 +08:00
Cotes Chung
3e64400246 Merge branch 'fix/seo-tag' 2022-03-17 02:11:47 +08:00
Cotes Chung
f581b4395f docs: update posts for author info 2022-03-17 02:05:45 +08:00
Cotes Chung
96a16c868e fix: correct the twitter:creator of Twitter summary card 2022-03-17 01:40:38 +08:00
Cotes Chung
67d51d5df2 docs: update preview image's font-matter 2022-03-16 22:51:41 +08:00
Cotes Chung
9cefe58993 fix: when the site.img_cdn is set to the local path, the preview-image path loses the baseurl 2022-03-16 22:17:19 +08:00
Cotes Chung
b8d1bcd3de fix: resume the preview image SEO tag (#529)
Fix #529
2022-03-16 22:17:19 +08:00
Cotes Chung
a60a4562bf Merge branch 'feature/global-npm-bin' 2022-03-13 18:02:52 +08:00
Cotes Chung
03e4f575ba build(npm, shell): use the global standard-version 2022-03-13 16:53:13 +08:00
Cotes Chung
b58cab1c07 docs: update contributing guidelines 2022-03-13 16:50:12 +08:00
Cotes Chung
da05d395fb build(npm): use the global commitlint & husky 2022-03-13 16:47:22 +08:00
Cotes Chung
f0a2e2f4e1 chore(gh-actions): resume the trigger branch 2022-03-12 22:29:15 +08:00
Cotes Chung
c57238975a docs: update bug report template 2022-03-12 22:27:39 +08:00
Paulo Freitas
c2c503f633 feat: add pt-BR support to locales 2022-03-07 16:12:53 +08:00
Cotes Chung
5607a1755a Merge branch 'feature/update-deps' 2022-03-05 00:09:22 +08:00
Cotes Chung
5a575613bb build: update required ruby version & docs uri 2022-03-04 23:58:13 +08:00
Cotes Chung
00ad357033 ci: update matrix environment 2022-03-04 23:58:13 +08:00
Zak Kemble
dd9d5a7207 fix: use jsonify to generate valid json (#521) 2022-03-03 21:49:05 +08:00
Cotes
d2bbcb791f Merge pull request #520 from ZakKemble/fix-script-location-and-url-encode 2022-03-03 21:06:48 +08:00
Zak Kemble
4c1c8d8b0e fix: correctly URL encode share links
Relates to #496
2022-03-03 12:55:27 +00:00
Zak Kemble
2103191b2f fix: script code should be in head or body, not in between 2022-03-03 12:54:44 +00:00
Cotes Chung
5d85ccb994 fix: table bypass refactoring when it contains IAL (#519)
Fix #519
2022-03-03 18:05:48 +08:00
Cotes Chung
7fef3fafec Merge branch 'feature/auto-versioning' 2022-03-03 03:11:08 +08:00
Cotes Chung
887859dd32 docs: update contributing guidelines 2022-03-03 02:46:28 +08:00
Cotes Chung
42fe8f5d21 build(shell): update release tool to work with standard-version 2022-03-03 02:46:28 +08:00
HigherOrderLogic
171463d76d Add Vietnamese locale (#517) 2022-03-02 02:16:31 +08:00
Cotes Chung
dd264e793c ci(gh-actions): add commitlint for PR 2022-03-01 23:26:07 +08:00
Cotes Chung
004ab6c56a build(deps): add commitlint, husky, and standard-version 2022-03-01 23:26:07 +08:00
Cotes Chung
3969b28743 Bump version to 5.1.0 2022-02-14 23:59:48 +08:00
Cotes Chung
5f31fbcf72 Enhance versioning tools 2022-02-14 23:59:17 +08:00
Cotes Chung
4986db1204 Improve SCSS comment symbols: change // to /* */ 2022-02-14 23:39:50 +08:00
Cotes Chung
508d3c5c6a Update docs 2022-02-14 22:15:38 +08:00
Cotes Chung
35e013f7fd Adapt the search input to Bootstrap 4.6 2022-02-14 22:15:38 +08:00
Cotes Chung
e52dc9551c Beautify heading style (margin, anchor) 2022-02-14 22:15:38 +08:00
Cotes Chung
5753118d8b Keep the original image shadow of the theme
Bootstrap 4.6.x has its own class `.shadow`
2022-02-14 21:41:50 +08:00
Cotes Chung
5295bbf4f9 Merge branch 'feature/expand-prompt' 2022-02-14 21:39:10 +08:00
Cotes Chung
cfd05d1aa5 Update prompt related docs 2022-02-14 20:14:39 +08:00
Cotes Chung
6c4d0e0def Rename prompt type note to info 2022-02-14 20:14:39 +08:00
Cotes Chung
15cfa84ddb Add tip type prompt 2022-02-13 03:08:57 +08:00
Cotes Chung
08a993be90 Bypass hidden posts in home page pagination (fix #504) 2022-02-12 06:10:21 +08:00
Cotes Chung
2b66ad0441 Update readme 2022-02-12 06:06:42 +08:00
Cotes Chung
0f6b170e24 Use constants to define resources for utterances
Self-host the JS for `utterances` is not necessary, because the list of comments cannot be loaded if the network is offline.
2022-02-12 05:47:48 +08:00
Cotes Chung
4df4f7f8db Add Giscus comments support (resolve #501) 2022-02-12 05:47:48 +08:00
Cotes Chung
09f1ded60c Merge branch 'feature/configurable-assets-cdn' 2022-02-10 04:14:03 +08:00
Cotes Chung
70e089c392 Add introduction to new features 2022-02-10 04:12:35 +08:00
Cotes Chung
dc42b6f800 Add assets submodule 2022-02-10 04:12:35 +08:00
Cotes Chung
3685685b28 Make the source of the static assets configurable
- Easy to switch between different CDN
- Allow self-host static assets
2022-02-10 04:12:35 +08:00
Cotes Chung
51688ccc9f Correct the branches that triggers gh-action 2022-02-04 06:47:03 +08:00
Cotes Chung
3db6de0abb Update project description 2022-02-04 06:23:09 +08:00
Cotes Chung
b27258899b Clear references to deleted folder docs 2022-02-04 06:23:09 +08:00
Cotes Chung
cfe9029cd1 Remove unused HTML attribute from sidebar 2022-02-04 06:23:09 +08:00
Cotes Chung
2c5e67f02b Improve the SW cache list 2022-02-04 06:23:09 +08:00
Cotes Chung
7a392510e6 Remove unused include from layouts 2022-02-03 01:04:42 +08:00
Cotes Chung
85fe258b20 Migrate the images from jsDelivr CDN to GitHub
jsDelivr does not allow caching of website images to their CDN!

see: <https://www.jsdelivr.com/terms/acceptable-use-policy-jsdelivr-net#2-hard-limits-and-restrictions>
2022-01-29 01:08:52 +08:00
Cotes Chung
55fd119d35 Fix hover color for links at the tail of posts 2022-01-28 23:48:46 +08:00
Cotes Chung
fc36f8b66d Improve the color of prompts 2022-01-28 23:48:46 +08:00
Cotes Chung
a5d38e7fbc Improve local datetime display
- Protect author's location privacy
- Reduce locale configuration parameters
2022-01-28 23:45:29 +08:00
Cotes Chung
a24545ed60 Prevent relative time conversion failure on Safari 2022-01-25 01:18:25 +08:00
Cotes Chung
66e655f09b Escape the post sharing URL (fix #496) 2022-01-23 05:11:14 +08:00
Cotes Chung
c3b2151ca0 Simplify the wiki 2022-01-23 04:30:54 +08:00
Cotes Chung
3d8184602b Merge branch 'feature/filepath-code' 2022-01-23 04:04:38 +08:00
Cotes Chung
c344926886 Show the filepath style in docs 2022-01-23 03:57:20 +08:00
Cotes Chung
756465d621 Add filepath style for code 2022-01-23 03:49:28 +08:00
Cotes Chung
7b0e9a6803 Merge branch 'feature/prompt-blockquote' 2022-01-23 02:00:48 +08:00
Cotes Chung
f043123f23 Introduce the prompts in docs 2022-01-23 01:59:36 +08:00
Cotes Chung
ca181422a6 Add blockquote prompts (resolve #489) 2022-01-23 01:59:36 +08:00
Cotes Chung
4845f6ef14 Fix attribute name of share URL button 2022-01-19 17:54:50 +08:00
Cotes Chung
031e878620 Travis: using the minimal environment when updating starter 2022-01-19 17:22:29 +08:00
Oaker Min
166c05bcd1 Update the telegram share URL of the post (#490)
Telegram API update
2022-01-19 01:36:00 +08:00
Cotes Chung
0890147423 Merge branch 'feature/docs' 2022-01-19 01:27:33 +08:00
Cotes Chung
323a888160 Update docs in real time 2022-01-19 00:30:55 +08:00
Cotes Chung
7788a140f2 Update prerequisites in tutorial (resolve #484) 2022-01-19 00:23:16 +08:00
Cotes Chung
1b379e3870 Improve chapter levels of guide 2022-01-19 00:23:16 +08:00
Cotes Chung
640bde95c4 Fix tutorial on writing posts 2022-01-19 00:23:16 +08:00
Roman Kvasnytskyi
1a93d5e557 Added russian and ukrainian translation and locales (#485) 2022-01-16 00:13:09 +08:00
Oaker Min
b8c3ea221e Added Burmese translation and locales (#483) 2022-01-15 17:59:39 +08:00
Tamme Schichler
4a2016a9e3 Don't include Google Analytics scripts without analytics id (#482) 2022-01-14 19:03:16 +08:00
Cotes Chung
a6c73e8f4f Avoid image caption shifting on load 2022-01-13 01:07:47 +08:00
Cotes Chung
f8f4dd889e Normalized attribute name in HTML
Add prefix `data-` for following attributes:
- `topbar-visible`
- `mode`
- `label-text`
- `title-succeed`
2022-01-13 00:23:08 +08:00
Cotes Chung
96e7cd79af Avoid whitespace before anchors when wrapping 2022-01-12 22:51:38 +08:00
Cotes Chung
22c12a4d34 Merge branch 'feature/improve-topabar-ux-on-mobile' 2022-01-09 19:12:50 +08:00
Cotes Chung
2cef631385 Hide topbar when mobile orientation in landscape mode (resolve #459) 2022-01-09 19:09:29 +08:00
Cotes Chung
9620eddd12 Simplify the top-bar title detect process 2022-01-08 02:57:16 +08:00
Cotes Chung
dbf86a2309 Merge branch 'hotfix/5.0.2' 2022-01-08 02:44:36 +08:00
Cotes Chung
2d02a6415d Bump version to 5.0.2 2022-01-08 02:44:19 +08:00
Cotes Chung
67bd6679b9 Update travis: deploy only when tagging
The bundler cache is also disabled because the tag name is always changing
2022-01-08 02:43:06 +08:00
Cotes Chung
f2a2792405 Fix responsive design of search hints 2022-01-08 02:28:10 +08:00
Cotes Chung
837d0778b6 Avoid preview-image delaying the switching of the top bar title (mobile views)
Use Intersection Observer API to optimize the performance of title switching
2022-01-08 02:28:10 +08:00
Cotes Chung
97ae2bf6c0 Update ReadMe 2022-01-08 01:19:49 +08:00
Cotes Chung
e7b377cf63 Prevent the top bar from covering the heading when scrolling down (in mobile views) 2022-01-06 21:46:08 +08:00
Cotes Chung
b0815b53c0 Enable smooth scrolling for layout page 2022-01-06 21:46:00 +08:00
Josh Johanning
4dd0c6d16f improve english locales for recently updated posts 2022-01-05 16:35:07 +08:00
Cotes Chung
57a76097d6 Merge branch 'hotfix/5.0.1' 2022-01-05 03:14:38 +08:00
Cotes Chung
22e2367b45 Bump version to 5.0.1 2022-01-05 03:11:24 +08:00
Cotes Chung
b44bf78f10 Improve the creation of header anchors (fix #474) 2022-01-05 02:36:07 +08:00
Cotes Chung
948356d7d6 Fix <img> HTML element refactoring issue (resolve #476, close #477) 2022-01-05 02:36:07 +08:00
Cotes Chung
7337fa5f20 Merge branch 'feature/docs' 2022-01-04 06:49:45 +08:00
Cotes Chung
44acea2f5d Add content to the contributing guidelines 2022-01-04 06:48:41 +08:00
Cotes Chung
65a38c8f22 Simplify the README 2022-01-04 05:20:31 +08:00
Cotes Chung
b91b6711b0 Update the tutorial on comments and image attributes 2022-01-04 02:20:58 +08:00
Cotes Chung
aeb2d57b60 Bump version to 5.0.0 2022-01-03 00:44:23 +08:00
Cotes Chung
2406ce1dc8 Merge branch 'feature/docs' 2022-01-03 00:42:16 +08:00
Cotes Chung
bec9246823 Fix preview image brightness in dark mode 2022-01-03 00:32:57 +08:00
Cotes Chung
adaefc02e9 Update docs 2022-01-03 00:17:30 +08:00
Cotes Chung
ee7266ff0d Update mockup image 2022-01-03 00:17:30 +08:00
Cotes Chung
cad62feb91 Beautify the style of <kbd> (resolve #471) 2022-01-02 16:28:42 +08:00
Cotes Chung
b85cb39388 Replace the demo website URL with a permalink 2022-01-02 16:17:32 +08:00
Cotes Chung
4360e2938c Avoid Disqus jitter 2021-12-31 20:49:00 +08:00
Cotes Chung
ecf31ff308 Fix the code style of SASS 2021-12-31 00:33:04 +08:00
Cotes Chung
37344ef0df Merge branch 'feature/post-img-path' 2021-12-31 00:09:58 +08:00
Cotes Chung
9e2a4fc8c9 Merge branch 'feature/simplify-html-struct' 2021-12-31 00:09:53 +08:00
Cotes Chung
fc71289dc8 Bypass Jekyll build on the gh-pages branch 2021-12-31 00:09:13 +08:00
Cotes Chung
c8fd0d728d Clean up the JS log when the post is scrolled(mobile views) 2021-12-31 00:09:09 +08:00
Cotes Chung
ef2aa525d5 Add intro for img_path 2021-12-31 00:00:28 +08:00
Cotes Chung
1fe0b2958b Add new variable img_path for posts 2021-12-31 00:00:28 +08:00
Cotes Chung
e466a643d5 Merge branch 'feature/multi-comments' 2021-12-30 23:08:09 +08:00
iwasaki501
f7ec9cd24a Bug Fix: Link in a heading is rendered as an anchor and becomes invisible unless it is hovered. (#469)
`<a>` tags in headings are set to apply the style of `%anchor` in `module.scss` and `common.scss`.
Therefore, if I put a link in a heading, the link will have the same style as the anchor,
which means that the font size becomes smaller and the link will not be displayed unless I hover the mouse over it.
My suggestion is to set an `anchor` class for the `<a>` tag of the anchor and apply style settings to the `anchor` class, not to the `a` tag.
2021-12-30 15:57:02 +08:00
Cotes Chung
3342abc9e6 Refactor the page layout 2021-12-30 00:38:32 +08:00
mirusu400
d47ec035d3 Add Korean locales (#467)
Add Korean translation
2021-12-26 14:53:32 +08:00
Cotes Chung
a403ffee42 Reduce style class for page layout 2021-12-13 21:09:32 +08:00
Cotes Chung
d315bf57e7 Integrate utterances comments 2021-12-13 04:40:05 +08:00
Cotes Chung
75176522e3 Prepare for multiple comment systems 2021-12-13 03:34:46 +08:00
Cotes Chung
ebb3dc940c Merge branch 'feature/refactor-theme-mode-switch' 2021-12-13 03:33:32 +08:00
Cotes Chung
c02c9c6a04 Decouple theme-mode toggle & mermaid 2021-12-13 03:33:01 +08:00
Cotes Chung
3a4316b29b Merge branch 'feature/fix-img-param-abbr' 2021-12-13 02:39:44 +08:00
Cotes Chung
f4b2dfe8b4 Fix the conversion of image width/height abbreviation 2021-12-12 00:38:49 +08:00
Cotes Chung
09e8eb4274 Make the preview image full screen width on mobile 2021-12-10 21:54:24 +08:00
Cotes Chung
5ca0966c41 Merge branch 'feature/improve-heading-ux' 2021-12-10 21:54:11 +08:00
Cotes Chung
d919f833f1 Show heading anchor on touch devices 2021-12-10 00:28:50 +08:00
Cotes Chung
df81012e28 Always close the top bar when smooth scrolling 2021-12-10 00:28:50 +08:00
Cotes Chung
09742d40dd Prevent the anchor of the heading from being awakened early 2021-12-09 18:52:02 +08:00
Cotes Chung
259d0deabc Merge branch 'feature/improve-audits' 2021-12-07 23:21:47 +08:00
Cotes Chung
cf6c8e9b3a Improve accessibility of panel heading elements 2021-12-07 23:09:00 +08:00
Cotes Chung
c64e587335 Improve SEO & accessibility on mode toggle element 2021-12-07 23:09:00 +08:00
Cotes Chung
415f11ecb8 Escape characters of post list (homepage and related posts)
To pass the html-proofer test
2021-12-07 16:40:19 +08:00
Cotes Chung
5dc830d11e Merge branch 'feature/add-heading-anchors' 2021-12-07 16:28:19 +08:00
Cotes Chung
7579644e8d Make the anchor scroll position more precise 2021-12-07 16:26:26 +08:00
Cotes Chung
4cff83268b Reduce refactor scope 2021-12-07 16:26:26 +08:00
Cotes Chung
1487ae5284 Add style for heading anchor 2021-12-07 16:26:26 +08:00
Cotes Chung
697c584b48 Merge branch 'feature/fix-pannel-toc' 2021-12-07 15:00:07 +08:00
Cotes Chung
089a19bc9e Merge branch 'feature/support-image-parameter-abbreviation' 2021-12-07 14:59:11 +08:00
Cotes Chung
007d242e87 Fix ToC incorrectly display the contents of the panel
Bug introduced in the commit `b518c9d`
2021-12-07 14:53:48 +08:00
Cotes Chung
6447ffaf59 Add new feature intro to docs 2021-12-07 01:04:13 +08:00
Cotes Chung
790cf30376 Add abbreviation support for image width/height 2021-12-07 01:04:13 +08:00
Cotes Chung
45adf4aac2 Create anchor for headings 2021-12-06 03:04:50 +08:00
Cotes Chung
b1377ac694 Improve heading font-size & layout 2021-12-05 23:44:04 +08:00
Cotes Chung
cf8dae9454 Merge branch 'feature/improve-meta-display'
# Conflicts:
#	_sass/addon/commons.scss
2021-12-05 17:46:14 +08:00
Cotes Chung
9f5e579596 Merge branch 'feature/use-default-scrollbar' 2021-12-05 16:42:43 +08:00
Cotes Chung
99e468cae5 Merge branch 'feature/improve-post-design' 2021-12-05 16:42:38 +08:00
Cotes Chung
4fde37e879 Merge branch 'feature/switch-funding' 2021-12-05 16:35:00 +08:00
Cotes Chung
19debc4add Switch donation method from BMC to Kofi 2021-12-05 16:29:46 +08:00
Cotes Chung
afcf0bde22 Refactor footer style 2021-12-05 04:42:53 +08:00
Cotes Chung
36f55f091d Add content to the tutorial 2021-12-05 04:42:53 +08:00
Cotes Chung
e2003f2b03 Add a link to the author of the post 2021-12-05 04:42:53 +08:00
Cotes Chung
563e8085e8 Redesign the post meta layout
- posted date
- updated date
- read time
- license statement of post bottom
- also refactor the `timeago.js`
2021-12-05 04:42:53 +08:00
Cotes Chung
902546cf4d Remove unused style for mode-toggle 2021-12-03 21:23:37 +08:00
Cotes Chung
e06d237eae Use the default scroll bar
And make the Chrome scroll bar on Windows support dark mode
2021-12-03 21:23:37 +08:00
Cotes Chung
6220d09ffb Replace the pageviews with categories on home page 2021-12-03 21:03:31 +08:00
Cotes Chung
3c91dc1f6f Move the preview image of the post to the top 2021-12-03 16:36:40 +08:00
Cotes Chung
6a65f3a7f7 New design for code snippet header 2021-12-03 16:34:26 +08:00
Cotes Chung
57feaa660e Upgrade uglify-js to v3.14.3 2021-12-02 23:33:39 +08:00
Cotes Chung
db9cfc270b Fix code style issue 2021-12-02 21:32:26 +08:00
Cotes Chung
3caacbee61 Improve mobile title display
Also fixed the 404 page title on mobile screens
2021-12-02 21:18:18 +08:00
Cotes Chung
b518c9d3bc Merge branch 'feature/refactor-layouts' 2021-12-02 05:54:56 +08:00
Cotes Chung
1c758cf4a2 Update related styles 2021-12-02 05:54:43 +08:00
Cotes Chung
df3a703988 Refactor HTML structure 2021-12-02 05:54:43 +08:00
Cotes Chung
12407bbfc0 Merge branch 'feature/hide-mouse-cursor' 2021-12-02 05:53:13 +08:00
Cotes Chung
55fce7574c Refactor theme mode toggle
- Improve mode switching JS execution priority
- Drop deprecated Web API
2021-12-02 05:51:30 +08:00
Cotes Chung
833b6c9d5c Hide the cursor of icons, images, and code snippets
Found on Windows with mouse
2021-12-02 05:51:30 +08:00
Cotes Chung
a34b77969f Simplify the style of <a> 2021-12-02 05:51:30 +08:00
Bhavy Khatri
707466b1df Accessibility Bug Fix: Tab focus doesn't reach Dark mode toggle button (#453) 2021-12-01 00:23:22 +08:00
Cotes Chung
602e98448d Merge branch 'hotfix/4.3.4' 2021-11-29 21:05:44 +08:00
Cotes Chung
0bf7a8f1d9 Bump version to 4.3.4 2021-11-29 21:03:53 +08:00
Cotes Chung
a7361717a6 Exclude NPM lock-file from output 2021-11-29 21:03:53 +08:00
Cotes Chung
e880448ba5 Fix code-language conversion (json, plaintext) 2021-11-29 21:03:53 +08:00
Cotes Chung
c28b6ce7d1 Fix markdown indentation 2021-11-29 21:03:53 +08:00
Cotes Chung
b7cc22983f Prevent multiple reserse-footnote from overlapping (fix #439) 2021-10-31 22:56:22 +08:00
Cotes Chung
a1551cd740 Merge branch 'feature/code-style' into develop 2021-10-26 04:31:31 +08:00
Cotes Chung
35c4d480ed Update Codacy badge of README 2021-10-26 04:29:16 +08:00
Cotes Chung
b5c26fed08 Fix SCSS code style 2021-10-26 04:29:16 +08:00
Cotes Chung
2dc2175723 Fix JS code style 2021-10-26 04:29:16 +08:00
Cotes Chung
2f79b8d408 Fix code style for Markdown 2021-10-26 04:29:16 +08:00
Cotes
cbe6c3fb7b Skip the Jekyll build on the source code 2021-10-23 03:34:19 +08:00
Cotes Chung
bb1188a01a Merge branch 'hotfix/4.3.3' 2021-10-20 06:29:03 +08:00
Cotes Chung
406ed520cb Bump version to 4.3.3 2021-10-20 06:28:49 +08:00
Cotes Chung
1d7a134dd5 Fix exclude list 2021-10-20 06:17:53 +08:00
Cotes Chung
421db9dc92 Merge branch 'hotfix/4.3.2' 2021-10-15 00:49:57 +08:00
Cotes Chung
a5b8e7862b Bump version to 4.3.2 2021-10-15 00:49:13 +08:00
Cotes Chung
30d3249782 Remove the host of the search result URLs 2021-10-15 00:49:13 +08:00
Cotes Chung
fa15aebbca Fix the failure of the init-tool with the —no-gh option (resolve #429) 2021-10-15 00:49:13 +08:00
Cotes Chung
565ad9229c Remove the value of img_cdn and avatar from the gem package 2021-10-15 00:49:13 +08:00
Cotes Chung
3d6304efd8 Build on the release branches to reuse the travis cache 2021-10-15 00:49:13 +08:00
Cotes Chung
80fd684577 Improve the issue templates 2021-10-04 18:04:15 +08:00
Cotes Chung
80980465d7 Correct grammar and spelling in docs & issue templates
Also improve the Markdown code style
2021-10-04 17:53:07 +08:00
Cotes Chung
2858a082a3 Merge branch 'hotfix/4.3.1' 2021-10-01 18:49:10 +08:00
Cotes Chung
9b0b7d7772 Bump version to 4.3.1 2021-10-01 18:48:42 +08:00
Cotes Chung
952b1f493b Fix contents in tutorials
- Correct the aspect ratio of the mockup image
- Delete code snippet space in docs
2021-10-01 18:39:02 +08:00
Cotes Chung
a887f1d57d Prevent the site test from failing when the avatar is not assigned (close #418)
Some rookies like to do this :(
2021-10-01 18:39:02 +08:00
125 changed files with 3708 additions and 2415 deletions

5
.commitlintrc.json Normal file
View File

@@ -0,0 +1,5 @@
{
"rules": {
"body-max-line-length": [0, "always"]
}
}

View File

@@ -1,16 +1,66 @@
# How to Contribute # How to Contribute
I want to thank you for sparing a time to improve this project! Here are some guidelines for contributing We'd like to thank you for sparing time to improve this project! Here are some guidelines for contributing
To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a [`Feature Request`](https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md) issue to discuss whether your idea fits the project. To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a [_Feature Request_](https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md) issue to discuss whether your idea fits the project.
## Basic Process
Generally, contribute to the project by: Generally, contribute to the project by:
1. Fork this project on GitHub and clone it locally. 1. Fork this project on GitHub and clone it locally.
2. Create a new branch from `master` and give it a descriptive name (e.g., `my-new-feature`, `fix-a-bug`). 2. Create a new branch from the default branch and give it a descriptive name (format: `feature/<add-new-feat>` / `fix/<fix-a-bug>`).
3. After completing the development, commit and push to remote. 3. After completing the development, submit a new _Pull Request_. Note that the commit message must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), otherwise it will fail the PR check.
4. Submit a new pull request.
## Modifying JavaScript
If your contribution involves JavaScript modification, please read the following sections.
### Inline Scripts
If you need to add comments to the inline JavaScript (the code between the HTML tags `<script>` and `</script>`), please use `/* */` instead of two slashes `//`. Because the HTML will be compressed by [jekyll-compress-html](https://github.com/penibelst/jekyll-compress-html) during deployment, but it cannot handle the `//` properly, which will disrupt the structure of the compressed HTML.
### External Scripts
If you need to add/change/delete the JavaScript in the directory `_javascript/`, setting up [`Node.js`](https://nodejs.org/) and [`npx`](https://www.npmjs.com/package/npx) is a requirement. And then install the development dependencies:
```console
$ npm i
```
During JavaScript development, real-time debugging can be performed through the following commands:
Firstly, start a Jekyll server:
```console
$ bash tools/run.sh
```
And then open a new terminal tab and run:
```console
# Type 'Ctrl + C' to stop
$ npx gulp dev
```
After debugging, run the command `npx gulp` (without any argument) will automatically output the compressed files to the directory `assets/js/dist/`.
## Verify the commit messages
If you want to make sure your commits pass the CI check, you can refer to the following steps.
Install `commitlint` & `husky`:
```console
$ npm i -g @commitlint/{cli,config-conventional} husky
```
And then enable `husky`:
```console
$ husky install
```
--- ---
:tada: Your volunteering will make the open source world more beautiful, thanks again! :tada: :tada: Your volunteering will make the open-source world more beautiful, thanks again! :tada:

5
.github/FUNDING.yml vendored
View File

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

View File

@@ -6,12 +6,15 @@ about: Create a report to help us improve
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) --> <!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
## Checklist ## Checklist
<!-- Please complete the following list of tasks, and then check it by change the "[ ]" to "[x]" -->
- [ ] I have read the [tutorials](https://chirpy.cotes.info/categories/tutorial/) and know the correct effect of the functional design. <!-- Please complete the following list of tasks, and then check it by changing the "[ ]" to "[x]" -->
- [ ] There are no similar reports on existing issues (including closed ones).
- [ ] I found the bug on the latest code of `master` branch. - [ ] I have read the [tutorials](https://cotes2020.github.io/chirpy-demo/categories/tutorial/) and know the correct effect of the functional design.
- [ ] There are no similar reports on [existing issues](https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue) (including closed ones).
- [ ] I found the bug on the latest code of the `master` branch.
## Describe the bug ## Describe the bug
<!-- A clear and concise description of what the bug is. --> <!-- A clear and concise description of what the bug is. -->
### To Reproduce ### To Reproduce
@@ -25,26 +28,32 @@ Steps to reproduce the behavior:
--> -->
### Expected behavior ### Expected behavior
<!-- A clear and concise description of what you expected to happen. --> <!-- A clear and concise description of what you expected to happen. -->
### Screenshots ### Screenshots
<!-- If applicable, add screenshots to help explain your problem. --> <!-- If applicable, add screenshots to help explain your problem. -->
### Software ### Environment
<!-- Please complete the following information -->
- Ruby version: <!-- by running: `ruby -v` --> | Command | Version |
- Gem version: <!-- by running: `gem -v`--> |-----------------------------------|---------|
- Bundler version: <!-- by running: `bundle -v`--> | `ruby -v` | |
- Jekyll version: <!-- by running: `bundle list | grep " jekyll "` --> | `gem -v` | |
- Theme version: <!-- by running: `gem list | grep jekyll-theme-chirpy` --> | `bundle -v` | |
| `bundle exec jekyll -v` | |
| `bundle info jekyll-theme-chirpy` | |
### Desktop ### Desktop
<!-- If necessary, uncomment and fill in the following list: <!-- If necessary, uncomment and fill in the following list:
- OS: [e.g. macOS 10.15.6] - OS: [e.g. macOS 10.15.6]
- Browser: [e.g. Chrome 85.0.4183.83 (64-bit)] - Browser: [e.g. Chrome 85.0.4183.83 (64-bit)]
--> -->
### Smartphone ### Smartphone
<!-- If necessary, uncomment and fill in the following list: <!-- If necessary, uncomment and fill in the following list:
- Device: [e.g. iPhone 6] - Device: [e.g. iPhone 6]
- OS: [e.g. iOS 13.6.1] - OS: [e.g. iOS 13.6.1]
@@ -52,4 +61,5 @@ Steps to reproduce the behavior:
--> -->
### Additional context ### Additional context
<!-- Add any other context about the problem here. --> <!-- Add any other context about the problem here. -->

View File

@@ -7,24 +7,29 @@ labels: enhancement
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) --> <!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
## Checklist ## Checklist
<!-- Please complete the following list of tasks, and then check it by change the "[ ]" to "[x]" -->
<!-- Please complete the following list of tasks, and then check it by changing the "[ ]" to "[x]" -->
- [ ] I have read the [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/CONTRIBUTING.md). - [ ] I have read the [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/CONTRIBUTING.md).
- [ ] There are no similar request on existing issues (including closed ones). - [ ] There is no similar request on [existing issues](https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue) (including closed ones).
- [ ] I have read the [project progress](https://github.com/cotes2020/jekyll-theme-chirpy/projects) and know the current progress of the project. - [ ] I have read the [project progress](https://github.com/cotes2020/jekyll-theme-chirpy/projects) and know the current progress of the project.
- [ ] I was in the `master` branch of the latest code. - [ ] I was in the `master` branch of the latest code.
## Is your feature request related to a problem? Please describe ## Is your feature request related to a problem? Please describe
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] --> <!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
## Describe the solution you'd like ## Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. --> <!-- A clear and concise description of what you want to happen. -->
## Describe alternatives you've considered ## Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. --> <!-- A clear and concise description of any alternative solutions or features you've considered. -->
## Additional context ## Additional context
<!-- Add any other context or screenshots about the feature request here. --> <!-- Add any other context or screenshots about the feature request here. -->

View File

@@ -1,6 +1,6 @@
--- ---
name: Question name: Question
about: Ask what ever you want about: Ask whatever you want
labels: question labels: question
--- ---
@@ -8,12 +8,13 @@ labels: question
## Checklist ## Checklist
<!-- Please complete the following list of tasks, and then check it by change the "[ ]" to "[x]" --> <!-- Please complete the following list of tasks, and then check it by changing the "[ ]" to "[x]" -->
- [ ] I have read the [tutorials](https://chirpy.cotes.info/categories/tutorial/) and know the correct effect of the functional design. - [ ] I have read the [newlest tutorials](https://cotes2020.github.io/chirpy-demo/categories/tutorial/) and know the correct effect of the functional design.
- [ ] There are no similar question on existing issues (including closed ones). - [ ] There is no similar question on [existing issues](https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue) (including closed ones).
- [ ] I searched the Internet for related problems, but still couldn't solve it. - [ ] I have tried to find the answer on [Jekyll Forum](https://talk.jekyllrb.com/) and [StackOverflow](https://stackoverflow.com/questions/tagged/jekyll).
- [ ] My question is based on the latest code of `master` branch. - [ ] My question is based on the latest code of the `master` branch.
## Description ## Description
<!-- Please describe your question in detail. --> <!-- Please describe your question in detail. -->

View File

@@ -29,16 +29,14 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- Browser type & version: - Browser type & version:
- Operating system: - Operating system:
- Bundler version: - Ruby version: <!-- by running: `ruby -v` -->
- Ruby version: - Bundler version: <!-- by running: `bundle -v`-->
- Jekyll version: - Jekyll version: <!-- by running: `bundle list | grep " jekyll "` -->
### Checklist ### Checklist
<!-- Select checkboxes by change the "[ ]" to "[x]" --> <!-- Select checkboxes by change the "[ ]" to "[x]" -->
- [ ] My code follows the [Google style guidelines](https://google.github.io/styleguide/) - [ ] I have performed a self-review of my code
- [ ] I have performed a self-review of my own code - [ ] I have commented on my code, particularly in hard-to-understand areas
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation - [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings - [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] Any dependent changes have been merged and published in downstream modules

View File

@@ -1,16 +1,16 @@
name: 'Continuous Integration' name: 'CI'
on: on:
push: push:
branches-ignore: branches-ignore:
- 'production' - 'release/**'
- 'docs'
tags-ignore: tags-ignore:
- '*' - '**'
paths-ignore: paths-ignore:
- '.github/**' - '.github/**'
- '!.github/workflows/ci.yml' - '!.github/workflows/ci.yml'
- '.travis.yml' - '.travis.yml'
- '.gitignore' - '.gitignore'
- 'docs/**'
- 'README.md' - 'README.md'
- 'LICENSE' - 'LICENSE'
pull_request: pull_request:
@@ -18,23 +18,20 @@ on:
- '**' - '**'
jobs: jobs:
ci: build:
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest] ruby: [2.5, 2.6, 2.7, 3]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 # for posts's lastmod fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby - name: Setup Ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: 2.7 ruby-version: ${{ matrix.ruby }}
bundler-cache: true bundler-cache: true
- name: Test Site - name: Test Site
run: bash tools/deploy.sh --dry-run run: bash tools/deploy.sh --dry-run

11
.github/workflows/commitlint.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
name: Lint Commit Messages
on: pull_request
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4

3
.gitignore vendored
View File

@@ -4,6 +4,9 @@
!.editorconfig !.editorconfig
!.nojekyll !.nojekyll
!.travis.yml !.travis.yml
!.husky
!.commitlintrc.json
!.versionrc.json
# bundler cache # bundler cache
_site _site

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "assets/lib"]
path = assets/lib
url = https://github.com/cotes2020/chirpy-static-assets.git

4
.husky/commit-msg Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no -- commitlint -x $(npm root -g)/@commitlint/config-conventional --edit

1
.nojekyll Normal file
View File

@@ -0,0 +1 @@

View File

@@ -1,40 +1,41 @@
os: linux os: linux
dist: bionic dist: bionic
language: ruby
rvm: 2.7.0
language: minimal addons:
apt:
packages:
- libcurl4-openssl-dev # to avoid SSL error (for htmlproofer)
if: tag =~ /^v(\d)+(\.(\d)+){2}$/ # Overriding to drop the `--development` flag which requires the Gemfile.lock at build
install: bundle install --jobs=3 --retry=3 --path=vendor/bundle
before_script: git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
jobs: jobs:
include: include:
- name: Deploy - stage: Upgrade
language: ruby
rvm: 2.7.0
addons:
apt:
packages:
# required to avoid SSL error (for htmlproofer)
- libcurl4-openssl-dev
cache:
directories:
- $TRAVIS_BUILD_DIR/vendor/bundle
before_install:
# match the Gemfile.lock, travis' bundler is 2.1.2
- gem install bundler:2.2.4
- bundle config path 'vendor/bundle'
install:
# overriding to drop the travis `--development` flag
- bundle install --jobs=3 --retry=3
script:
- eval "$BUILD_CMD"
git: git:
depth: false # for posts' lastmod depth: false # for posts' lastmod
script: eval "$BUILD_CMD"
- name: Flush Starter - stage: Starter
language: minimal
install: true # skip install step
script: eval "$FLUSH_STARTER" script: eval "$FLUSH_STARTER"
- stage: Docs
cache: bundler
git:
depth: false # for posts' lastmod
script: eval "$DOCS_CMD"
before_script: stages:
- git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q - name: Upgrade
if: branch = production
- name: Starter
if: branch = production
- name: Docs
if: branch = docs
notifications: notifications:
email: email:

20
.versionrc.json Normal file
View File

@@ -0,0 +1,20 @@
{
"skip": {
"commit": true,
"tag": true
},
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Improvements"
}
]
}

44
CHANGELOG.md Normal file
View File

@@ -0,0 +1,44 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [5.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.1.0...v5.2.0) (2022-06-09)
### Features
* add es-ES support to locales ([#533](https://github.com/cotes2020/jekyll-theme-chirpy/issues/533)) ([efe75ad](https://github.com/cotes2020/jekyll-theme-chirpy/commit/efe75adf2784956afb7a0b67f6634b146d9cb03b))
* add fr-FR support to locales ([#582](https://github.com/cotes2020/jekyll-theme-chirpy/issues/582)) ([94e8144](https://github.com/cotes2020/jekyll-theme-chirpy/commit/94e81447afa457b1a6b7e8f487c47502803556d7))
* add Vietnamese locale ([#517](https://github.com/cotes2020/jekyll-theme-chirpy/issues/517)) ([171463d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/171463d76da9b7bc25dd327b8f0a868ea79e388b))
* add pt-BR support to locales ([c2c503f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/c2c503f63336884282b6bda4ec0703d6ae76771b))
* add option to turn off PWA ([#527](https://github.com/cotes2020/jekyll-theme-chirpy/issues/527)) ([106c981](https://github.com/cotes2020/jekyll-theme-chirpy/commit/106c981bac71e7434204a77e1f0c9c61d6eb1509))
* **PWA:** add Service Worker update notification ([d127183](https://github.com/cotes2020/jekyll-theme-chirpy/commit/d127183b9774f6321e409acdb66bf8a85d8814be))
* support showing description of preview image ([2bd6efa](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2bd6efa95a174ac44e30a3af1e57e6f40d6e0e3a))
### Bug Fixes
* alt is not a valid attribute for 'a' tag ([58928db](https://github.com/cotes2020/jekyll-theme-chirpy/commit/58928dbc9068db4e4cda4371eeae1865920dce6a))
* assets URL is missing `baseurl` in self-hosted mode ([#591](https://github.com/cotes2020/jekyll-theme-chirpy/issues/591)) ([54124d5](https://github.com/cotes2020/jekyll-theme-chirpy/commit/54124d5134995fce52e4c2fc0a5d4d1743d6264d))
* correct the `twitter:creator` of Twitter summary card ([96a16c8](https://github.com/cotes2020/jekyll-theme-chirpy/commit/96a16c868ede51e7dfa412de63ffa1e5a49add7f))
* correctly URL encode share links ([4c1c8d8](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4c1c8d8b0eacecbbaa2d522bbdd6430f350ff760)), closes [#496](https://github.com/cotes2020/jekyll-theme-chirpy/issues/496)
* follow paginate_path config for pagination ([6900d9f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6900d9f2bc9380cbda4babf611c6eeff345291af))
* force checkout of `gh-pages` branch ([#544](https://github.com/cotes2020/jekyll-theme-chirpy/issues/544)) ([5402523](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5402523ae52a3740bcc15df0b226b2612644945d))
* horizontal scroll for long equations ([#545](https://github.com/cotes2020/jekyll-theme-chirpy/issues/545)) ([30787fc](https://github.com/cotes2020/jekyll-theme-chirpy/commit/30787fc4cf151e955bb7afc26dfd859f1a06fce6))
* p is not allowed in span ([4f590e2](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4f590e2bba0639751771211bc0d357828ae70404))
* remove whitespace from avatar URL ([#537](https://github.com/cotes2020/jekyll-theme-chirpy/issues/537)) ([0542b51](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0542b5149c8287dca60e37f46ee36f31b43455e4))
* resume the preview image SEO tag ([#529](https://github.com/cotes2020/jekyll-theme-chirpy/issues/529)) ([b8d1bcd](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b8d1bcd3dea0abd1afef7ef154a4501fbb18938d))
* script code should be in head or body, not in between ([2103191](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2103191b2faf714a8e4418c7c347a1f942b51af8))
* spurious header closing tags ([59e9557](https://github.com/cotes2020/jekyll-theme-chirpy/commit/59e955745f02f9b57c65af70b0979cd4a98bf53f))
* table bypass refactoring when it contains IAL ([#519](https://github.com/cotes2020/jekyll-theme-chirpy/issues/519)) ([5d85ccb](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5d85ccb9943aac88dbbefebe1c2234cdcbae5c53))
* **theme mode:** `SCSS` syntax error ([#588](https://github.com/cotes2020/jekyll-theme-chirpy/issues/588)) ([76a1b6a](https://github.com/cotes2020/jekyll-theme-chirpy/commit/76a1b6a068c369138422dcd18ba08ec8cc3749a6))
* use `jsonify` to generate valid json ([#521](https://github.com/cotes2020/jekyll-theme-chirpy/issues/521)) ([dd9d5a7](https://github.com/cotes2020/jekyll-theme-chirpy/commit/dd9d5a7207b746342d07176d8969dc4f2c380bf2))
* when the `site.img_cdn` is set to the local path, the preview-image path loses the `baseurl` ([9cefe58](https://github.com/cotes2020/jekyll-theme-chirpy/commit/9cefe58993d9ea3a3a28424e7ffd8e0911567c5c))
### Improvements
* avoid post pageviews from shifting while loading ([135a16f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/135a16f13ee783d9308669ff9a824847a73c951c))
* avoid the layout shift for post datetime ([6d35f5f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6d35f5f8da044cfad071628bb53776de03efaae4))
* **categories:** support singular and plural forms of locale ([#595](https://github.com/cotes2020/jekyll-theme-chirpy/issues/595)) ([35cadf9](https://github.com/cotes2020/jekyll-theme-chirpy/commit/35cadf969dd0161ee62503e242c545f006f7072b))
* improve the responsive design for ultrawide screens ([#540](https://github.com/cotes2020/jekyll-theme-chirpy/issues/540)) ([5d6e8c5](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5d6e8c5ef6aa71b4d2600c5305f6e8ba540557f7))

190
README.md
View File

@@ -1,124 +1,66 @@
<div align="right">
EN /
[中文(简体)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md)
</div>
<div align="center"> <div align="center">
# Chirpy Jekyll Theme # Chirpy Jekyll Theme
A minimal, responsive, and powerful Jekyll theme for presenting professional writing.
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy) [![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) [![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) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)](https://www.codacy.com/gh/cotes2020/jekyll-theme-chirpy/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=cotes2020/jekyll-theme-chirpy&amp;utm_campaign=Badge_Grade)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
A minimal, responsive, and powerful Jekyll theme for presenting professional writing. [**Live Demo →**](https://cotes2020.github.io/chirpy-demo)
**[Live Demo →](https://chirpy.cotes.info)** [![Devices Mockup](https://raw.githubusercontent.com/cotes2020/chirpy-images/main/commons/devices-mockup.png)](https://cotes2020.github.io/chirpy-demo)
[![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images@0a003683c0c3ca549d12c309f9b3e03ea20981e5/commons/devices-mockup.png)](https://chirpy.cotes.info)
</div> </div>
## Features ## Features
- Localized Layout - Localized Layout
- Configurable Theme Mode - Dark/Light Theme Mode
- Pinned Posts - Pinned Posts
- Hierarchical Categories - Hierarchical Categories
- Last Modified Date for Posts - Last Modified Date for Posts
- Table of Contents - Table of Contents
- Automatically Recommend Related Posts - Auto-generated Related Posts
- Syntax Highlighting - Syntax Highlighting
- Mathematical Expressions - Mathematical Expressions
- Mermaid Diagram & Flowchart - Mermaid Diagram & Flowchart
- Disqus/Utterances/Giscus Comments
- Search - Search
- Atom Feeds - Atom Feeds
- Disqus Comments
- Google Analytics - Google Analytics
- GA Pageviews Reporting (Advanced) - GA Pageviews Reporting
- SEO & Performance Optimization - SEO & Performance Optimization
## Prerequisites
Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`. ## Quick Start
## Installation Before starting, please follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`. In addition, [Git](https://git-scm.com/) is also required to be installed.
### Creating a New Site ### Step 1. Creating a New Site
There are two ways to create a new repository for this theme: Create a new repository from the [**Chirpy Starter**](https://github.com/cotes2020/chirpy-starter/generate) and name it `<GH_USERNAME>.github.io`, where `GH_USERNAME` represents your GitHub username.
- **[Using the Chirpy Starter](#option-1-using-the-chirpy-starter)** - Easy to upgrade, isolates irrelevant project files so you can focus on writing. ### Step 2. Installing Dependencies
- **[Forking on GitHub](#option-2-forking-on-github)** - Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended. Before running for the first time, go to the root directory of your site, and install dependencies as follows:
#### Option 1. Using the Chirpy Starter
Create a new repository from the [**Chirpy Starter**][use-starter] and name it `<GH_USERNAME>.github.io`, where `GH_USERNAME` represents your GitHub username.
#### Option 2. Forking on GitHub
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub and rename it to `<GH_USERNAME>.github.io`. Please note that the default branch code is in development. If you want the site to be stable, please switch to the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags) and start writing.
And then execute:
```console
$ bash tools/init.sh
```
> **Note**: If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command.
The above command will:
1. Removes some files or directories from your repository:
- `.travis.yml`
- files under `_posts`
- folder `docs`
2. If the option `--no-gh` is provided, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`.
3. Removes item `Gemfile.lock` from `.gitignore`.
4. Creates a new commit to save the changes automatically.
### Installing Dependencies
Before running for the first time, go the root directory of your site, and install dependencies as follows:
```console ```console
$ bundle $ bundle
``` ```
## Usage ### Step 3. Running Local Server
### Configuration Run the following command in the root directory of the site:
Update the variables of `_config.yml` as needed. Some of them are typical options:
- `url`
- `avatar`
- `timezone`
- `lang`
### Customing Stylesheet
If you need to customize stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file.
Starting from [`v4.1.0`][chirpy-4.1.0], if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it.
### Running Local Server
You may want to preview the site contents before publishing, so just run it by:
```console ```console
$ bundle exec jekyll s $ bundle exec jekyll s
``` ```
Or run the site on Docker with the following command: Or run with Docker:
```console ```console
$ docker run -it --rm \ $ docker run -it --rm \
@@ -127,106 +69,29 @@ $ docker run -it --rm \
jekyll serve jekyll serve
``` ```
After a while, the local service will be published at _<http://127.0.0.1:4000>_. After a while, navigate to the site at <http://localhost:4000>.
### Deployment
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
Now you can choose ONE of the following methods to deploy your Jekyll site.
#### Deploy by Using Github Actions
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 GitHub Pages service.
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 [sample 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/deploy.sh`. Otherwise, copy it from here to your Jekyll site.
- Furthermore, if you have committed `Gemfile.lock` to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lockfile:
```console
$ bundle lock --add-platform x86_64-linux
```
After the above steps, rename your repository to `<GH_USERNAME>.github.io` on GitHub.
Now publish your Jekyll site by:
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
2. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar, and then in the section **Source** of _GitHub Pages_, select the `/(root)` directory of branch `gh-pages` as the [publishing source][pages-src]. Remember to click <kbd>Save</kbd> before leaving.
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images@0a003683c0c3ca549d12c309f9b3e03ea20981e5/posts/20190809/gh-pages-sources.png)
3. Visit your website at the address indicated by GitHub.
#### Manually Build and Deploy
On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server.
Go to the root of the source project, and build your site as follows:
```console
$ JEKYLL_ENV=production bundle exec jekyll b
```
Or build the site on Docker:
```console
$ docker run -it --rm \
--env JEKYLL_ENV=production \
--volume="$PWD:/srv/jekyll" \
jekyll/jekyll \
jekyll build
```
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 the target server.
### Upgrading
It depends on how you use the theme:
- If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`), editing the `Gemfile` and update the version number of the them gem, for example:
```diff
- gem "jekyll-theme-chirpy", "~> 3.2", ">= 3.2.1"
+ gem "jekyll-theme-chirpy", "~> 3.3", ">= 3.3.0"
```
And then execute the following command:
```console
$ bundle update jekyll-theme-chirpy
```
As the version upgrades, the critical files (for details, see the [Startup Template][starter]) and configuration options will change. Please refer to the [Upgrade Guide](https://github.com/cotes2020/jekyll-theme-chirpy/wiki/Upgrade-Guide) to keep your repo's files in sync with the latest version of the theme.
- If you forked from the source project (there will be `gemspec` in the `Gemfile` of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade.
The merge is likely to conflict with your local modifications. Please be patient and careful to resolve these conflicts.
## Documentation ## Documentation
For more details and a better reading experience, please check out the [tutorials on the demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Please note that the tutorials on the demo website or Wiki are based on the latest release, and the features of `master` branch usually ahead of the documentation. For more details on usage, please refer to the tutorial on the [demo website](https://cotes2020.github.io/chirpy-demo/) / [wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Note that the tutorial is based on the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags), and the features of the default branch are usually ahead of the documentation.
## Contributing ## Contributing
The old saying, "Two heads are better than one." Consequently, welcome to report bugs, improve code quality or submit a new feature. For more information, see [contributing guidelines](.github/CONTRIBUTING.md). Welcome to report bugs, improve code quality or submit a new feature. For more information, see [contributing guidelines](.github/CONTRIBUTING.md).
## Credits ## Credits
This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Bootstrap](https://getbootstrap.com/), [Font Awesome](https://fontawesome.com/) and some other wonderful tools (their copyright information can be found in the relevant files). The avatar and favicon design comes from [Clipart Max](https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/). This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Bootstrap](https://getbootstrap.com/), [Font Awesome](https://fontawesome.com/) and some other wonderful tools (their copyright information can be found in the relevant files). The avatar and favicon design come from [Clipart Max](https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/).
:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas, or inspired me to write more readable documentation. :tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas, or inspired me to write more readable documentation.
Last but not least, thank [JetBrains][jb] for providing the open source license. Last but not least, thank [JetBrains][jb] for providing the OSS development license.
## Sponsoring ## 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! 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) [![Ko-fi](https://img.shields.io/badge/-Buy%20Me%20a%20Coffee-ff5f5f?logo=ko-fi&logoColor=white)](https://ko-fi.com/coteschung)
[![Wechat Pay](https://img.shields.io/badge/-Tip%20Me%20on%20WeChat-brightgreen?logo=wechat&logoColor=white)][cn-donation] [![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] [![Alipay](https://img.shields.io/badge/-Tip%20Me%20on%20Alipay-blue?logo=alipay&logoColor=white)][cn-donation]
@@ -234,13 +99,6 @@ If you like this theme or find it helpful, please consider sponsoring me, becaus
This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) 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
[chirpy-4.1.0]: https://github.com/cotes2020/jekyll-theme-chirpy/releases/tag/v4.1.0
[pages-src]: https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site
[latest-tag]: https://github.com/cotes2020/jekyll-theme-chirpy/tags
<!-- ReadMe links --> <!-- ReadMe links -->
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy [jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy

View File

@@ -12,6 +12,9 @@ baseurl: ''
# otherwise, the layout language will use the default value of 'en'. # otherwise, the layout language will use the default value of 'en'.
lang: en lang: en
# Additional parameters for datetime localization, optional. https://github.com/iamkun/dayjs/tree/dev/src/locale
prefer_datetime_locale:
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone # Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai timezone: Asia/Shanghai
@@ -23,9 +26,7 @@ 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 description: >- # used by seo meta and the atom feed
A minimal, portfolio, sidebar, A minimal, responsive, and powerful Jekyll theme for presenting professional writing.
bootstrap Jekyll theme with responsive web design
and focuses on text presentation.
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io' # fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
url: '' url: ''
@@ -49,13 +50,13 @@ social:
# - https://www.facebook.com/username # - https://www.facebook.com/username
# - https://www.linkedin.com/in/username # - https://www.linkedin.com/in/username
google_site_verification: google_meta_tag_verification # change to your verification string google_site_verification: # fill in to your verification string
# ↑ -------------------------- # ↑ --------------------------
# The end of `jekyll-seo-tag` settings
google_analytics: google_analytics:
id: '' # fill in your Google Analytics ID id: # fill in your Google Analytics ID
# Google Analytics pageviews report settings # Google Analytics pageviews report settings
pv: pv:
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
@@ -79,7 +80,7 @@ theme_mode: # [light|dark]
# will be added to all image (site avatar & posts' images) paths starting with '/' # will be added to all image (site avatar & posts' images) paths starting with '/'
# #
# e.g. 'https://cdn.com' # e.g. 'https://cdn.com'
img_cdn: 'https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images@0a003683c0c3ca549d12c309f9b3e03ea20981e5' img_cdn: 'https://raw.githubusercontent.com/cotes2020/chirpy-images/main'
# the avatar on sidebar, support local or CORS resources # the avatar on sidebar, support local or CORS resources
avatar: '/commons/avatar.jpg' avatar: '/commons/avatar.jpg'
@@ -87,9 +88,35 @@ avatar: '/commons/avatar.jpg'
# boolean type, the global switch for ToC in posts. # boolean type, the global switch for ToC in posts.
toc: true toc: true
disqus: comments:
comments: false # boolean type, the global switch for posts comments. active: # The global switch for posts comments, e.g., 'disqus'. Keep it empty means disable
shortname: '' # Fill with your Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname # The active options are as follows:
disqus:
shortname: # fill with the Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname
# utterances settings https://utteranc.es/
utterances:
repo: # <gh-username>/<repo>
issue_term: # < url | pathname | title | ...>
# Giscus options https://giscus.app
giscus:
repo: # <gh-username>/<repo>
repo_id:
category:
category_id:
mapping: # optional, default to 'pathname'
input_position: # optional, default to 'bottom'
lang: # optional, default to the value of `site.lang`
# Self-hosted static assets, optional https://github.com/cotes2020/chirpy-static-assets
assets:
self_host:
enabled: # boolean, keep empty means false
# specify the Jekyll environment, empty means both
# only works if `assets.self_host.enabled` is 'true'
env: # [development|production]
pwa:
enabled: true # the option for PWA feature
paginate: 10 paginate: 10
@@ -111,10 +138,8 @@ collections:
output: true output: true
sort_by: order sort_by: order
defaults: defaults:
- - scope:
scope:
path: '' # An empty string here means all files in the project path: '' # An empty string here means all files in the project
type: posts type: posts
values: values:
@@ -124,19 +149,24 @@ defaults:
# DO NOT modify the following parameter unless you are confident enough # DO NOT modify the following parameter unless you are confident enough
# to update the code of all other post links in this project. # to update the code of all other post links in this project.
permalink: /posts/:title/ permalink: /posts/:title/
- - scope:
scope:
path: _drafts path: _drafts
values: values:
comments: false comments: false
- - scope:
scope:
path: '' path: ''
type: tabs # see `site.collections` type: tabs # see `site.collections`
values: values:
layout: page layout: page
permalink: /:title/ permalink: /:title/
dynamic_title: true # Hide title in mobile screens. - scope:
path: assets/img/favicons
values:
swcache: true
- scope:
path: assets/js/dist
values:
swcache: true
sass: sass:
style: compressed style: compressed
@@ -154,12 +184,11 @@ exclude:
- '*.gem' - '*.gem'
- '*.gemspec' - '*.gemspec'
- tools - tools
- docs
- README.md - README.md
- LICENSE - LICENSE
- gulpfile.js - gulpfile.js
- node_modules - node_modules
- '*.json' - package*.json
jekyll-archives: jekyll-archives:
enabled: [categories, tags] enabled: [categories, tags]

View File

@@ -0,0 +1,62 @@
# CDNs
cdns:
# Google Fonts
- url: https://fonts.googleapis.com
- url: https://fonts.gstatic.com
args: crossorigin
- url: https://fonts.googleapis.com
# jsDelivr CDN
- url: https://cdn.jsdelivr.net
# fonts
webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;700;900&display=swap
# Libraries
jquery:
js: https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
bootstrap:
css: https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css
js: https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.bundle.min.js
bootstrap-toc:
css: https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css
js: https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js
fontawesome:
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css
search:
js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js
mermaid:
js: https://cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js
dayjs:
js:
common: https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js
locale: https://cdn.jsdelivr.net/npm/dayjs@1/locale/:LOCALE.min.js
relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1/plugin/relativeTime.min.js
localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1/plugin/localizedFormat.min.js
countup:
js: https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js
magnific-popup:
css: https://cdn.jsdelivr.net/npm/magnific-popup@1/dist/magnific-popup.min.css
js: https://cdn.jsdelivr.net/npm/magnific-popup@1/dist/jquery.magnific-popup.min.js
lozad:
js: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js
clipboard:
js: https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js
polyfill:
js: https://polyfill.io/v3/polyfill.min.js?features=es6
mathjax:
js: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js

View File

@@ -0,0 +1,51 @@
# fonts
webfonts: /assets/lib/fonts/main.css
# Libraries
jquery:
js: /assets/lib/jquery-3.6.0/jquery.min.js
bootstrap:
css: /assets/lib/bootstrap-4.6.1/bootstrap.min.css
js: /assets/lib/bootstrap-4.6.1/bootstrap.bundle.min.js
bootstrap-toc:
css: /assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css
js: /assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js
fontawesome:
css: /assets/lib/fontawesome-free-5.15.4/css/all.min.css
search:
js: /assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js
mermaid:
js: /assets/lib/mermaid-8.13.10/mermaid.min.js
dayjs:
js:
common: /assets/lib/dayjs-1.10.7/dayjs.min.js
locale: /assets/lib/dayjs-1.10.7/locale/en.min.js
relativeTime: /assets/lib/dayjs-1.10.7/plugin/relativeTime.min.js
localizedFormat: /assets/lib/dayjs-1.10.7/plugin/localizedFormat.min.js
countup:
js: /assets/lib/countup.js-1.9.3/countUp.min.js
magnific-popup:
css: /assets/lib/magnific-popup-1.1.0/magnific-popup.css
js: /assets/lib/magnific-popup-1.1.0/jquery.magnific-popup.min.js
lozad:
js: /assets/lib/lozad-1.16.0/lozad.min.js
clipboard:
js: /assets/lib/clipboard-2.0.9/clipboard.min.js
polyfill:
js: /assets/lib/polyfill-v3-es6/polyfill.min.js
mathjax:
js: /assets/lib/mathjax-3.2.0/tex-chtml.js

17
_data/authors.yml Normal file
View File

@@ -0,0 +1,17 @@
## Template https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/advanced-usage.md#setting-author-url
# -------------------------------------
# {author_id}:
# name: {full name}
# twitter: {twitter_of_author}
# url: {homepage_of_author}
# -------------------------------------
cotes:
name: Cotes Chung
twitter: cotes2020
url: https://github.com/cotes2020/
sille_bille:
name: Dinesh Prasanth Moluguwan Krishnamoorthy
twitter: dinesh_MKD
url: https://github.com/SilleBille/

View File

@@ -20,21 +20,13 @@ tabs:
search: search:
hint: search hint: search
cancel: Cancel cancel: Cancel
no_results: Oops! No result founds. no_results: Oops! No results found.
panel: panel:
lastmod: Recent Update lastmod: Recently Updated
trending_tags: Trending Tags trending_tags: Trending Tags
toc: Contents toc: Contents
# The liquid date format http://strftime.net/
date_format:
tooltip: '%a, %b %e, %Y, %l:%M %p %z'
post:
long: '%b %e, %Y'
short: '%b %e'
archive_month: '%b'
copyright: copyright:
# Shown at the bottom of the post # Shown at the bottom of the post
license: license:
@@ -52,20 +44,17 @@ meta: Powered by :PLATFORM with :THEME theme.
not_found: not_found:
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
hint_template: :HEAD_BAK to try finding it again, or search for it on the :ARCHIVES_PAGE.
head_back: Head back Home notification:
archives_page: Archives page update_found: A new version of content is available.
update: Update
# ----- Posts related labels ----- # ----- Posts related labels -----
post: post:
published: 'on' written_by: By
posted: Posted
updated: Updated updated: Updated
timeago:
day: days ago
hour: hours ago
minute: minutes ago
just_now: just now
words: words words: words
pageview_measure: views pageview_measure: views
read_time: read_time:
@@ -86,5 +75,9 @@ post:
# categories page # categories page
categories: categories:
category_measure: categories category_measure:
post_measure: posts singular: category
plural: categories
post_measure:
singular: post
plural: posts

79
_data/locales/es-ES.yml Normal file
View File

@@ -0,0 +1,79 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Entrada
category: Categoría
tag: Etiqueta
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Inicio
categories: Categorías
tags: Etiquetas
archives: Archivo
about: Acerca de
# the text displayed in the search bar & search results
search:
hint: Buscar
cancel: Cancelar
no_results: ¡Oops! No se encuentran resultados.
panel:
lastmod: Actualizado recientemente
trending_tags: Etiquetas populares
toc: Contenido
copyright:
# Shown at the bottom of the post
license:
template: Esta entrada está licenciada bajo :LICENSE_NAME por el autor.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Algunos derechos reservados.
verbose: >-
Salvo que se indique explícitamente, las entradas de este blog están licenciadas
bajo la Creative Commons Attribution 4.0 International (CC BY 4.0) License por el autor.
meta: Hecho con :PLATFORM usando el tema :THEME.
not_found:
statment: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe.
notification:
update_found: Hay una nueva versión de contenido disponible.
update: Actualizar
# ----- Posts related labels -----
post:
written_by: Por
posted: Publicado
updated: Actualizado
words: palabras
pageview_measure: visitas
read_time:
unit: min
prompt: ' de lectura'
relate_posts: Lecturas adicionales
share: Compartir
button:
next: Nuevo
previous: Anterior
copy_code:
succeed: ¡Copiado!
share_link:
title: Copiar enlace
succeed: ¡Enlace copiado!
# pinned prompt of posts list on homepage
pin_prompt: Fijado
# categories page
categories:
category_measure: categorias
post_measure: entradas

79
_data/locales/fr-FR.yml Normal file
View File

@@ -0,0 +1,79 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Post
category: Catégorie
tag: Tag
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Accueil
categories: Catégories
tags: Tags
archives: Archives
about: A propos de
# the text displayed in the search bar & search results
search:
hint: recherche
cancel: Annuler
no_results: Oups ! Aucun résultat trouvé.
panel:
lastmod: Récemment mis à jour
trending_tags: Tags tendance
toc: Contenu
copyright:
# Shown at the bottom of the post
license:
template: Cet article est sous licence :LICENSE_NAME par l'auteur.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Certains droits réservés.
verbose: >-
Sauf mention contraire, les articles de ce site sont publiés sous licence
sous la licence Creative Commons Attribution 4.0 International (CC BY 4.0) par l'auteur.
meta: Propulsé par :PLATFORM avec le thème :THEME
not_found:
statment: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas.
notification:
update_found: Une nouvelle version du contenu est disponible.
update: Mise à jour
# ----- Posts related labels -----
post:
written_by: Par
posted: Posté
updated: Mis à jour
words: mots
pageview_measure: vues
read_time:
unit: min
prompt: lire
relate_posts: Autres lectures
share: Partager
button:
next: Plus récent
previous: Plus ancien
copy_code:
succeed: Copié !
share_link:
title: Copier le lien
succeed: Lien copié avec succès !
# pinned prompt of posts list on homepage
pin_prompt: Épinglé
# categories page
categories:
category_measure: catégories
post_measure: posts

View File

@@ -27,14 +27,6 @@ panel:
trending_tags: Tagar Terpopuler trending_tags: Tagar Terpopuler
toc: Konten toc: Konten
# The liquid date format http://strftime.net/
date_format:
tooltip: "%a, %e %b, %Y, %l:%M %p"
post:
long: "%e %b, %Y"
short: "%e %b"
archive_month: "%b"
copyright: copyright:
# Shown at the bottom of the post # Shown at the bottom of the post
license: license:
@@ -52,20 +44,17 @@ meta: Didukung oleh :PLATFORM dengan tema :THEME.
not_found: not_found:
statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada.
hint_template: :HEAD_BAK untuk mencoba mencari kembali, atau cari di :ARCHIVES_PAGE.
head_back: Kembali ke Beranda notification:
archives_page: Halaman Arsip update_found: Versi konten baru tersedia.
update: Perbarui
# ----- Posts related labels ----- # ----- Posts related labels -----
post: post:
published: "pada" written_by: Oleh
posted: Diterbitkan
updated: Diperbarui updated: Diperbarui
timeago:
day: hari yang lalu
hour: jam yang lalu
minute: menit yang lalu
just_now: baru saja
words: kata words: kata
pageview_measure: dilihat pageview_measure: dilihat
read_time: read_time:

79
_data/locales/ko-KR.yml Normal file
View File

@@ -0,0 +1,79 @@
# The layout text of site
# ----- Commons label -----
layout:
post: 포스트
category: 카테고리
tag: 태그
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home:
categories: 카테고리
tags: 태그
archives: 아카이브
about: 정보
# the text displayed in the search bar & search results
search:
hint: 검색
cancel: 취소
no_results: 검색 결과가 없습니다.
panel:
lastmod: 최근 업데이트
trending_tags: 인기 태그
toc: 바로가기
copyright:
# Shown at the bottom of the post
license:
template: 이 기사는 저작권자의 :LICENSE_NAME 라이센스를 따릅니다.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: 일부 권리 보유
verbose: >-
명시되지 않는 한 이 사이트의 블로그 게시물은 작성자의
Creative Commons Attribution 4.0 International(CC BY 4.0) 라이선스에 따라 사용이 허가되었습니다.
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: 해당 URL은 존재하지 않습니다.
notification:
update_found: 새 버전의 콘텐츠를 사용할 수 있습니다.
update: 업데이트
# ----- Posts related labels -----
post:
written_by: By
posted: 게시
updated: 업데이트
words: 단어
pageview_measure: 조회
read_time:
unit:
prompt: 읽는 시간
relate_posts: 관련된 글
share: 공유하기
button:
next: 다음 글
previous: 이전 글
copy_code:
succeed: 복사되었습니다!
share_link:
title: 링크 복사하기
succeed: 링크가 복사되었습니다!
# pinned prompt of posts list on homepage
pin_prompt:
# categories page
categories:
category_measure: 카테고리
post_measure: 포스트

79
_data/locales/my-MM.yml Normal file
View File

@@ -0,0 +1,79 @@
# The layout text of site
# ----- Commons label -----
layout:
post: ပို့စ်
category: ကဏ္ဍ
tag: နာမ(တက်ဂ်)
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: အဓိကစာမျက်နှာ
categories: ကဏ္ဍများ
tags: နာမ(တက်ဂ်)များ
archives: မှတ်တမ်း​တိုက်
about: အကြောင်းအရာ
# the text displayed in the search bar & search results
search:
hint: ရှာဖွေမည်
cancel: ဖျက်သိမ်းမည်
no_results: အိုး! ဘာမှမရှိပါ
panel:
lastmod: မကြာသေးမီကမွမ်းမံထားသည်
trending_tags: ခေတ်စားနေသည့်တက်ဂ်များ
toc: အကြောင်းအရာများ
copyright:
# Shown at the bottom of the post
license:
template: ဤပို့စ်သည်စာရေးသူ၏ :LICENSE_NAME လိုင်စင်ရထားသည်။
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: မူပိုင်ခွင့်အချို့ကို လက်ဝယ်ထားသည်။
verbose: >-
အခြားမှတ်သားထားချက်များမှလွဲ၍ ဤဆိုက်ရှိ ဘလော့ဂ်ပို့စ်များသည် စာရေးသူ၏
Creative Commons Attribution 4.0 International (CC BY 4.0) အောက်တွင် လိုင်စင်ရထားပါသည်။
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။
notification:
update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။
update: အပ်ဒိတ်
# ----- Posts related labels -----
post:
written_by: ကရေးသားခဲ့သည်။
posted: တင်ထားခဲ့သည်။
updated: မွမ်းမံထားခဲ့သည်။
words: စကားလုံးများ
pageview_measure: အမြင်များ
read_time:
unit: မိနစ်
prompt: ဖတ်ပါမည်
relate_posts: နောက်ထပ်ဖတ်ရန်
share: မျှဝေရန်
button:
next: အသစ်များ
previous: အဟောင်းများ
copy_code:
succeed: ကူးယူလိုက်ပြီ။
share_link:
title: လင့်ခ်ကို ကူးယူရန်
succeed: လင့်ခ်ကို ကူးယူလိုက်ပြီ။
# pinned prompt of posts list on homepage
pin_prompt: ချိတ်ထားသည်။
# categories page
categories:
category_measure: ကဏ္ဍများ
post_measure: ပို့စ်များ

79
_data/locales/pt-BR.yml Normal file
View File

@@ -0,0 +1,79 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Post
category: Categoria
tag: Tag
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Home
categories: Categorias
tags: Tags
archives: Arquivos
about: Sobre
# the text displayed in the search bar & search results
search:
hint: Buscar
cancel: Cancelar
no_results: Oops! Nenhum resultado encontrado.
panel:
lastmod: Atualizados recentemente
trending_tags: Trending Tags
toc: Conteúdo
copyright:
# Shown at the bottom of the post
license:
template: Esta postagem está licenciada sob :LICENSE_NAME pelo autor.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Alguns direitos reservados.
verbose: >-
Exceto onde indicado de outra forma, as postagens do blog neste site são licenciadas sob a
Creative Commons Attribution 4.0 International (CC BY 4.0) License pelo autor.
meta: Feito com :PLATFORM usando o tema :THEME.
not_found:
statment: Desculpe, a página não foi encontrada.
notification:
update_found: Uma nova versão do conteúdo está disponível.
update: atualização
# ----- Posts related labels -----
post:
written_by: Por
posted: Postado em
updated: Atualizado
words: palavras
pageview_measure: visualizações
read_time:
unit: min
prompt: " de leitura"
relate_posts: Leia também
share: Compartilhar
button:
next: Próximo
previous: Anterior
copy_code:
succeed: Copiado!
share_link:
title: Copie o link
succeed: Link copiado com sucesso!
# pinned prompt of posts list on homepage
pin_prompt: Fixado
# categories page
categories:
category_measure: categorias
post_measure: posts

79
_data/locales/ru-RU.yml Normal file
View File

@@ -0,0 +1,79 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Публикация
category: Категория
tag: Тег
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Домашняя страница
categories: Категории
tags: Теги
archives: Архив
about: О сайте
# the text displayed in the search bar & search results
search:
hint: поиск
cancel: Отменить
no_results: Ох! Ничего не найдено.
panel:
lastmod: Недавно обновлено
trending_tags: Популярные теги
toc: Содержание
copyright:
# Shown at the bottom of the post
license:
template: Публикация защищена лицензией :LICENSE_NAME.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Некоторые права защищены.
verbose: >-
Публикации на сайте защищены лицензией Creative Commons Attribution 4.0 International (CC BY 4.0),
если в тексте публикации не указано иное.
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: Извините, эта ссылка указывает на ресурс который не существует.
notification:
update_found: Доступна новая версия контента.
update: Обновлять
# ----- Posts related labels -----
post:
written_by: Автор
posted: Время публикации
updated: Обновлено
words: слов
pageview_measure: просмотров
read_time:
unit: минут
prompt: чтения
relate_posts: Вам также может быть интересно
share: Поделиться
button:
next: Предыдущая публикация
previous: Следующая публикация
copy_code:
succeed: Скопировано успешно!
share_link:
title: Скопировать ссылку
succeed: Ссылка успешно скопирована!
# pinned prompt of posts list on homepage
pin_prompt: Закреплено
# categories page
categories:
category_measure: категории
post_measure: публикации

79
_data/locales/uk-UA.yml Normal file
View File

@@ -0,0 +1,79 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Публікація
category: Категорія
tag: Тег
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Домашня сторінка
categories: Категорії
tags: Теги
archives: Архів
about: Про сайт
# the text displayed in the search bar & search results
search:
hint: пошук
cancel: Скасувати
no_results: Ох! Нічого не знайдено.
panel:
lastmod: Нещодавно оновлено
trending_tags: Популярні теги
toc: Зміст
copyright:
# Shown at the bottom of the post
license:
template: Публікація захищена ліцензією :LICENSE_NAME.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Деякі права захищено.
verbose: >-
Публікації на сайті захищено ліцензією Creative Commons Attribution 4.0 International (CC BY 4.0),
якщо інше не вказано в тексті.
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: Вибачте, це посилання вказує на ресурс, що не існує.
notification:
update_found: Доступна нова версія вмісту.
update: Оновлення
# ----- Posts related labels -----
post:
written_by: Автор
posted: Час публікації
updated: Оновлено
words: слів
pageview_measure: переглядів
read_time:
unit: хвилин
prompt: читання
relate_posts: Вас також може зацікавити
share: Поділитися
button:
next: Попередня публікація
previous: Наступна публікація
copy_code:
succeed: Успішно скопійовано!
share_link:
title: Скопіювати посилання
succeed: Посилання успішно скопійовано!
# pinned prompt of posts list on homepage
pin_prompt: Закріплено
# categories page
categories:
category_measure: категорії
post_measure: публікації

77
_data/locales/vi-VN.yml Normal file
View File

@@ -0,0 +1,77 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Bài viết
category: Danh mục
tag: Thẻ
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Trang chủ
categories: Các danh mục
tags: Các thẻ
archives: Lưu trữ
about: Giới thiệu
# the text displayed in the search bar & search results
search:
hint: tìm kiếm
cancel: Hủy
no_results: Không có kết quả tìm kiếm.
panel:
lastmod: Mới cập nhật
trending_tags: Các thẻ thịnh hành
toc: Mục lục
copyright:
# Shown at the bottom of the post
license:
template: Bài viết này được cấp phép bởi tác giả theo giấy phép :LICENSE_NAME.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Một số quyền được bảo lưu.
verbose: >-
Trừ khi có ghi chú khác, các bài viết đăng trên trang này được cấp phép bởi tác giả theo giấy phép Creative Commons Attribution 4.0 International (CC BY 4.0).
meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME.
not_found:
statment: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại.
notification:
update_found: Đã có phiên bản mới của nội dung.
update: Cập nhật
# ----- Posts related labels -----
post:
written_by: Viết bởi
posted: Đăng lúc
updated: Cập nhật lúc
words: từ
pageview_measure: lượt xem
read_time:
unit: phút
prompt: đọc
relate_posts: Bài viết liên quan
share: Chia sẻ
button:
next: Mới hơn
previous: Cũ hơn
copy_code:
succeed: Đã sao chép!
share_link:
title: Sao chép đường dẫn
succeed: Đã sao chép đường dẫn thành công!
# pinned prompt of posts list on homepage
pin_prompt: Bài ghim
# categories page
categories:
category_measure: danh mục
post_measure: bài viết

View File

@@ -27,14 +27,6 @@ panel:
trending_tags: 热门标签 trending_tags: 热门标签
toc: 文章内容 toc: 文章内容
# The liquid date format http://strftime.net/
date_format:
tooltip: '%F, %R %z'
post:
long: '%F'
short: '%m-%d'
archive_month: '%m月'
copyright: copyright:
# Shown at the bottom of the post # Shown at the bottom of the post
license: license:
@@ -51,20 +43,17 @@ meta: 本站由 :PLATFORM 生成,采用 :THEME 主题。
not_found: not_found:
statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。 statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。
hint_template: :HEAD_BAK尝试再次查找它或在:ARCHIVES_PAGE上搜索它。
head_back: 返回主页 notification:
archives_page: 归档页面 update_found: 发现新版本的内容。
update: 更新
# ----- Posts related labels ----- # ----- Posts related labels -----
post: post:
published: 发表于 written_by: 作者
posted: 发表于
updated: 更新于 updated: 更新于
timeago:
day: 天前
hour: 小时前
minute: 分钟前
just_now: 刚刚
words: words:
pageview_measure: 次浏览 pageview_measure: 次浏览
read_time: read_time:

View File

@@ -13,7 +13,7 @@ platforms:
- -
type: Telegram type: Telegram
icon: "fab fa-telegram" icon: "fab fa-telegram"
link: "https://telegram.me/share?text=TITLE&url=URL" link: "https://t.me/share/url?url=URL&text=TITLE"
# Uncomment below if you need to. # Uncomment below if you need to.
# - # -

View File

@@ -0,0 +1,12 @@
{% comment %} Site static assets origin {% endcomment %}
{% assign origin = 'cross_origin' %}
{% if site.assets.self_host.enabled %}
{% if site.assets.self_host.env %}
{% if site.assets.self_host.env == jekyll.environment %}
{% assign origin = 'self_host' %}
{% endif %}
{% else %}
{% assign origin = 'self_host' %}
{% endif %}
{% endif %}

5
_includes/comments.html Normal file
View File

@@ -0,0 +1,5 @@
<!-- The comments switcher -->
{% if page.comments and site.comments.active %}
{% capture path %}comments/{{ site.comments.active }}.html{% endcapture %}
{% include {{ path }} %}
{% endif %}

View File

@@ -1,7 +1,6 @@
<!-- <!--
The Disqus lazy loading. The Disqus lazy loading.
--> -->
<div id="disqus_thread" class="pt-2 pb-2"> <div id="disqus_thread" class="pt-2 pb-2">
<p class="text-center text-muted small"> <p class="text-center text-muted small">
Comments powered by <a href="https://disqus.com/">Disqus</a>. Comments powered by <a href="https://disqus.com/">Disqus</a>.
@@ -9,6 +8,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var disqus_config = function () { var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}'; this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url }}'; this.page.identifier = '{{ page.url }}';
@@ -20,7 +20,7 @@
if(entries[0].isIntersecting) { if(entries[0].isIntersecting) {
(function () { (function () {
var d = document, s = d.createElement('script'); var d = document, s = d.createElement('script');
s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js'; s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date()); s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s); (d.head || d.body).appendChild(s);
})(); })();
@@ -46,8 +46,8 @@
const modeToggle = document.querySelector(".mode-toggle"); const modeToggle = document.querySelector(".mode-toggle");
if (modeToggle !== null) { if (typeof modeToggle !== "undefined") {
modeToggle.addEventListener('click', reloadDisqus); /* modeToggle.addEventListener('click', reloadDisqus); // not pretty for 'color-scheme' */
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', reloadDisqus); window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', reloadDisqus);
} }

View File

@@ -0,0 +1,56 @@
<!-- https://giscus.app/ -->
<script type="text/javascript">
$(function () {
const origin = "https://giscus.app";
const iframe = "iframe.giscus-frame";
const lightTheme = "light";
const darkTheme = "dark_dimmed";
let initTheme = lightTheme;
if ($("html[data-mode=dark]").length > 0
|| ($("html[data-mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) {
initTheme = darkTheme;
}
let giscusAttributes = {
"src": "https://giscus.app/client.js",
"data-repo": "{{ site.comments.giscus.repo}}",
"data-repo-id": "{{ site.comments.giscus.repo_id }}",
"data-category": "{{ site.comments.giscus.category }}",
"data-category-id": "{{ site.comments.giscus.category_id }}",
"data-mapping": "{{ site.comments.giscus.mapping | default: 'pathname' }}",
"data-reactions-enabled": "1",
"data-emit-metadata": "0",
"data-theme": initTheme,
"data-input-position": "{{ site.comments.giscus.input_position | default: 'bottom' }}",
"data-lang": "{{ site.comments.giscus.lang | default: lang }}",
"crossorigin": "anonymous",
"async": ""
};
let giscusScript = document.createElement("script");
Object.entries(giscusAttributes).forEach(([key, value]) => giscusScript.setAttribute(key, value));
document.getElementById("tail-wrapper").appendChild(giscusScript);
addEventListener("message", (event) => {
if (event.source === window && event.data &&
event.data.direction === ModeToggle.ID) {
/* global theme mode changed */
const mode = event.data.message;
const theme = (mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme);
const message = {
setConfig: {
theme: theme
}
};
const giscus = document.querySelector(iframe).contentWindow;
giscus.postMessage({ giscus: message }, origin);
}
});
});
</script>

View File

@@ -0,0 +1,51 @@
<!-- https://utteranc.es/ -->
<script src="https://utteranc.es/client.js"
repo="{{ site.comments.utterances.repo }}"
issue-term="{{ site.comments.utterances.issue_term }}"
crossorigin="anonymous"
async>
</script>
<script type="text/javascript">
$(function() {
const origin = "https://utteranc.es";
const iframe = "iframe.utterances-frame";
const lightTheme = "github-light";
const darkTheme = "github-dark";
let initTheme = lightTheme;
if ($("html[data-mode=dark]").length > 0
|| ($("html[data-mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) {
initTheme = darkTheme;
}
addEventListener("message", (event) => {
let theme;
/* credit to <https://github.com/utterance/utterances/issues/170#issuecomment-594036347> */
if (event.origin === origin) {
/* page initial */
theme = initTheme;
} else if (event.source === window && event.data &&
event.data.direction === ModeToggle.ID) {
/* global theme mode changed */
const mode = event.data.message;
theme = (mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme);
} else {
return;
}
const message = {
type: "set-theme",
theme: theme
};
const utterances = document.querySelector(iframe).contentWindow;
utterances.postMessage(message, origin);
});
});
</script>

View File

@@ -1,15 +0,0 @@
<!--
CSS selector for site.
-->
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
{% if site.toc and page.toc %}
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css">
{% endif %}
{% if page.layout == 'page' or page.layout == 'post' %}
<!-- Manific Popup -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css">
{% endif %}

21
_includes/datetime.html Normal file
View File

@@ -0,0 +1,21 @@
<!--
Date format snippet
See: ${JS_ROOT}/utils/locale-dateime.js
-->
{% assign wrap_elem = include.wrap | default: 'em' %}
{% if site.prefer_datetime_locale == 'en' or lang == 'en' %}
{% assign df_strftime = '%b %e, %Y' %}
{% assign df_dayjs = 'll' %}
{% else %}
{% assign df_strftime = '%F' %}
{% assign df_dayjs = 'YYYY-MM-DD' %}
{% endif %}
<{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}"
data-ts="{{ include.date | date: '%s' }}"
data-df="{{ df_dayjs }}"
{% if include.tooltip %}data-toggle="tooltip" data-placement="bottom"{% endif %}>
{{ include.date | date: df_strftime }}
</{{ wrap_elem }}>

View File

@@ -1,9 +1,7 @@
<!-- <!-- The Footer -->
The Footer
-->
<footer class="d-flex w-100 justify-content-center"> <footer class="row pl-3 pr-3">
<div class="d-flex justify-content-between align-items-center"> <div class="col-12 d-flex justify-content-between align-items-center text-muted pl-0 pr-0">
<div class="footer-left"> <div class="footer-left">
<p class="mb-0"> <p class="mb-0">
© {{ 'now' | date: "%Y" }} © {{ 'now' | date: "%Y" }}
@@ -33,5 +31,6 @@
</p> </p>
</div> </div>
</div> <!-- div.d-flex --> </div>
</footer> </footer>

View File

@@ -6,13 +6,12 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <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="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% if page.layout == 'home' or page.layout == 'post' %} <!-- Allow having a localized datetime different from the appearance language -->
{% if site.prefer_datetime_locale %}
<meta name="prefer-datetime-locale" content="{{ site.prefer_datetime_locale }}">
{% endif %}
<!-- i18n for `_javascript/utils/timeago.js` --> {% if page.layout == 'home' or page.layout == 'post' %}
<meta name="day-prompt" content="{{ site.data.locales[lang].post.timeago.day }}">
<meta name="hour-prompt" content="{{ site.data.locales[lang].post.timeago.hour }}">
<meta name="minute-prompt" content="{{ site.data.locales[lang].post.timeago.minute }}">
<meta name="justnow-prompt" content="{{ site.data.locales[lang].post.timeago.just_now }}">
{% if site.google_analytics.pv.proxy_endpoint %} {% if site.google_analytics.pv.proxy_endpoint %}
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}"> <meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
@@ -24,7 +23,30 @@
{% endif %} {% endif %}
{% seo title=false %} {% capture seo_tags %}
{% seo title=false %}
{% endcapture %}
{% if site.img_cdn and seo_tags contains 'og:image' %}
{% assign properties = 'og:image,twitter:image' | split: ',' %}
{% for prop in properties %}
{% if site.img_cdn contains '//' %}
<!-- `site.img_cdn` is a cross-origin URL -->
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{% endcapture %}
{% capture replacement %}<meta property="{{ prop }}" content="{{ site.img_cdn }}{% endcapture %}
{% else %}
<!-- `site.img_cdn` is a local file path -->
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{{ site.baseurl }}{% endcapture %}
{% assign replacement = target | append: site.img_cdn %}
{% endif %}
{% assign seo_tags = seo_tags | replace: target, replacement %}
{% endfor %}
{% endif %}
{{ seo_tags }}
<title> <title>
{%- unless page.layout == "home" -%} {%- unless page.layout == "home" -%}
@@ -35,12 +57,24 @@
{% include favicons.html %} {% include favicons.html %}
<!-- Google Fonts --> {% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %}
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">
<link rel="dns-prefetch" href="https://fonts.gstatic.com"> <link href="{{ site.data.assets[origin].webfonts | relative_url }}" rel="stylesheet">
{% else %}
{% for cdn in site.data.assets[origin].cdns %}
<link rel="preconnect" href="{{ cdn.url }}" {{ cdn.args }}>
<link rel="dns-prefetch" href="{{ cdn.url }}" {{ cdn.args }}>
{% endfor %}
<link rel="stylesheet" href="{{ site.data.assets[origin].webfonts | relative_url }}">
{% endif %}
<!-- GA --> <!-- GA -->
{% if jekyll.environment == 'production' %} {% if jekyll.environment == 'production'
and site.google_analytics.id != empty and site.google_analytics.id %}
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials"> <link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials">
<link rel="dns-prefetch" href="https://www.google-analytics.com"> <link rel="dns-prefetch" href="https://www.google-analytics.com">
@@ -49,27 +83,34 @@
{% if site.google_analytics.pv.proxy_endpoint %} {% if site.google_analytics.pv.proxy_endpoint %}
{% assign proxy_url = site.google_analytics.pv.proxy_endpoint {% assign proxy_url = site.google_analytics.pv.proxy_endpoint
| replace: "https://", "" | split: "/" | first | prepend: "https://" %} | replace: "https://", "" | split: "/" | first | prepend: "https://" %}
<link rel="preconnect" href="{{ proxy_url }}" crossorigin="use-credentials"> <link rel="preconnect" href="{{ proxy_url }}" crossorigin="use-credentials">
<link rel="dns-prefetch" href="{{ proxy_url }}"> <link rel="dns-prefetch" href="{{ proxy_url }}">
{% endif %} {% endif %}
{% endif %} {% endif %}
<!-- jsDelivr CDN -->
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ site.data.assets[origin].bootstrap.css | relative_url}}">
<!-- Font Awesome --> <!-- Font Awesome -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css"> <link rel="stylesheet" href="{{ site.data.assets[origin].fontawesome.css | relative_url }}">
{% include css-selector.html %} <link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
{% if site.toc and page.toc %}
<link rel="stylesheet" href="{{ site.data.assets[origin].bootstrap-toc.css | relative_url }}">
{% endif %}
{% if page.layout == 'page' or page.layout == 'post' %}
<!-- Manific Popup -->
<link rel="stylesheet" href="{{ site.data.assets[origin].magnific-popup.css | relative_url }}">
{% endif %}
<!-- JavaScript --> <!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script> <script src="{{ site.data.assets[origin].jquery.js | relative_url }}"></script>
{% unless site.theme_mode %}
{% include mode-toggle.html %}
{% endunless %}
</head> </head>

View File

@@ -4,17 +4,46 @@
<!-- layout specified --> <!-- layout specified -->
{% if page.layout == 'home' or page.layout == 'post' %} {% if page.layout == 'post' %}
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<!-- pv-report needs countup.js --> <!-- 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="{{ site.data.assets[origin].countup.js | relative_url }}"></script>
<script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script> <script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if page.layout == 'post' or page.layout == 'page' %} {% if page.layout == 'post' or page.layout == 'page' %}
<!-- image lazy-loading & popup --> <!-- image lazy-loading & popup & clipboard -->
<script src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js,npm/clipboard@2/dist/clipboard.min.js"></script> {% assign _urls = site.data.assets[origin].magnific-popup.js
| append: ',' | append: site.data.assets[origin].lozad.js
| append: ',' | append: site.data.assets[origin].clipboard.js
%}
{% include jsdelivr-combine.html urls=_urls %}
{% endif %}
{% if page.layout == 'home'
or page.layout == 'post'
or page.layout == 'archives'
or page.layout == 'category'
or page.layout == 'tag' %}
{% if site.prefer_datetime_locale %}
{% assign locale = site.prefer_datetime_locale | downcase %}
{% else %}
{% assign locale = site.lang | split: '-' | first %}
{% endif %}
{% assign _urls = site.data.assets[origin].dayjs.js.common
| append: ',' | append: site.data.assets[origin].dayjs.js.locale
| replace: ':LOCALE', locale
| append: ',' | append: site.data.assets[origin].dayjs.js.relativeTime
| append: ',' | append: site.data.assets[origin].dayjs.js.localizedFormat
%}
{% include jsdelivr-combine.html urls=_urls %}
{% endif %} {% endif %}
{% if page.layout == 'home' {% if page.layout == 'home'
@@ -22,12 +51,16 @@
or page.layout == 'post' or page.layout == 'post'
or page.layout == 'page' %} or page.layout == 'page' %}
{% assign type = page.layout %} {% assign type = page.layout %}
{% elsif page.layout == 'archives'
or page.layout == 'category'
or page.layout == 'tag' %}
{% assign type = "misc" %}
{% else %} {% else %}
{% assign type = "commons" %} {% assign type = "commons" %}
{% endif %} {% endif %}
{% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %} {% capture script %}/assets/js/dist/{{ type }}.min.js{% endcapture %}
<script defer src="{{ js | relative_url }}"></script> <script defer src="{{ script | relative_url }}"></script>
{% if page.math %} {% if page.math %}
<!-- MathJax --> <!-- MathJax -->
@@ -46,22 +79,25 @@
} }
}; };
</script> </script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script src="{{ site.data.assets[origin].polyfill.js | relative_url }}"></script>
<script type="text/javascript" id="MathJax-script" async <script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js | relative_url }}">
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script> </script>
{% endif %} {% endif %}
<!-- commons --> <!-- commons -->
<script src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.16.1,npm/bootstrap@4/dist/js/bootstrap.min.js"></script> <script src="{{ site.data.assets[origin].bootstrap.js | relative_url }}"></script>
{% if jekyll.environment == 'production' %} {% if jekyll.environment == 'production' %}
<!-- PWA --> <!-- PWA -->
<script defer src="{{ '/app.js' | relative_url }}"></script> {% if site.pwa.enabled %}
<script defer src="{{ '/app.js' | relative_url }}"></script>
{% else %}
<script defer src="{{ '/unregister.js' | relative_url }}"></script>
{% endif %}
<!-- GA --> <!-- GA -->
{% if site.google_analytics.id %} {% if site.google_analytics.id != empty and site.google_analytics.id %}
{% include google-analytics.html %} {% include google-analytics.html %}
{% endif %} {% endif %}

View File

@@ -0,0 +1,32 @@
{% assign urls = include.urls | split: ',' %}
{% assign combined_urls = nil %}
{% assign domain = 'https://cdn.jsdelivr.net/' %}
{% for url in urls %}
{% if url contains domain %}
{% assign url_snippet = url | slice: domain.size, url.size %}
{% if combined_urls %}
{% assign combined_urls = combined_urls | append: ',' | append: url_snippet %}
{% else %}
{% assign combined_urls = domain | append: 'combine/' | append: url_snippet %}
{% endif %}
{% elsif url contains '//' %}
<script src="{{ url }}"></script>
{% else %}
<script src="{{ url | relative_url }}"></script>
{% endif %}
{% endfor %}
{% if combined_urls %}
<script src="{{ combined_urls }}"></script>
{% endif %}

View File

@@ -41,8 +41,6 @@
{{ 'Perl' }} {{ 'Perl' }}
{% when 'php','php3','php4','php5' %} {% when 'php','php3','php4','php5' %}
{{ 'PHP' }} {{ 'PHP' }}
{% when 'plaintext', 'text' %}
{{ 'Text' }}
{% when 'py' %} {% when 'py' %}
{{ 'Python' }} {{ 'Python' }}
{% when 'rb' %} {% when 'rb' %}
@@ -65,7 +63,7 @@
{{ 'Vue.js' }} {{ 'Vue.js' }}
{% when 'yml' %} {% when 'yml' %}
{{ 'YAML' }} {{ 'YAML' }}
{% when 'css', 'html', 'scss', 'ssh', 'toml', 'xml', 'yaml' %} {% when 'css', 'html', 'scss', 'ssh', 'toml', 'xml', 'yaml', 'json' %}
{{ _lang | upcase }} {{ _lang | upcase }}
{% else %} {% else %}
{{ _lang | capitalize }} {{ _lang | capitalize }}

View File

@@ -2,13 +2,39 @@
mermaid-js loader mermaid-js loader
--> -->
<script src="https://cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js"></script> <script src="{{ site.data.assets[origin].mermaid.js | relative_url }}"></script>
<script> <script>
$(function() { $(function() {
function updateMermaid(event) {
if (event.source === window && event.data &&
event.data.direction === ModeToggle.ID) {
const mode = event.data.message;
if (typeof mermaid === "undefined") {
return;
}
let expectedTheme = (mode === 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");
}
}
let initTheme = "default"; let initTheme = "default";
if ($("html[mode=dark]").length > 0 if ($("html[data-mode=dark]").length > 0
|| ($("html[mode]").length == 0 || ($("html[data-mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches ) ) { && window.matchMedia("(prefers-color-scheme: dark)").matches ) ) {
initTheme = "dark"; initTheme = "dark";
} }
@@ -25,5 +51,7 @@
}); });
mermaid.initialize(mermaidConf); mermaid.initialize(mermaidConf);
window.addEventListener("message", updateMermaid);
}); });
</script> </script>

View File

@@ -2,14 +2,13 @@
Switch the mode between dark and light. Switch the mode between dark and light.
--> -->
<i class="mode-toggle fas fa-adjust"></i>
<script type="text/javascript"> <script type="text/javascript">
class ModeToggle { class ModeToggle {
static get MODE_KEY() { return "mode"; } static get MODE_KEY() { return "mode"; }
static get MODE_ATTR() { return "data-mode"; }
static get DARK_MODE() { return "dark"; } static get DARK_MODE() { return "dark"; }
static get LIGHT_MODE() { return "light"; } static get LIGHT_MODE() { return "light"; }
static get ID() { return "mode-toggle"; }
constructor() { constructor() {
if (this.hasMode) { if (this.hasMode) {
@@ -24,10 +23,10 @@
} }
} }
var self = this; let self = this;
/* always follow the system prefers */ /* always follow the system prefers */
this.sysDarkPrefers.addListener(function() { this.sysDarkPrefers.addEventListener("change", () => {
if (self.hasMode) { if (self.hasMode) {
if (self.isDarkMode) { if (self.isDarkMode) {
if (!self.isSysDarkPrefer) { if (!self.isSysDarkPrefer) {
@@ -43,34 +42,19 @@
self.clearMode(); self.clearMode();
} }
self.updateMermaid(); self.notify();
}); });
} /* constructor() */ } /* constructor() */
setDark() {
$('html').attr(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
}
setLight() {
$('html').attr(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
}
clearMode() {
$('html').removeAttr(ModeToggle.MODE_KEY);
sessionStorage.removeItem(ModeToggle.MODE_KEY);
}
get sysDarkPrefers() { return window.matchMedia("(prefers-color-scheme: dark)"); } get sysDarkPrefers() { return window.matchMedia("(prefers-color-scheme: dark)"); }
get isSysDarkPrefer() { return this.sysDarkPrefers.matches; } get isSysDarkPrefer() { return this.sysDarkPrefers.matches; }
get isDarkMode() { return this.mode == ModeToggle.DARK_MODE; } get isDarkMode() { return this.mode === ModeToggle.DARK_MODE; }
get isLightMode() { return this.mode == ModeToggle.LIGHT_MODE; } get isLightMode() { return this.mode === ModeToggle.LIGHT_MODE; }
get hasMode() { return this.mode != null; } get hasMode() { return this.mode != null; }
@@ -79,67 +63,67 @@
/* get the current mode on screen */ /* get the current mode on screen */
get modeStatus() { get modeStatus() {
if (this.isDarkMode if (this.isDarkMode
|| (!this.hasMode && this.isSysDarkPrefer) ) { || (!this.hasMode && this.isSysDarkPrefer)) {
return ModeToggle.DARK_MODE; return ModeToggle.DARK_MODE;
} else { } else {
return ModeToggle.LIGHT_MODE; return ModeToggle.LIGHT_MODE;
} }
} }
updateMermaid() { setDark() {
if (typeof mermaid !== "undefined") { $('html').attr(ModeToggle.MODE_ATTR, ModeToggle.DARK_MODE);
let expectedTheme = (this.modeStatus === ModeToggle.DARK_MODE? "dark" : "default"); sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
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() { setLight() {
if (this.hasMode) { $('html').attr(ModeToggle.MODE_ATTR, ModeToggle.LIGHT_MODE);
if (this.isSysDarkPrefer) { sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
if (this.isLightMode) { }
this.clearMode();
} else {
this.setLight();
}
} else { clearMode() {
if (this.isDarkMode) { $('html').removeAttr(ModeToggle.MODE_ATTR);
this.clearMode(); sessionStorage.removeItem(ModeToggle.MODE_KEY);
} else { }
this.setDark();
}
}
} else { /* Notify another plugins that the theme mode has changed */
if (this.isSysDarkPrefer) { notify() {
this.setLight(); window.postMessage({
} else { direction: ModeToggle.ID,
this.setDark(); message: this.modeStatus
} }, "*");
} }
this.updateMermaid();
} /* flipMode() */
} /* ModeToggle */ } /* ModeToggle */
let toggle = new ModeToggle(); const toggle = new ModeToggle();
$(".mode-toggle").click(function() { function flipMode() {
if (toggle.hasMode) {
if (toggle.isSysDarkPrefer) {
if (toggle.isLightMode) {
toggle.clearMode();
} else {
toggle.setLight();
}
toggle.flipMode(); } else {
if (toggle.isDarkMode) {
toggle.clearMode();
} else {
toggle.setDark();
}
}
}); } else {
if (toggle.isSysDarkPrefer) {
toggle.setLight();
} else {
toggle.setDark();
}
}
toggle.notify();
} /* flipMode() */
</script> </script>

View File

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

View File

@@ -1,59 +0,0 @@
<!--
The Pannel on right side (Desktop views)
-->
{% include lang.html %}
<div id="panel-wrapper" class="col-xl-3 pl-2 text-muted topbar-down">
<div class="access">
{% include update-list.html %}
{% if update_list.size > 0 %}
<div id="access-lastmod" class="post">
<span>{{- site.data.locales[lang].panel.lastmod -}}</span>
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %}
{% assign index = item | split: "::" | last | plus: 0 %}
{% assign post = site.posts[index] %}
{% assign url = post.url | relative_url %}
<li><a href="{{ url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div> <!-- #access-lastmod -->
{% endif %}
{% include trending-tags.html %}
{% if trending_tags.size > 0 %}
<div id="access-tags">
<span>{{- site.data.locales[lang].panel.trending_tags -}}</span>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% 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>
</div>
{% endif %}
</div> <!-- .access -->
{% if include.toc %}
<!-- BS-toc.js will be loaded at medium priority -->
<script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script>
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<span class="pl-3 pt-2 mb-2">
{{- site.data.locales[lang].panel.toc -}}
</span>
<nav id="toc" data-toggle="toc"></nav>
</div>
{% endif %}
</div> <!-- #panel-wrapper -->

View File

@@ -9,10 +9,10 @@
<p>{{ page.previous.title }}</p> <p>{{ page.previous.title }}</p>
</a> </a>
{% else %} {% else %}
<span class="btn btn-outline-primary disabled" <div class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[lang].post.button.previous }}"> prompt="{{ site.data.locales[lang].post.button.previous }}">
<p>-</p> <p>-</p>
</span> </div>
{% endif %} {% endif %}
{% if page.next.url %} {% if page.next.url %}
@@ -21,10 +21,10 @@
<p>{{ page.next.title }}</p> <p>{{ page.next.title }}</p>
</a> </a>
{% else %} {% else %}
<span class="btn btn-outline-primary disabled" <div class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[lang].post.button.next }}"> prompt="{{ site.data.locales[lang].post.button.next }}">
<p>-</p> <p>-</p>
</span> </div>
{% endif %} {% endif %}
</div> </div>

View File

@@ -2,7 +2,7 @@
The paginator for post list on HomgPage. The paginator for post list on HomgPage.
--> -->
<ul class="pagination align-items-center mt-4 mb-0 pl-lg-2"> <ul class="pagination align-items-center mt-4 mb-5 pl-lg-2">
<!-- left arrow --> <!-- left arrow -->
{% if paginator.previous_page %} {% if paginator.previous_page %}
{% assign prev_url = paginator.previous_page_path | relative_url %} {% assign prev_url = paginator.previous_page_path | relative_url %}
@@ -47,7 +47,7 @@
{% if show %} {% if show %}
<!-- show number --> <!-- show number -->
<li class="page-item {% if i == paginator.page %} active{% endif %}"> <li class="page-item {% if i == paginator.page %} active{% endif %}">
<a class="page-link btn-box-shadow" href="{{ site.baseurl }}/{% if i > 1%}page{{ i }}/{% endif %}">{{ i }}</a> <a class="page-link btn-box-shadow" href="{% if i > 1 %}{{ site.paginate_path | replace: ':num', i | relative_url }}{% else %}{{ '/' | relative_url }}{% endif %}">{{ i }}</a>
</li> </li>
{% else %} {% else %}
<!-- hide number --> <!-- hide number -->

View File

@@ -6,7 +6,8 @@
<span class="share-label text-muted mr-1">{{ site.data.locales[lang].post.share }}</span> <span class="share-label text-muted mr-1">{{ site.data.locales[lang].post.share }}</span>
<span class="share-icons"> <span class="share-icons">
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %} {% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
{% assign url = page.url | absolute_url %} {% assign title = title | url_encode %}
{% assign url = page.url | absolute_url | url_encode %}
{% for share in site.data.share.platforms %} {% for share in site.data.share.platforms %}
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %} {% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
@@ -19,7 +20,7 @@
<i id="copy-link" class="fa-fw fas fa-link small" <i id="copy-link" class="fa-fw fas fa-link small"
data-toggle="tooltip" data-placement="top" data-toggle="tooltip" data-placement="top"
title="{{ site.data.locales[lang].post.button.share_link.title }}" title="{{ site.data.locales[lang].post.button.share_link.title }}"
title-succeed="{{ site.data.locales[lang].post.button.share_link.succeed }}"> data-title-succeed="{{ site.data.locales[lang].post.button.share_link.succeed }}">
</i> </i>
</span> </span>

View File

@@ -22,9 +22,9 @@
<!-- return element --> <!-- return element -->
<span class="readtime" data-toggle="tooltip" data-placement="bottom" <span class="readtime" data-toggle="tooltip" data-placement="bottom"
title="{{ words }} {{ site.data.locales[lang].post.words }}"> title="{{ words }} {{ site.data.locales[lang].post.words }}">
{{- read_time -}}{{" "}}{{- site.data.locales[lang].post.read_time.unit -}} <em>{{- read_time -}}{{" "}}{{- site.data.locales[lang].post.read_time.unit -}}</em>
{%- if include.prompt -%} {%- if include.prompt -%}
{% assign _prompt_words = read_prompt | number_of_words: 'auto' %} {%- assign _prompt_words = read_prompt | number_of_words: 'auto' -%}
{% unless _prompt_words > 1 %}{{" "}}{% endunless %}{{ read_prompt }} {%- unless _prompt_words > 1 -%}{{ " " }}{%- endunless -%}{{ read_prompt }}
{%- endif -%} {%- endif -%}
</span> </span>

View File

@@ -9,10 +9,11 @@
we suround the markdown table with `<div class="table-wrapper">` and `</div>` we suround the markdown table with `<div class="table-wrapper">` and `</div>`
--> -->
{% if _content contains '<table>' %} {% if _content contains '<table' %}
{% assign _content = _content {% assign _content = _content
| replace: '<table>', '<div class="table-wrapper"><table>' | replace: '<table', '<div class="table-wrapper"><table'
| replace: '</table>', '</table></div>' | replace: '</table>', '</table></div>'
| replace: '<code><div class="table-wrapper">', '<code>'
| replace: '</table></div></code>', '</table></code>' | replace: '</table></div></code>', '</table></code>'
%} %}
{% endif %} {% endif %}
@@ -38,63 +39,105 @@
%} %}
{% endif %} {% endif %}
<!-- images --> <!-- images -->
{% if _content contains '<img src="' %} {% assign IMG_TAG = '<img ' %}
<!-- add CDN prefix if it exists -->
{% if site.img_cdn != '' %}
{% assign img_path_replacement = '<img src="' | append: site.img_cdn | append: '/' %}
{% else %}
{% assign img_path_replacement = '<img src="' | append: site.baseurl | append: '/' %}
{% endif %}
{% assign _content = _content | replace: '<img src="/', img_path_replacement %}
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% assign _content = _content | replace: '<img src="', '<img data-proofer-ignore data-src="' %}
<!-- add image placehoder to prevent layout reflow -->
{% if _content contains IMG_TAG %}
{% assign _img_content = nil %} {% assign _img_content = nil %}
{% assign _img_snippets = _content | split: IMG_TAG %}
{% assign _images = _content | split: '<img ' %} {% for _img_snippet in _img_snippets %}
{% for _img in _images %}
{% if forloop.first %} {% if forloop.first %}
{% assign _img_content = _img %} {% assign _img_content = _img_snippet %}
{% continue %} {% continue %}
{% endif %} {% endif %}
{% assign _width = nil %} {% assign _width = nil %}
{% assign _height = nil %} {% assign _height = nil %}
{% assign _attrs = _img | split: '>' | first | split: ' ' %} {% assign _src = nil %}
{% assign _left = _img_snippet | split: '>' | first %}
{% assign _right = _img_snippet | remove: _left %}
{% assign _left = _left | remove: ' /' %}
{% assign _left = _left | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
{% assign _attrs = _left | split: ' ' %}
{% for _attr in _attrs %} {% for _attr in _attrs %}
{% capture _key %}{{ _attr | split: '=' | first }}{% endcapture %} {% assign _pair = _attr | split: '=' %}
{% capture _value %}{{ _attr | split: '=' | last | replace: '"', '' }}{% endcapture %} {% if _pair.size < 2 %}
{% continue %}
{% endif %}
{% capture _key %}{{ _pair | first }}{% endcapture %}
{% capture _value %}{{ _pair | last | replace: '"', '' }}{% endcapture %}
{% case _key %} {% case _key %}
{% when 'width' %} {% when 'width' %}
{% assign _width = _value %} {% assign _width = _value %}
{% when 'height' %} {% when 'height' %}
{% assign _height = _value %} {% assign _height = _value %}
{% when 'src' %}
{% assign _src = _value %}
{% endcase %} {% endcase %}
{% if _width and _height %} {% if _width and _height and _src %}
{% capture _svg %}data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{_width}} {{_height}}'%3E%3C/svg%3E{% endcapture %}
{% assign _img_content = _img_content | append: '<img src="' | append: _svg | append: '" ' | append: _img %}
{% break %} {% break %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% unless _width and _height %} {% if _src %}
{% assign _img_content = _img_content | append: '<img ' | append: _img %} {% unless _src contains '://' %}
{% endunless %}
<!-- Add CDN URL -->
{% if site.img_cdn %}
{% if site.img_cdn contains '//' %}
{% assign _src_prefix = site.img_cdn %}
{% else %}
{% assign _src_prefix = site.img_cdn | relative_url %}
{% endif %}
{% else %}
{% assign _src_prefix = site.baseurl %}
{% endif %}
<!-- Add image path -->
{% if page.img_path %}
{% assign _path = page.img_path %}
{% assign last_char = _path | slice: -1 %}
{% unless last_char == '/' %}
{% assign _path = _path | append: '/' %}
{% endunless %}
{% assign _src_prefix = _src_prefix | append: _path %}
{% endif %}
{% assign _final_src = _src_prefix | append: _src %}
{% assign _left = _left | replace: _src, _final_src %}
{% endunless %}
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% assign _left = _left | replace: 'src=', 'data-src=' %}
{% endif %}
<!-- Add SVG placehoder to prevent layout reflow -->
{% if _width and _height %}
{%- capture _svg -%}
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
{%- endcapture -%}
{% assign _left = _svg | append: ' ' | append: _left %}
{% endif %}
<!-- Bypass the HTML-proofer test -->
{% assign _left = _left | append: ' data-proofer-ignore' %}
{% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
{% endfor %} {% endfor %}
@@ -118,22 +161,22 @@
{% assign _left = _snippet | split: '><' | last%} {% assign _left = _snippet | split: '><' | last%}
{% if _left contains 'file="' %} {% if _left contains 'file="' %}
{% assign _text = _left | split: 'file="' | last | split: '"' | first %} {% assign _label_text = _left | split: 'file="' | last | split: '"' | first %}
{% assign _label_icon = 'far fa-file-code' %} {% assign _label_icon = 'far fa-file-code' %}
{% else %} {% else %}
{% assign _lang = _left | split: 'language-' | last | split: ' ' | first %} {% assign _lang = _left | split: 'language-' | last | split: ' ' | first %}
{% capture _text %}{% include language-alias.html language=_lang %}{% endcapture %} {% capture _label_text %}{% include language-alias.html language=_lang %}{% endcapture %}
{% assign _label_icon = 'fas fa-code small' %} {% assign _label_icon = 'fas fa-code small' %}
{% endif %} {% endif %}
{% capture _label %} {% capture _label %}
<span text-data="{{ _text }}"><i class="fa-fw {{ _label_icon }}"></i></span> <span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
{% endcapture %} {% endcapture %}
{% assign _new_content = _new_content | append: _snippet {% assign _new_content = _new_content | append: _snippet
| append: '<div class="code-header">' | append: '<div class="code-header">'
| append: _label | append: _label
| append: '<button aria-label="copy" title-succeed="' | append: '<button aria-label="copy" data-title-succeed="'
| append: site.data.locales[lang].post.button.copy_code.succeed | append: site.data.locales[lang].post.button.copy_code.succeed
| append: '"><i class="far fa-clipboard"></i></button></div>' | append: '"><i class="far fa-clipboard"></i></button></div>'
| append: '<div class="highlight"><code>' | append: '<div class="highlight"><code>'
@@ -147,6 +190,92 @@
{% endif %} {% endif %}
<!-- Create heading anchors -->
{% assign heading_levels = '2,3,4,5' | split: ',' %}
{% assign _heading_content = _content %}
{% for level in heading_levels %}
{% capture mark_start %}<h{{ level }} id="{% endcapture %}
{% capture mark_end %}</h{{ level }}>{% endcapture %}
{% if _heading_content contains mark_start %}
{% assign _new_content = nil %}
{% assign heading_snippets = _heading_content | split: mark_start %}
{% for snippet in heading_snippets %}
{% if forloop.first %}
{% assign _new_content = snippet %}
{% continue %}
{% endif %}
{% assign id = snippet | split: '"' | first %}
{% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %}
{% assign left = snippet | split: mark_end | first %}
{% assign right = snippet | slice: left.size, snippet.size %}
{% assign left = left | replace: '">', '"><span class="mr-2">' | append: '</span>' %}
{% assign _new_content = _new_content | append: mark_start
| append: left | append: anchor | append: right
%}
{% endfor %}
{% assign _heading_content = _new_content %}
{% endif %}
{% endfor %}
{% assign _content = _heading_content %}
<!-- Wrap prompt element of blockquote with the <div> tag -->
{% assign blockquote_start = '<blockquote class=' %}
{% assign blockquote_end = '</blockquote>' %}
{% assign cls_prefix = 'prompt-' %}
{% if _content contains blockquote_start %}
{% assign _prompt_content = nil %}
{% assign _prompt_snippets = _content | split: blockquote_start %}
{% for _snippet in _prompt_snippets %}
{% if forloop.first %}
{% assign _prompt_content = _snippet %}
{% continue %}
{% endif %}
{% assign left = _snippet | split: blockquote_end | first %}
{% assign right = _snippet | slice: left.size, _snippet.size %}
{% assign cls_str = left | split: '>' | first %}
{% assign cls_array = cls_str | remove: '"' | split: ' ' %}
{% assign is_prompt = false %}
{% for cls in cls_array %}
{% if cls contains cls_prefix %}
{% assign is_prompt = true %}
{% break %}
{% endif %}
{% endfor %}
{% unless is_prompt %}
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: _snippet %}
{% continue %}
{% endunless %}
{% assign left = left | slice: cls_str.size, left.size %}
{% assign left = cls_str | append: '><div' | append: left | append: '</div>' %}
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: left | append: right %}
{% endfor %}
{% assign _content = _prompt_content %}
{% endif %}
<!-- return --> <!-- return -->

View File

@@ -60,7 +60,6 @@
{% assign less = TOTAL_SIZE | minus: index_list.size %} {% assign less = TOTAL_SIZE | minus: index_list.size %}
{% if less > 0 %} {% if less > 0 %}
{% for i in (0..last_index) %} {% for i in (0..last_index) %}
{% assign post = site.posts[i] %} {% assign post = site.posts[i] %}
{% if post.url != page.url %} {% if post.url != page.url %}
@@ -74,10 +73,8 @@
{% endunless %} {% endunless %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if index_list.size > 0 %} {% if index_list.size > 0 %}
<div id="related-posts" class="mt-5 mb-2 mb-sm-4"> <div id="related-posts" class="mt-5 mb-2 mb-sm-4">
<h3 class="pt-2 mt-1 mb-4 ml-1" <h3 class="pt-2 mt-1 mb-4 ml-1"
@@ -89,12 +86,12 @@
<div class="card"> <div class="card">
<a href="{{ post.url | relative_url }}"> <a href="{{ post.url | relative_url }}">
<div class="card-body"> <div class="card-body">
{% include timeago.html date=post.date class="small" %} {% include datetime.html date=post.date class="small" %}
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3> <h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
<div class="text-muted small"> <div class="text-muted small">
<p> <p>
{% include no-linenos.html content=post.content %} {% include no-linenos.html content=post.content %}
{{ content | markdownify | strip_html | truncate: 200 }} {{ content | markdownify | strip_html | truncate: 200 | escape }}
</p> </p>
</div> </div>
</div> </div>

View File

@@ -5,7 +5,7 @@
{% capture result_elem %} {% 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"> <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> <a href="{url}">{title}</a>
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1"> <div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
{categories} {categories}
{tags} {tags}
@@ -16,7 +16,7 @@
{% capture not_found %}<p class="mt-5">{{ site.data.locales[lang].search.no_results }}</p>{% endcapture %} {% capture not_found %}<p class="mt-5">{{ site.data.locales[lang].search.no_results }}</p>{% endcapture %}
<script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js"></script> <script src="{{ site.data.assets[origin].search.js | relative_url }}"></script>
<script> <script>
SimpleJekyllSearch({ SimpleJekyllSearch({

View File

@@ -4,15 +4,7 @@
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded"> <div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
<div class="col-12 col-sm-11 post-content"> <div class="col-12 col-sm-11 post-content">
<div id="search-hints"> <div id="search-hints">
<h4 class="text-muted mb-4">{{ site.data.locales[lang].panel.trending_tags }}</h4>
{% include trending-tags.html %} {% include trending-tags.html %}
{% for tag in trending_tags %}
{% capture url %}/tags/{{ tag | slugify | url_encode }}/{% endcapture %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
{% endfor %}
</div> </div>
<div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div> <div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
</div> </div>

View File

@@ -2,20 +2,22 @@
The Side Bar The Side Bar
--> -->
<div id="sidebar" class="d-flex flex-column align-items-end" lang="{{lang}}"> <div id="sidebar" class="d-flex flex-column align-items-end">
<div class="profile-wrapper text-center"> <div class="profile-wrapper text-center">
<div id="avatar"> <div id="avatar">
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto"> <a href="{{ '/' | relative_url }}" class="mx-auto">
{% capture avatar_url %} {% if site.avatar != empty and site.avatar %}
{%- if site.avatar contains '://' -%} {% capture avatar_url %}
{{ site.avatar }} {% if site.avatar contains '://' %}
{%- elsif site.img_cdn != '' and site.img_cdn -%} {{ site.avatar }}
{{ site.avatar | prepend: site.img_cdn }} {% elsif site.img_cdn != empty and site.img_cdn %}
{%- else -%} {{ site.avatar | prepend: site.img_cdn }}
{{ site.avatar | relative_url }} {% else %}
{%- endif -%} {{ site.avatar | relative_url }}
{% endcapture %} {% endif %}
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'"> {% endcapture %}
<img src="{{ avatar_url | strip }}" alt="avatar" onerror="this.style.display='none'">
{% endif %}
</a> </a>
</div> </div>
@@ -51,6 +53,16 @@
<div class="sidebar-bottom mt-auto d-flex flex-wrap justify-content-center align-items-center"> <div class="sidebar-bottom mt-auto d-flex flex-wrap justify-content-center align-items-center">
{% unless site.theme_mode %}
<button class="mode-toggle btn" aria-label="Switch Mode">
<i class="fas fa-adjust"></i>
</button>
{% if site.data.contact.size > 0 %}
<span class="icon-border"></span>
{% endif %}
{% endunless %}
{% for entry in site.data.contact %} {% for entry in site.data.contact %}
{% capture url %} {% capture url %}
{%- if entry.type == 'github' -%} {%- if entry.type == 'github' -%}
@@ -69,7 +81,6 @@
{% if url %} {% if url %}
<a href="{{ url }}" aria-label="{{ entry.type }}" <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 %}> {% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
<i class="{{ entry.icon }}"></i> <i class="{{ entry.icon }}"></i>
</a> </a>
@@ -77,16 +88,6 @@
{% endfor %} {% endfor %}
{% 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-bottom -->
</div><!-- #sidebar --> </div><!-- #sidebar -->

View File

@@ -1,27 +0,0 @@
<!--
Date format snippet
See: /assets/js/_utils/timeage.js
-->
{% assign tooltip_df = site.data.locales[lang].date_format.tooltip %}
{% assign post_long_df = site.data.locales[lang].date_format.post.long %}
{% assign post_short_df = site.data.locales[lang].date_format.post.short %}
{% if include.preposition %}
{{ include.preposition }}
{% endif %}
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
{% if include.tooltip %}
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: tooltip_df }}"
{% endif %}>
{%- assign this_year = site.time | date: "%Y" -%}
{%- assign post_year = include.date | date: "%Y" -%}
{%- if post_year == this_year -%}
{{ include.date | date: post_short_df }}
{%- else -%}
{{ include.date | date: post_long_df }}
{%- endif -%}
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
</span>

16
_includes/toc.html Normal file
View File

@@ -0,0 +1,16 @@
{% assign enable_toc = false %}
{% if site.toc and page.toc %}
{% if page.content contains '<h2' or page.content contains '<h3' %}
{% assign enable_toc = true %}
{% endif %}
{% endif %}
{% if enable_toc %}
<!-- BS-toc.js will be loaded at medium priority -->
<script src="{{ site.data.assets[origin].bootstrap-toc.js | relative_url }}"></script>
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[lang].panel.toc -}}</div>
<nav id="toc" data-toggle="toc"></nav>
</div>
{% endif %}

View File

@@ -2,8 +2,8 @@
The Top Bar The Top Bar
--> -->
<div id="topbar-wrapper" class="row justify-content-center topbar-down"> <div id="topbar-wrapper">
<div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between"> <div id="topbar" class="container d-flex align-items-center justify-content-between h-100 pl-3 pr-3 pl-md-4 pr-md-4">
<span id="breadcrumb"> <span id="breadcrumb">
{% assign paths = page.url | split: '/' %} {% assign paths = page.url | split: '/' %}
@@ -50,7 +50,7 @@
<div id="topbar-title"> <div id="topbar-title">
{% if page.layout == 'home' %} {% if page.layout == 'home' %}
{{- site.data.locales[lang].title | default: site.title -}} {{- site.data.locales[lang].title | default: site.title -}}
{% elsif page.collection == 'tabs' %} {% elsif page.collection == 'tabs' or page.layout == 'page' %}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%} {%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[lang].tabs[tab_key] | default: page.title -}} {{- site.data.locales[lang].tabs[tab_key] | default: page.title -}}
{% else %} {% else %}
@@ -63,7 +63,6 @@
<i class="fas fa-search fa-fw"></i> <i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search" <input class="form-control" id="search-input" type="search"
aria-label="search" autocomplete="off" placeholder="{{ site.data.locales[lang].search.hint | capitalize }}..."> aria-label="search" autocomplete="off" placeholder="{{ site.data.locales[lang].search.hint | capitalize }}...">
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span> </span>
<span id="search-cancel" >{{ site.data.locales[lang].search.cancel }}</span> <span id="search-cancel" >{{ site.data.locales[lang].search.cancel }}</span>
</div> </div>

View File

@@ -34,3 +34,17 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% if trending_tags.size > 0 %}
<div id="access-tags">
<div class="panel-heading">{{- site.data.locales[lang].panel.trending_tags -}}</div>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% 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>
</div>
{% endif %}

View File

@@ -22,3 +22,19 @@
{% for entry in all_list limit:MAX_SIZE %} {% for entry in all_list limit:MAX_SIZE %}
{% assign update_list = update_list | push: entry %} {% assign update_list = update_list | push: entry %}
{% endfor %} {% endfor %}
{% if update_list.size > 0 %}
<div id="access-lastmod" class="post">
<div class="panel-heading">{{- site.data.locales[lang].panel.lastmod -}}</div>
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %}
{% assign index = item | split: "::" | last | plus: 0 %}
{% assign post = site.posts[index] %}
{% assign url = post.url | relative_url %}
<li><a href="{{ url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div> <!-- #access-lastmod -->
{% endif %}

View File

@@ -0,0 +1,13 @@
/*
* Listener for theme mode toggle
*/
$(function() {
$(".mode-toggle").click((e) => {
const $target = $(e.target);
let $btn = ($target.prop("tagName") === "button".toUpperCase() ?
$target : $target.parent());
$btn.blur(); // remove the clicking outline
flipMode();
});
});

View File

@@ -0,0 +1,36 @@
/**
* A tool for smooth scrolling and topbar switcher
*/
const ScrollHelper = (function () {
const $body = $("body");
const ATTR_TOPBAR_VISIBLE = "data-topbar-visible";
const topbarHeight = $("#topbar-wrapper").outerHeight();
let scrollUpCount = 0; // the number of times the scroll up was triggered by ToC or anchor
let topbarLocked = false;
let orientationLocked = false;
return {
hideTopbar: () => $body.attr(ATTR_TOPBAR_VISIBLE, false),
showTopbar: () => $body.attr(ATTR_TOPBAR_VISIBLE, true),
// scroll up
addScrollUpTask: () => {
scrollUpCount += 1;
if (!topbarLocked) { topbarLocked = true; }
},
popScrollUpTask: () => scrollUpCount -= 1,
hasScrollUpTask: () => scrollUpCount > 0,
topbarLocked: () => topbarLocked === true,
unlockTopbar: () => topbarLocked = false,
getTopbarHeight: () => topbarHeight,
// orientation change
orientationLocked: () => orientationLocked === true,
lockOrientation: () => orientationLocked = true,
unLockOrientation: () => orientationLocked = false
};
}());

View File

@@ -3,12 +3,9 @@
*/ */
$(function() { $(function() {
const btnSbTrigger = $("#sidebar-trigger"); const btnSbTrigger = $("#sidebar-trigger");
const btnSearchTrigger = $("#search-trigger"); const btnSearchTrigger = $("#search-trigger");
const btnCancel = $("#search-cancel"); const btnCancel = $("#search-cancel");
const btnClear = $("#search-cleaner");
const main = $("#main"); const main = $("#main");
const topbarTitle = $("#topbar-title"); const topbarTitle = $("#topbar-title");
const searchWrapper = $("#search-wrapper"); const searchWrapper = $("#search-wrapper");
@@ -33,8 +30,7 @@ $(function() {
}; };
}()); }());
/*--- Actions in mobile screens (Sidebar hidden) ---*/
/*--- Actions in small screens (Sidebar unloaded) ---*/
const mobileSearchBar = (function () { const mobileSearchBar = (function () {
return { return {
@@ -75,7 +71,6 @@ $(function() {
hints.removeClass("unloaded"); hints.removeClass("unloaded");
} }
resultWrapper.addClass("unloaded"); resultWrapper.addClass("unloaded");
btnClear.removeClass("visible");
main.removeClass("unloaded"); main.removeClass("unloaded");
// now the release method must be called after $(#main) display // now the release method must be called after $(#main) display
@@ -92,7 +87,6 @@ $(function() {
}()); }());
function isMobileView() { function isMobileView() {
return btnCancel.hasClass("loaded"); return btnCancel.hasClass("loaded");
} }
@@ -116,38 +110,20 @@ $(function() {
searchWrapper.removeClass("input-focus"); searchWrapper.removeClass("input-focus");
}); });
input.on("keyup", function(e) { input.on("input", () => {
if (e.keyCode === 8 && input.val() === "") { if (input.val() === "") {
if (!isMobileView()) { if (isMobileView()) {
resultSwitch.off();
} else {
hints.removeClass("unloaded"); hints.removeClass("unloaded");
} else {
resultSwitch.off();
} }
} else { } else {
if (input.val() !== "") { resultSwitch.on();
resultSwitch.on(); if (isMobileView()) {
hints.addClass("unloaded");
if (!btnClear.hasClass("visible")) {
btnClear.addClass("visible");
}
if (isMobileView()) {
hints.addClass("unloaded");
}
} }
} }
}); });
btnClear.on("click", function() {
input.val("");
if (isMobileView()) {
hints.removeClass("unloaded");
results.empty();
} else {
resultSwitch.off();
}
input.focus();
btnClear.removeClass("visible");
});
}); });

View File

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

View File

@@ -0,0 +1,90 @@
/*
* Hide Header on scroll down
*/
$(function() {
const $searchInput = $("#search-input");
const delta = ScrollHelper.getTopbarHeight();
let didScroll;
let lastScrollTop = 0;
function hasScrolled() {
let st = $(this).scrollTop();
/* Make sure they scroll more than delta */
if (Math.abs(lastScrollTop - st) <= delta) {
return;
}
if (st > lastScrollTop ) { // Scroll Down
ScrollHelper.hideTopbar();
if ($searchInput.is(":focus")) {
$searchInput.blur(); /* remove focus */
}
} else { // Scroll up
// has not yet scrolled to the bottom of the screen, that is, there is still space for scrolling
if (st + $(window).height() < $(document).height()) {
if (ScrollHelper.hasScrollUpTask()) {
return;
}
if (ScrollHelper.topbarLocked()) { // avoid redundant scroll up event from smooth scrolling
ScrollHelper.unlockTopbar();
} else {
if (ScrollHelper.orientationLocked()) { // avoid device auto scroll up on orientation change
ScrollHelper.unLockOrientation();
} else {
ScrollHelper.showTopbar();
}
}
}
}
lastScrollTop = st;
} // hasScrolled()
function handleLandscape() {
if ($(window).scrollTop() === 0) {
return;
}
ScrollHelper.lockOrientation();
ScrollHelper.hideTopbar();
}
if (screen.orientation) {
screen.orientation.onchange = () => {
const type = screen.orientation.type;
if (type === "landscape-primary" || type === "landscape-secondary") {
handleLandscape();
}
};
} else {
// for the browsers that not support `window.screen.orientation` API
$(window).on("orientationchange",() => {
if ($(window).width() < $(window).height()) { // before rotating, it is still in portrait mode.
handleLandscape();
}
});
}
$(window).scroll(() => {
if (didScroll) {
return;
}
didScroll = true;
});
setInterval(() => {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);
});

View File

@@ -1,46 +1,66 @@
/* /*
* Top bar title auto change while scrolling in mobile screens. * Top bar title auto change while scrolling up/down in mobile screens.
*/ */
$(function() { $(function() {
const titleSelector = "div.post>h1:first-of-type";
const $pageTitle = $(titleSelector);
const $topbarTitle = $("#topbar-title");
const topbarTitle = $("#topbar-title"); if ($pageTitle.length === 0 /* on Home page */
const postTitle = $("div.post>h1"); || $pageTitle.hasClass("dynamic-title")
|| $topbarTitle.is(":hidden")) {/* not in mobile views */
return;
}
const DEFAULT = topbarTitle.text().trim(); const defaultTitleText = $topbarTitle.text().trim();
let pageTitleText = $pageTitle.text().trim();
let title = (postTitle.length > 0) ? let hasScrolled = false;
postTitle.text().trim() : $("h1").text().trim(); let lastScrollTop = 0;
if ($("#page-category").length || $("#page-tag").length) { if ($("#page-category").length || $("#page-tag").length) {
/* The title in Category or Tag page will be "<title> <count_of_posts>" */ /* The title in Category or Tag page will be "<title> <count_of_posts>" */
if (/\s/.test(title)) { if (/\s/.test(pageTitleText)) {
title = title.replace(/[0-9]/g, "").trim(); pageTitleText = pageTitleText.replace(/[0-9]/g, "").trim();
} }
} }
/* Replace topbar title while scroll screens. */ // When the page is scrolled down and then refreshed, the topbar title needs to be initialized
$(window).scroll(function () { if ($pageTitle.offset().top < $(window).scrollTop()) {
if ($("#post-list").length /* in Home page */ $topbarTitle.text(pageTitleText);
|| postTitle.is(":hidden") /* is tab pages */ }
|| topbarTitle.is(":hidden") /* not mobile screens */
|| $("#sidebar.sidebar-expand").length) { /* when the sidebar trigger is clicked */ let options = {
return false; rootMargin: '-48px 0px 0px 0px', // 48px equals to the topbar height (3rem)
threshold: [0, 1]
};
let observer = new IntersectionObserver((entries) => {
if (!hasScrolled) {
hasScrolled = true;
return;
} }
if ($(this).scrollTop() >= 95) { let curScrollTop = $(window).scrollTop();
if (topbarTitle.text() !== title) { let isScrollDown = lastScrollTop < curScrollTop;
topbarTitle.text(title); lastScrollTop = curScrollTop;
let heading = entries[0];
if (isScrollDown) {
if (heading.intersectionRatio === 0) {
$topbarTitle.text(pageTitleText);
} }
} else { } else {
if (topbarTitle.text() !== DEFAULT) { if (heading.intersectionRatio === 1) {
topbarTitle.text(DEFAULT); $topbarTitle.text(defaultTitleText);
} }
} }
}); }, options);
/* Click title remove hover effect. */ observer.observe(document.querySelector(titleSelector));
topbarTitle.click(function() {
/* Click title will scroll to top */
$topbarTitle.click(function() {
$("body,html").animate({scrollTop: 0}, 800); $("body,html").animate({scrollTop: 0}, 800);
}); });

View File

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

View File

@@ -10,6 +10,8 @@ $(function() {
const btnSelector = '.code-header>button'; const btnSelector = '.code-header>button';
const ICON_SUCCESS = 'fas fa-check'; const ICON_SUCCESS = 'fas fa-check';
const ATTR_TIMEOUT = 'timeout'; const ATTR_TIMEOUT = 'timeout';
const ATTR_TITLE_SUCCEED = 'data-title-succeed';
const ATTR_TITLE_ORIGIN = 'data-original-title';
const TIMEOUT = 2000; // in milliseconds const TIMEOUT = 2000; // in milliseconds
function isLocked(node) { function isLocked(node) {
@@ -53,12 +55,12 @@ $(function() {
const ICON_DEFAULT = getIcon(btnSelector); const ICON_DEFAULT = getIcon(btnSelector);
function showTooltip(btn) { function showTooltip(btn) {
const succeedTitle = $(btn).attr('title-succeed'); const succeedTitle = $(btn).attr(ATTR_TITLE_SUCCEED);
$(btn).attr('data-original-title', succeedTitle).tooltip('show'); $(btn).attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show');
} }
function hideTooltip(btn) { function hideTooltip(btn) {
$(btn).tooltip('hide').removeAttr('data-original-title'); $(btn).tooltip('hide').removeAttr(ATTR_TITLE_ORIGIN);
} }
function setSuccessIcon(btn) { function setSuccessIcon(btn) {
@@ -115,14 +117,14 @@ $(function() {
// Switch tooltip title // Switch tooltip title
const defaultTitle = target.attr('data-original-title'); const defaultTitle = target.attr(ATTR_TITLE_ORIGIN);
const succeedTitle = target.attr('title-succeed'); const succeedTitle = target.attr(ATTR_TITLE_SUCCEED);
target.attr('data-original-title', succeedTitle).tooltip('show'); target.attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show');
lock(target); lock(target);
setTimeout(() => { setTimeout(() => {
target.attr('data-original-title', defaultTitle); target.attr(ATTR_TITLE_ORIGIN, defaultTitle);
unlock(target); unlock(target);
}, TIMEOUT); }, TIMEOUT);

View File

@@ -0,0 +1,45 @@
/**
* Update month/day to locale datetime
*
* Requirement: <https://github.com/iamkun/dayjs>
*/
/* A tool for locale datetime */
const LocaleHelper = (function () {
const $preferLocale = $('meta[name="prefer-datetime-locale"]');
const locale = $preferLocale.length > 0 ?
$preferLocale.attr('content').toLowerCase() : $('html').attr('lang').substr(0, 2);
const attrTimestamp = 'data-ts';
const attrDateFormat = 'data-df';
return {
locale: () => locale,
attrTimestamp: () => attrTimestamp,
attrDateFormat: () => attrDateFormat,
getTimestamp: ($elem) => Number($elem.attr(attrTimestamp)), // unix timestamp
getDateFormat: ($elem) => $elem.attr(attrDateFormat)
};
}());
$(function() {
dayjs.locale(LocaleHelper.locale());
dayjs.extend(window.dayjs_plugin_localizedFormat);
$(`[${LocaleHelper.attrTimestamp()}]`).each(function () {
const date = dayjs.unix(LocaleHelper.getTimestamp($(this)));
const text = date.format(LocaleHelper.getDateFormat($(this)));
$(this).text(text);
$(this).removeAttr(LocaleHelper.attrTimestamp());
$(this).removeAttr(LocaleHelper.attrDateFormat());
// setup tooltips
const tooltip = $(this).attr('data-toggle');
if (typeof tooltip === 'undefined' || tooltip !== 'tooltip') {
return;
}
const tooltipText = date.format('llll'); // see: https://day.js.org/docs/en/display/format#list-of-localized-formats
$(this).attr('data-original-title', tooltipText);
});
});

View File

@@ -8,74 +8,89 @@
*/ */
$(function() { $(function() {
const $topbarTitle = $("#topbar-title");
const REM = 16; // in pixels
const ATTR_SCROLL_FOCUS = "scroll-focus";
$("a[href*='#']") $("a[href*='#']")
.not("[href='#']") .not("[href='#']")
.not("[href='#0']") .not("[href='#0']")
.click(function(event) { .click(function(event) {
if (this.pathname.replace(/^\//, "") !==
location.pathname.replace(/^\//, "")) {
return;
}
if (this.pathname.replace(/^\//, "") === location.pathname.replace(/^\//, "")) { if (location.hostname !== this.hostname) {
if (location.hostname === this.hostname) { return;
}
const REM = 16; /* 16px */ const hash = decodeURI(this.hash);
let toFootnoteRef = RegExp(/^#fnref:/).test(hash);
let toFootnote = toFootnoteRef ? false : RegExp(/^#fn:/).test(hash);
let selector = hash.includes(":") ? hash.replace(/\:/g, "\\:") : hash;
let $target = $(selector);
const hash = decodeURI(this.hash); let isMobileViews = $topbarTitle.is(":visible");
let isFnRef = RegExp(/^#fnref:/).test(hash); let isPortrait = $(window).width() < $(window).height();
let isFn = RegExp(/^#fn:/).test(hash);
let selector = hash.includes(":") ? hash.replace(/\:/, "\\:") : hash;
let target = $(selector);
if (target.length) { if (typeof $target === "undefined") {
event.preventDefault(); return;
}
if (history.pushState) { /* add hash to URL */ event.preventDefault();
history.pushState(null, null, hash);
}
let curOffset = $(this).offset().top; if (history.pushState) { /* add hash to URL */
let destOffset = target.offset().top; history.pushState(null, null, hash);
const scrollUp = (destOffset < curOffset); }
const topbarHeight = $("#topbar-wrapper").outerHeight();
if (scrollUp && isFnRef) { let curOffset = $(window).scrollTop();
/* Avoid the top-bar covering `fnref` when scrolling up let destOffset = $target.offset().top -= REM / 2;
because `fnref` has no `%anchor`(see: module.scss) style. */
destOffset -= (topbarHeight + REM / 2);
}
$("html,body").animate({ if (destOffset < curOffset) { // scroll up
scrollTop: destOffset ScrollHelper.hideTopbar();
}, 800, () => { ScrollHelper.addScrollUpTask();
const $target = $(target); if (isMobileViews && isPortrait) {
$target.focus(); destOffset -= ScrollHelper.getTopbarHeight();
}
const SCROLL_MARK = "scroll-focus"; } else { // scroll down
if (isMobileViews && isPortrait) {
/* clean up old scroll mark */ destOffset -= ScrollHelper.getTopbarHeight();
if ($(`[${SCROLL_MARK}=true]`).length) {
$(`[${SCROLL_MARK}=true]`).attr(SCROLL_MARK, false);
}
/* Clean :target links */
if ($(":target").length) { /* element that visited by the URL with hash */
$(":target").attr(SCROLL_MARK, false);
}
/* set scroll mark to footnotes */
if (isFn || isFnRef) {
$target.attr(SCROLL_MARK, true);
}
if ($target.is(":focus")) { /* Checking if the target was focused */
return false;
} else {
$target.attr("tabindex", "-1"); /* Adding tabindex for elements not focusable */
$target.focus(); /* Set focus again */
}
});
}
} }
} }
$("html").animate({
scrollTop: destOffset
}, 500, () => {
$target.focus();
/* clean up old scroll mark */
if ($(`[${ATTR_SCROLL_FOCUS}=true]`).length) {
$(`[${ATTR_SCROLL_FOCUS}=true]`).attr(ATTR_SCROLL_FOCUS, false);
}
/* Clean :target links */
if ($(":target").length) { /* element that visited by the URL with hash */
$(":target").attr(ATTR_SCROLL_FOCUS, false);
}
/* set scroll mark to footnotes */
if (toFootnote || toFootnoteRef) {
$target.attr(ATTR_SCROLL_FOCUS, true);
}
if ($target.is(":focus")) { /* Checking if the target was focused */
return false;
} else {
$target.attr("tabindex", "-1"); /* Adding tabindex for elements not focusable */
$target.focus(); /* Set focus again */
}
if (ScrollHelper.hasScrollUpTask()) {
ScrollHelper.popScrollUpTask();
}
});
}); /* click() */ }); /* click() */
}); });

View File

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

View File

@@ -5,8 +5,15 @@ layout: page
{% include lang.html %} {% include lang.html %}
<div id="archives" class="pl-xl-2"> {% if site.prefer_datetime_locale == 'en' or lang == 'en' %}
{% assign df_strftime_m = '%b' %}
{% assign df_dayjs_m = 'MMM' %}
{% else %}
{% assign df_strftime_m = '/ %m' %}
{% assign df_dayjs_m = '/ MM' %}
{% endif %}
<div id="archives" class="pl-xl-2">
{% for post in site.posts %} {% for post in site.posts %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %} {% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
@@ -18,11 +25,13 @@ layout: page
{% endif %} {% endif %}
<li> <li>
<div> <div>
{% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %} {% assign ts = post.date | date: '%s' %}
{% capture _mth_df %}{{ site.data.locales[lang].date_format.post.archive_month }}{% endcapture %} <span class="date day" data-ts="{{ ts }}" data-df="DD">
{% capture this_month %}{{ post.date | date: _mth_df }}{% endcapture %} {{ post.date | date: "%d" }}
<span class="date day">{{ this_day }}</span> </span>
<span class="date month small text-muted">{% include no-zero-date.html date_str=this_month %}</span> <span class="date month small text-muted" data-ts="{{ ts }}" data-df="{{ df_dayjs_m }}">
{{ post.date | date: df_strftime_m }}
</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div> </div>
</li> </li>

View File

@@ -47,10 +47,24 @@ layout: page
<span class="text-muted small font-weight-light"> <span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %} {% if sub_categories_size > 0 %}
{{ sub_categories_size }} {{ sub_categories_size }}
{{ site.data.locales[lang].categories.category_measure }}, {% if sub_categories_size > 1 %}
{{ site.data.locales[lang].categories.category_measure.plural
| default: site.data.locales[lang].categories.category_measure }}
{% else %}
{{ site.data.locales[lang].categories.category_measure.singular
| default: site.data.locales[lang].categories.category_measure }}
{% endif %},
{% endif %}
{{ top_posts_size }}
{% if top_posts_size > 1 %}
{{ site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure }}
{% else %}
{{ site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure }}
{% endif %} {% endif %}
{{ top_posts_size }}
{{ site.data.locales[lang].categories.post_measure }}
</span> </span>
</span> </span>
@@ -83,7 +97,14 @@ layout: page
{% assign posts_size = site.categories[sub_category] | size %} {% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light"> <span class="text-muted small font-weight-light">
{{ posts_size }} {{ posts_size }}
{{ site.data.locales[lang].categories.post_measure }}
{% if posts_size > 1 %}
{{ site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure }}
{% else %}
{{ site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure }}
{% endif %}
</span> </span>
</li> </li>
{% endfor %} {% endfor %}

View File

@@ -13,13 +13,11 @@ layout: page
</h1> </h1>
<ul class="post-content pl-0"> <ul class="post-content pl-0">
{% assign post_df = site.data.locales[lang].date_format.post.long %}
{% for post in page.posts %} {% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3"> <li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span> <span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: post_df }}</span> {% include datetime.html date=post.date wrap='span' class='text-muted small' %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@@ -7,26 +7,28 @@ layout: compress
{% include lang.html %} {% include lang.html %}
{% include assets-origin.html %}
{% capture prefer_mode %} {% capture prefer_mode %}
{% if site.theme_mode %} {% if site.theme_mode %}
mode="{{ site.theme_mode }}" data-mode="{{ site.theme_mode }}"
{% endif %} {% endif %}
{% endcapture %} {% endcapture %}
<html lang="{{ site.lang }}" {{ prefer_mode }}> <html lang="{{ site.lang }}"{{ prefer_mode }}>
{% include head.html %} {% include head.html %}
<body data-spy="scroll" data-target="#toc"> <body data-spy="scroll" data-target="#toc" data-topbar-visible="true">
{% include sidebar.html %} {% include sidebar.html %}
{% include topbar.html %} {% include topbar.html %}
<div id="main-wrapper"> <div id="main-wrapper" class="d-flex justify-content-center">
<div id="main"> <div id="main" class="container pl-xl-4 pr-xl-4">
{% include refactor-content.html content=content %} {{ content }}
{% include footer.html %} {% include footer.html %}
@@ -46,6 +48,23 @@ layout: compress
<i class="fas fa-angle-up"></i> <i class="fas fa-angle-up"></i>
</a> </a>
{% if site.pwa.enabled %}
<div id="notification" class="toast" role="alert" aria-live="assertive" aria-atomic="true"
data-animation="true" data-autohide="false">
<div class="toast-header">
<button type="button" class="ml-2 ml-auto close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body text-center pt-0">
<p class="pl-2 pr-2 mb-3">{{ site.data.locales[lang].notification.update_found }}</p>
<button type="button" class="btn btn-primary" aria-label="Update">
{{ site.data.locales[lang].notification.update }}
</button>
</div>
</div>
{% endif %}
{% include search-loader.html %} {% include search-loader.html %}
{% include js-selector.html %} {% include js-selector.html %}

View File

@@ -6,7 +6,7 @@ layout: page
{% include lang.html %} {% include lang.html %}
{% assign pinned = site.posts | where: "pin", "true" %} {% assign pinned = site.posts | where: "pin", "true" %}
{% assign default = site.posts | where_exp: "item", "item.pin != true" %} {% assign default = site.posts | where_exp: "item", "item.pin != true and item.hidden != true" %}
{% assign posts = "" | split: "" %} {% assign posts = "" | split: "" %}
@@ -23,7 +23,6 @@ layout: page
{% assign pinned_num = 0 %} {% assign pinned_num = 0 %}
{% endif %} {% endif %}
<!-- Get default posts --> <!-- Get default posts -->
{% assign default_beg = offset | minus: pinned.size %} {% assign default_beg = offset | minus: pinned.size %}
@@ -53,28 +52,28 @@ layout: page
<div class="post-content"> <div class="post-content">
<p> <p>
{% include no-linenos.html content=post.content %} {% include no-linenos.html content=post.content %}
{{ content | markdownify | strip_html | truncate: 200 }} {{ content | markdownify | strip_html | truncate: 200 | escape }}
</p> </p>
</div> </div>
<div class="post-meta text-muted d-flex justify-content-between"> <div class="post-meta text-muted d-flex">
<div class="mr-auto">
<div>
<!-- posted date --> <!-- posted date -->
<i class="far fa-calendar fa-fw"></i> <i class="far fa-calendar fa-fw"></i>
{% include timeago.html date=post.date tooltip=true %} {% include datetime.html date=post.date %}
<!-- time to read --> <!-- categories -->
<i class="far fa-clock fa-fw"></i> {% if post.categories.size > 0 %}
{% include read-time.html content=post.content %} <i class="far fa-folder-open fa-fw"></i>
<span>
<!-- page views --> {% for category in post.categories %}
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} {{ category }}
<i class="far fa-eye fa-fw"></i> {%- unless forloop.last -%},{%- endunless -%}
<span id="pv_{{-post.title-}}" class="pageviews"> {% endfor %}
<i class="fas fa-spinner fa-spin fa-fw"></i> </span>
</span>
{% endif %} {% endif %}
</div> </div>
{% if post.pin %} {% if post.pin %}

View File

@@ -1,41 +1,64 @@
--- ---
layout: default layout: default
# The page layout
--- ---
{% include lang.html %}
{% include assets-origin.html %}
<div class="row"> <div class="row">
<div class="col-12 col-lg-11 col-xl-8">
<div id="page" class="post pb-5 pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4 mb-md-4"> <!-- core -->
{% if page.dynamic_title %} <div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pr-xl-4">
<div class="post pl-1 pr-1 pl-md-2 pr-md-2">
{% capture _content %}
{% if layout.refactor or page.layout == 'page' %}
{% include refactor-content.html content=content %}
{% else %}
{{ content }}
{% endif %}
{% endcapture %}
{% if page.layout == 'page' or page.collection == 'tabs'%}
{% assign title = site.data.locales[lang].tabs[tab_key] | default: page.title %}
<h1 class="dynamic-title"> <h1 class="dynamic-title">
{% if page.collection == 'tabs' %} {{ title }}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[lang].tabs[tab_key] | default: page.title -}}
{% else %}
{{- page.title -}}
{% endif %}
</h1> </h1>
<div class="post-content"> <div class="post-content">
{{ content }} {{ _content }}
</div> </div>
{% else %} {% else %}
{{ content }} {{ _content }}
{% endif %} {% endif %}
</div> <!-- #page -->
</div><!-- .col-12 -->
{% include panel.html %} </div>
</div> <!-- #core-wrapper -->
<!-- pannel -->
<div id="panel-wrapper" class="col-xl-3 pl-2 text-muted">
<div class="access">
{% include update-list.html %}
{% include trending-tags.html %}
</div>
{% for _include in layout.pannel_includes %}
{% assign _include_path = _include | append: '.html' %}
{% include {{ _include_path }} %}
{% endfor %}
</div>
</div> </div>
{% if site.disqus.comments and page.comments %} <!-- tail -->
{% if layout.tail_includes %}
<div class="row"> <div class="row">
<div class="col-12 col-lg-11 col-xl-8"> <div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 pl-3 pr-3 pr-xl-4">
<div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4"> {% for _include in layout.tail_includes %}
{% assign _include_path = _include | append: '.html' %}
{% include disqus.html %} {% include {{ _include_path }} %}
{% endfor %}
</div> <!-- .pl-1 pr-1 --> </div>
</div> <!-- .col-12 --> </div>
</div> <!-- .row -->
{% endif %} {% endif %}

View File

@@ -1,143 +1,152 @@
--- ---
layout: default layout: page
# The posts' layout refactor: true
pannel_includes:
- toc
tail_includes:
- related-posts
- post-nav
- comments
--- ---
{% include lang.html %} {% include lang.html %}
<div class="row"> <h1 data-toc-skip>{{ page.title }}</h1>
<div id="post-wrapper" class="col-12 col-lg-11 col-xl-8"> <div class="post-meta text-muted">
<!-- published date -->
<span>
{{ site.data.locales[lang].post.posted }}
{% include datetime.html date=page.date tooltip=true %}
</span>
<div class="post pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4"> <!-- lastmod date -->
{% if page.last_modified_at %}
<h1 data-toc-skip>{{ page.title }}</h1> <span>
{{ site.data.locales[lang].post.updated }}
<div class="post-meta text-muted d-flex flex-column"> {% include datetime.html date=page.last_modified_at tooltip=true %}
<!-- Published date and author --> </span>
<div>
<span class="semi-bold">
{{ page.author | default: site.social.name }}
</span>
{% capture _preposition %}{{ site.data.locales[lang].post.published }}{% endcapture %}
{% include timeago.html date=page.date tooltip=true preposition=_preposition %}
</div>
<div>
<!-- lastmod -->
{% if page.last_modified_at %}
<span>
{{ site.data.locales[lang].post.updated }}
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
</span>
{% endif %}
<!-- read time -->
{% include read-time.html content=content prompt=true %}
<!-- page views -->
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<span id="pv" class="pageviews">
<i class="fas fa-spinner fa-spin fa-fw"></i>
</span>
{{ site.data.locales[lang].post.pageview_measure }}
{% endif %}
</div>
</div> <!-- .post-meta -->
<div class="post-content">
{% if page.image.src %}
<img src="{{ page.image.src }}"
class="preview-img"
alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %}width="{{ page.image.width }}"{% endif %}
{% if page.image.height %}height="{{ page.image.height }}"{% endif %}>
{% endif %}
{{ content }}
</div>
<div class="post-tail-wrapper text-muted">
<!-- categories -->
{% if page.categories.size > 0 %}
<div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw mr-1"></i>
{% for category in page.categories %}
<a href='{{ site.baseurl }}/categories/{{ category | slugify | url_encode }}/'>{{ category }}</a>
{%- unless forloop.last -%}, {%- endunless -%}
{% endfor %}
</div>
{% endif %}
<!-- tags -->
{% if page.tags.size > 0 %}
<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 | slugify | url_encode }}/"
class="post-tag no-text-decoration" >
{{- tag -}}
</a>
{% endfor %}
</div>
{% endif %}
<div class="post-tail-bottom
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
<div class="license-wrapper">
{% if site.data.locales[lang].copyright.license.template %}
{% capture _replacement %}
<a href="{{ site.data.locales[lang].copyright.license.link }}">
{{ site.data.locales[lang].copyright.license.name }}
</a>
{% endcapture %}
{{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
{% endif %}
</div>
{% include post-sharing.html %}
</div><!-- .post-tail-bottom -->
</div><!-- div.post-tail -->
</div> <!-- .post -->
</div> <!-- #post-wrapper -->
{% assign enable_toc = false %}
{% if site.toc and page.toc %}
{% if content contains '<h2' or content contains '<h3' %}
{% assign enable_toc = true %}
{% endif %} {% endif %}
{% if page.image.path %}
{% capture bg %}
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
{% endcapture %}
<div class="mt-3 mb-3">
<img src="{{ page.image.path }}" class="preview-img {{ bg | strip }}"
alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %}
width="{{ page.image.width }}"
{% elsif page.image.w %}
width="{{ page.image.w }}"
{% endif %}
{% if page.image.height %}
height="{{ page.image.height }}"
{% elsif page.image.h %}
height="{{ page.image.h }}"
{% endif %}>
{% if page.image.alt %}
<figcaption class="pt-2 pb-2">{{ page.image.alt }}</figcaption>
{% endif %}
</div>
{% endif %} {% endif %}
{% include panel.html toc=enable_toc %} <div class="d-flex justify-content-between">
<!-- author -->
<span>
{% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %}
{% assign author_link = nil %}
</div> <!-- .row --> {% if page.author %}
{% assign author_link = site.data.authors[page.author].url %}
{% elsif author_name == site.social.name %}
{% assign author_link = site.social.links[0] %}
{% endif %}
<div class="row"> {{ site.data.locales[lang].post.written_by }}
<div class="col-12 col-lg-11 col-xl-8">
<div id="post-extend-wrapper" class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4">
{% include related-posts.html %} <em>
{% if author_link %}
<a href="{{ author_link }}">{{ author_name }}</a>
{% else %}
{{ author_name }}
{% endif %}
</em>
</span>
{% include post-nav.html %} <div>
<!-- page views -->
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<span>
<em id="pv" class="pageviews">
<i class="fas fa-spinner fa-spin fa-fw"></i>
</em>
{{ site.data.locales[lang].post.pageview_measure }}
</span>
{% endif %}
{% if site.disqus.comments and page.comments %} <!-- read time -->
{% include disqus.html %} {% include read-time.html content=content prompt=true %}
{% endif %} </div>
</div> <!-- #post-extend-wrapper --> </div> <!-- .d-flex -->
</div> <!-- .col-* --> </div> <!-- .post-meta -->
</div> <!-- .row --> <div class="post-content">
{{ content }}
</div>
<div class="post-tail-wrapper text-muted">
<!-- categories -->
{% if page.categories.size > 0 %}
<div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw mr-1"></i>
{% for category in page.categories %}
<a href='{{ site.baseurl }}/categories/{{ category | slugify | url_encode }}/'>{{ category }}</a>
{%- unless forloop.last -%}, {%- endunless -%}
{% endfor %}
</div>
{% endif %}
<!-- tags -->
{% if page.tags.size > 0 %}
<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 | slugify | url_encode }}/"
class="post-tag no-text-decoration" >
{{- tag -}}
</a>
{% endfor %}
</div>
{% endif %}
<div class="post-tail-bottom
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
<div class="license-wrapper">
{% if site.data.locales[lang].copyright.license.template %}
{% capture _replacement %}
<a href="{{ site.data.locales[lang].copyright.license.link }}">
{{ site.data.locales[lang].copyright.license.name }}
</a>
{% endcapture %}
{{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
{% endif %}
</div>
{% include post-sharing.html %}
</div><!-- .post-tail-bottom -->
</div><!-- div.post-tail-wrapper -->

View File

@@ -12,13 +12,11 @@ layout: page
<span class="lead text-muted pl-2">{{ page.posts | size }}</span> <span class="lead text-muted pl-2">{{ page.posts | size }}</span>
</h1> </h1>
<ul class="post-content pl-0"> <ul class="post-content pl-0">
{% assign post_df = site.data.locales[lang].date_format.post.long %}
{% for post in page.posts %} {% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3"> <li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span> <span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: post_df }}</span> {% include datetime.html date=post.date wrap='span' class='text-muted small' %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@@ -14,7 +14,9 @@ layout: page
{% for t in sorted_tags %} {% for t in sorted_tags %}
<div> <div>
<a class="tag" href="{{ site.baseurl }}/tags/{{ t | slugify | url_encode }}/">{{ t }}<span class="text-muted">{{ site.tags[t].size }}</span></a> <a class="tag" href="{{ t | slugify | url_encode | prepend: '/tags/' | append: '/' | relative_url }}">
{{ t }}<span class="text-muted">{{ site.tags[t].size }}</span>
</a>
</div> </div>
{% endfor %} {% endfor %}

View File

@@ -1,15 +1,16 @@
--- ---
title: Text and Typography title: Text and Typography
author: Cotes Chung author: cotes
date: 2019-08-08 11:33:00 +0800 date: 2019-08-08 11:33:00 +0800
categories: [Blogging, Demo] categories: [Blogging, Demo]
tags: [typography] tags: [typography]
math: true math: true
mermaid: true mermaid: true
image: image:
src: /commons/devices-mockup.png path: /commons/devices-mockup.png
width: 850 width: 800
height: 585 height: 500
alt: Responsive rendering of Chirpy theme on multiple devices.
--- ---
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. 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.
@@ -52,8 +53,8 @@ Fluttering and dancing in the breeze.
### Unordered list ### Unordered list
- Chapter - Chapter
- Section - Section
- Paragraph - Paragraph
### Task list ### Task list
@@ -72,10 +73,23 @@ Sun
Moon Moon
: the natural satellite of the earth, visible by reflected light from the sun : the natural satellite of the earth, visible by reflected light from the sun
## Block Quote ## Block Quote
> This line to shows the Block Quote. > This line shows the _block quote_.
## Prompts
> An example showing the `tip` type prompt.
{: .prompt-tip }
> An example showing the `info` type prompt.
{: .prompt-info }
> An example showing the `warning` type prompt.
{: .prompt-warning }
> An example showing the `danger` type prompt.
{: .prompt-danger }
## Tables ## Tables
@@ -89,12 +103,10 @@ Moon
<http://127.0.0.1:4000> <http://127.0.0.1:4000>
## Footnote ## Footnote
Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2]. Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2].
## Images ## Images
- Default (with caption) - Default (with caption)
@@ -141,7 +153,6 @@ _shadow effect (visible in light mode)_
cherry :active, c, after b a, 1d cherry :active, c, after b a, 1d
``` ```
## Mathematics ## Mathematics
The mathematics powered by [**MathJax**](https://www.mathjax.org/): The mathematics powered by [**MathJax**](https://www.mathjax.org/):
@@ -152,11 +163,13 @@ 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} $$ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
## Inline code ## Inline code
This is an example of `Inline Code`. This is an example of `Inline Code`.
## Filepath
Here is the `/path/to/the/file.extend`{: .filepath}.
## Code block ## Code block

View File

@@ -1,15 +1,17 @@
--- ---
title: Writing a New Post title: Writing a New Post
author: Cotes Chung author: cotes
date: 2019-08-08 14:10:00 +0800 date: 2019-08-08 14:10:00 +0800
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [writing] tags: [writing]
render_with_liquid: false render_with_liquid: false
--- ---
This post will guide you how to write a post on _Chirpy_ theme. Even if you have previous experience with Jekyll, this article is worth reading, because many features require specific variables to be set.
## Naming and Path ## Naming and Path
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`. Create a new file named `YYYY-MM-DD-TITLE.EXTENSION`{: .filepath} and put it in the `_posts`{: .filepath} of the root directory. Please note that the `EXTENSION`{: .filepath} must be one of `md`{: .filepath} and `markdown`{: .filepath}. If you want to save time of creating files, please consider using the plugin [`Jekyll-Compose`](https://github.com/jekyll/jekyll-compose) to accomplish this.
## Front Matter ## Front Matter
@@ -24,24 +26,52 @@ tags: [TAG] # TAG names should always be lowercase
--- ---
``` ```
> **Note**: The posts' ***layout*** has been set to `post` by default, so there is no need to add the variable ***layout*** in Front Matter block. > The posts' _layout_ has been set to `post` by default, so there is no need to add the variable _layout_ in the Front Matter block.
{: .prompt-tip }
### Timezone of date ### Timezone of Date
In order to accurately record the release date of a post, you should not only setup the `timezone` of `_config.yml` but also provide the the post's timezone in field `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`. In order to accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`.
### Categories and Tags ### Categories and Tags
The `categories` of each post is designed to contain up to two elements, and the number of elements in `tags` can be zero to infinity. For instance: The `categories` of each post are designed to contain up to two elements, and the number of elements in `tags` can be zero to infinity. For instance:
```yaml ```yaml
---
categories: [Animal, Insect] categories: [Animal, Insect]
tags: [bee] tags: [bee]
---
``` ```
### Author Information
The author information of the post usually does not need to be filled in the _Front Matter_ , they will be obtained from variables `social.name` and the first entry of `social.links` of the configuration file by default. But you can also override it as follows:
Add author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one.)
```yaml
<author_id>:
name: <full name>
twitter: <twitter_of_author>
url: <homepage_of_author>
```
{: file="_data/authors.yml" }
And then set up the custom author in the post's YAML block:
```yaml
---
author: <author_id>
---
```
> Another benefit of reading the author information from the file `_data/authors.yml`{: .filepath } is that the page will have the meta tag `twitter:creator`, which enriches the [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started#card-and-content-attribution) and is good for SEO.
{: .prompt-info }
## Table of Contents ## Table of Contents
By default, the **T**able **o**f **C**ontents (TOC) is displayed on the right panel of the post. If you want to turn it off globally, go to `_config.yml` and set the value of variable `toc` to `false`. If you want to turn off TOC for specific post, add the following to post's [Front Matter](https://jekyllrb.com/docs/front-matter/): By default, the **T**able **o**f **C**ontents (TOC) is displayed on the right panel of the post. If you want to turn it off globally, go to `_config.yml`{: .filepath} and set the value of variable `toc` to `false`. If you want to turn off TOC for a specific post, add the following to the post's [Front Matter](https://jekyllrb.com/docs/front-matter/):
```yaml ```yaml
--- ---
@@ -51,7 +81,9 @@ toc: false
## Comments ## Comments
Similar to TOC, the [Disqus](https://disqus.com/) comments is loaded by default in each post, and the global switch is defined by variable `comments` in file `_config.yml` . If you want to close the comment for specific post, add the following to the **Front Matter** of the post: The global switch of comments is defined by variable `comments.active` in the file `_config.yml`{: .filepath}. After selecting a comment system for this variable, comments will be turned on for all posts.
If you want to close the comment for a specific post, add the following to the **Front Matter** of the post:
```yaml ```yaml
--- ---
@@ -79,28 +111,11 @@ mermaid: true
--- ---
``` ```
Then you can use it like other markdown language: surround the graph code with ```` ```mermaid ```` and ```` ``` ````. Then you can use it like other markdown languages: surround the graph code with ```` ```mermaid ```` and ```` ``` ````.
## Images ## Images
### Preview image ### Caption
If you want to add an image to the top of the post contents, specify the attribute `src`, `width`, `height` and `alt` for the image:
```yaml
---
image:
src: /path/to/image/file
width: 1000 # in pixels
height: 400 # in pixels
alt: image alternative text
---
```
Except for `alt`, all other options are necessary, especially the `width` and `height`, which are related to user experience and web page loading performance. Later section ["Image size"](#image-size) will also mention this.
### Image caption
Add italics to the next line of an imagethen it will become the caption and appear at the bottom of the image: Add italics to the next line of an imagethen it will become the caption and appear at the bottom of the image:
@@ -110,7 +125,7 @@ _Image Caption_
``` ```
{: .nolineno} {: .nolineno}
### Image size ### Size
In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image: In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image:
@@ -119,9 +134,19 @@ In order to prevent the page content layout from shifting when the image is load
``` ```
{: .nolineno} {: .nolineno}
### Image position Starting from _Chirpy v5.0.0_, `height` and `width` support abbreviations (`height` → `h`, `width` → `w`). The following example has the same effect as the above:
By default, the image is centered, but you can specify the position by using one of class `normal` , `left` and `right`. For example: ```markdown
![Desktop View](/assets/img/sample/mockup.png){: w="700" h="400" }
```
{: .nolineno}
### Position
By default, the image is centered, but you can specify the position by using one of the classes `normal`, `left`, and `right`.
> Once the position is specified, the image caption should not be added.
{: .prompt-warning }
- **Normal position** - **Normal position**
@@ -146,9 +171,7 @@ By default, the image is centered, but you can specify the position by using one
``` ```
{: .nolineno} {: .nolineno}
> **Limitation**: Once the position of the image is specified, the image caption should not be added. ### Shadow
### Image shadow
The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode: The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode:
@@ -159,14 +182,14 @@ The screenshots of the program window can be considered to show the shadow effec
### CDN URL ### 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: 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`{: .filepath} file:
```yaml ```yaml
img_cdn: https://cdn.com img_cdn: https://cdn.com
``` ```
{: file='_config.yml' .nolineno} {: file='_config.yml' .nolineno}
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 `/`. 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: For instance, when using images:
@@ -182,6 +205,49 @@ The parsing result will automatically add the CDN prefix `https://cdn.com` befor
``` ```
{: .nolineno} {: .nolineno}
### Image Path
When a post contains many images, it will be a time-consuming task to repeatedly define the path of the images. To solve this, we can define this path in the YAML block of the post:
```yml
---
img_path: /img/path/
---
```
{: .nolineno }
And then, the image source of Markdown can write the file name directly:
```md
![The flower](flower.png)
```
{: .nolineno }
The output will be:
```html
<img src="/img/path/flower.png" alt="The flower">
```
{: .nolineno }
### Preview Image
If you want to add an image to the top of the post contents, specify the attribute `path`, `width`, `height`, and `alt` for the image:
```yaml
---
image:
path: /path/to/image/file
width: 1000 # in pixels
height: 400 # in pixels
alt: image alternative text
---
```
Except for `alt`, all other options are necessary, especially the `width` and `height`, which are related to user experience and web page loading performance. The above section "[Size](#size)" also mentions this.
Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height` → `h`, `width` → `w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name.
## Pinned Posts ## 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: 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:
@@ -192,15 +258,43 @@ pin: true
--- ---
``` ```
## Code Block ## Prompts
There are several types of prompts: `tip`, `info`, `warning`, and `danger`. They can be generated by adding the class `prompt-{type}` to the blockquote. For example, define a prompt of type `info` as follows:
```md
> Example line for prompt.
{: .prompt-info }
```
{: .nolineno }
## Syntax
### Inline Code
```md
`inline code part`
```
{: .nolineno }
### Filepath Hightlight
```md
`/path/to/a/file.extend`{: .filepath}
```
{: .nolineno }
### Code Block
Markdown symbols ```` ``` ```` can easily create a code block as follows: Markdown symbols ```` ``` ```` can easily create a code block as follows:
````md
``` ```
This is a plaintext code snippet. This is a plaintext code snippet.
``` ```
````
### Specifying Language #### Specifying Language
Using ```` ```{language} ```` you will get a code block with syntax highlight: Using ```` ```{language} ```` you will get a code block with syntax highlight:
@@ -210,22 +304,23 @@ key: value
``` ```
```` ````
> **Limination**: The Jekyll style `highlight` tag ais not compatible with this theme. > The Jekyll tag `{% highlight %}` is not compatible with this theme.
{: .prompt-danger }
### Line Number #### Line Number
By default, all languages except `plaintext`, `console` and `terminal` will display line numbers. When you want to hide the line number of the code block, you can append `{: .nolineno}` at the next line: By default, all languages except `plaintext`, `console`, and `terminal` will display line numbers. When you want to hide the line number of a code block, add the class `nolineno` to it:
````markdown ````markdown
```shell ```shell
echo 'No more line numbers!' echo 'No more line numbers!'
``` ```
{: .nolineno} {: .nolineno }
```` ````
### Specifying the Filename #### Specifying the Filename
You may have noticed that the code language will be displayed on the left side of the header of the code block. If you want to replace it with the file name, you can add the attribute `file` to achieve this: You may have noticed that the code language will be displayed at the top of the code block. If you want to replace it with the file name, you can add the attribute `file` to achieve this:
````markdown ````markdown
```shell ```shell
@@ -234,7 +329,7 @@ You may have noticed that the code language will be displayed on the left side o
{: file="path/to/file" } {: file="path/to/file" }
```` ````
### Liquid Codes #### Liquid Codes
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`: If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:
@@ -253,4 +348,3 @@ Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the pos
## Learn More ## Learn More
For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/). For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/).

View File

@@ -1,6 +1,6 @@
--- ---
title: Getting Started title: Getting Started
author: Cotes Chung author: cotes
date: 2019-08-09 20:55:00 +0800 date: 2019-08-09 20:55:00 +0800
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [getting started] tags: [getting started]
@@ -9,7 +9,7 @@ pin: true
## Prerequisites ## Prerequisites
Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`. Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`. In addition, [Git](https://git-scm.com/) is also required to be installed.
## Installation ## Installation
@@ -17,9 +17,8 @@ Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installat
There are two ways to create a new repository for this theme: There are two ways to create a new repository for this theme:
- **[Using the Chirpy Starter](#option-1-using-the-chirpy-starter)** - Easy to upgrade, isolates irrelevant project files so you can focus on writing. - [**Using the Chirpy Starter**](#option-1-using-the-chirpy-starter) - Easy to upgrade, isolates irrelevant project files so you can focus on writing.
- [**Forking on GitHub**](#option-2-forking-on-github) - Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended.
- **[Forking on GitHub](#option-2-forking-on-github)** - Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended.
#### Option 1. Using the Chirpy Starter #### Option 1. Using the Chirpy Starter
@@ -35,24 +34,24 @@ And then execute:
$ bash tools/init.sh $ bash tools/init.sh
``` ```
> **Note**: If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. > If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command.
{: .prompt-info }
The above command will: The above command will:
1. Removes some files or directories from your repository: 1. Removes some files or directories from your repository:
- `.travis.yml` - `.travis.yml`{: .filepath}
- files under `_posts` - files under `_posts`{: .filepath}
- folder `docs`
2. If the option `--no-gh` is provided, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`. 2. If the option `--no-gh` is provided, the directory `.github`{: .filepath} will be deleted. Otherwise, set up the GitHub Action workflow by removing the extension `.hook`{: .filepath} of `.github/workflows/pages-deploy.yml.hook`{: .filepath}, and then remove the other files and directories in the folder `.github`{: .filepath}.
3. Removes item `Gemfile.lock` from `.gitignore`. 3. Removes item `Gemfile.lock` from `.gitignore`{: .filepath}.
4. Creates a new commit to save the changes automatically. 4. Creates a new commit to save the changes automatically.
### Installing Dependencies ### Installing Dependencies
Before running for the first time, go the root directory of your site, and install dependencies as follows: Before running for the first time, go to the root directory of your site, and install dependencies as follows:
```console ```console
$ bundle $ bundle
@@ -62,7 +61,7 @@ $ bundle
### Configuration ### Configuration
Update the variables of `_config.yml` as needed. Some of them are typical options: Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options:
- `url` - `url`
- `avatar` - `avatar`
@@ -71,9 +70,15 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
### Customing Stylesheet ### Customing Stylesheet
If you need to customize stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file. If you need to customize the stylesheet, copy the theme's `assets/css/style.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of the style file.
Starting from [`v4.1.0`][chirpy-4.1.0], if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it. Starting from [`v4.1.0`][chirpy-4.1.0], if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, create a new file `_sass/variables-hook.scss`{: .filepath} and assign new values to the target variable in it.
### Customing Static Assets
Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined by file `_data/assets/cross_origin.yml`{: .filepath }, and you can replace some of them according to the network conditions in the region where your website is published.
Also, if you'd like to self-host the static assets, please refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme).
### Running Local Server ### Running Local Server
@@ -94,23 +99,23 @@ $ docker run -it --rm \
After a while, the local service will be published at _<http://127.0.0.1:4000>_. After a while, the local service will be published at _<http://127.0.0.1:4000>_.
### Deployment ## Deployment
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`. Before the deployment begins, check out the file `_config.yml`{: .filepath} 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 starts with a slash, e.g, `/project-name`.
Now you can choose ONE of the following methods to deploy your Jekyll site. Now you can choose ONE of the following methods to deploy your Jekyll site.
#### Deploy by Using Github Actions ### Deploy by Using Github Actions
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 GitHub 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 GitHub Pages service.
Quickly check the files needed for GitHub Actions build: 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 [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. - Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`{: .filepath}. Otherwise, create a new one and fill in the contents of the [sample 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/deploy.sh`. Otherwise, copy it from here to your Jekyll site. - Ensure your Jekyll site has file `tools/deploy.sh`{: .filepath}. Otherwise, copy it from here to your Jekyll site.
- Furthermore, if you have committed `Gemfile.lock` to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lockfile: - Furthermore, if you have committed `Gemfile.lock`{: .filepath} to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lock file:
```console ```console
$ bundle lock --add-platform x86_64-linux $ bundle lock --add-platform x86_64-linux
@@ -124,11 +129,11 @@ Now publish your Jekyll site by:
2. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar, and then in the section **Source** of _GitHub Pages_, select the `/(root)` directory of branch `gh-pages` as the [publishing source][pages-src]. Remember to click <kbd>Save</kbd> before leaving. 2. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar, and then in the section **Source** of _GitHub Pages_, select the `/(root)` directory of branch `gh-pages` as the [publishing source][pages-src]. Remember to click <kbd>Save</kbd> before leaving.
![gh-pages-sources](/posts/20190809/gh-pages-sources.png){: width="850" height="153" } ![gh-pages-sources](/posts/20190809/gh-pages-sources.png){: width="1580" height="250" }
3. Visit your website at the address indicated by GitHub. 3. Visit your website at the address indicated by GitHub.
#### Manually Build and Deploy ### Manually Build and Deploy
On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server. On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server.
@@ -148,29 +153,29 @@ $ docker run -it --rm \
jekyll build jekyll build
``` ```
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 the target server. Unless you specified the output path, the generated site files will be placed in folder `_site`{: .filepath} of the project's root directory. Now you should upload those files to the target server.
### Upgrading ## Upgrading
It depends on how you use the theme: It depends on how you use the theme:
- If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`), editing the `Gemfile` and update the version number of the them gem, for example: - If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`{: .filepath}), editing the `Gemfile`{: .filepath} and update the version number of the theme gem, for example:
```diff ```diff
- gem "jekyll-theme-chirpy", "~> 3.2", ">= 3.2.1" - gem "jekyll-theme-chirpy", "~> 3.2", ">= 3.2.1"
+ gem "jekyll-theme-chirpy", "~> 3.3", ">= 3.3.0" + gem "jekyll-theme-chirpy", "~> 3.3", ">= 3.3.0"
``` ```
{: .nolineno file="Gemfile" } {: .nolineno file="Gemfile" }
And then execute the following command: And then execute the following command:
```console ```console
$ bundle update jekyll-theme-chirpy $ bundle update jekyll-theme-chirpy
``` ```
As the version upgrades, the critical files (for details, see the [Startup Template][starter]) and configuration options will change. Please refer to the [Upgrade Guide](https://github.com/cotes2020/jekyll-theme-chirpy/wiki/Upgrade-Guide) to keep your repo's files in sync with the latest version of the theme. As the version upgrades, the critical files (for details, see the [Startup Template][starter]) and configuration options will change. Please refer to the [Upgrade Guide](https://github.com/cotes2020/jekyll-theme-chirpy/wiki/Upgrade-Guide) to keep your repo's files in sync with the latest version of the theme.
- If you forked from the source project (there will be `gemspec` in the `Gemfile` of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade. - If you forked from the source project (there will be `gemspec` in the `Gemfile`{: .filepath} of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade.
The merge is likely to conflict with your local modifications. Please be patient and careful to resolve these conflicts. The merge is likely to conflict with your local modifications. Please be patient and careful to resolve these conflicts.
[starter]: https://github.com/cotes2020/chirpy-starter [starter]: https://github.com/cotes2020/chirpy-starter

View File

@@ -1,16 +1,16 @@
--- ---
title: Customize the Favicon title: Customize the Favicon
author: Cotes Chung author: cotes
date: 2019-08-11 00:34:00 +0800 date: 2019-08-11 00:34:00 +0800
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [favicon] tags: [favicon]
--- ---
The [favicons](https://www.favicon-generator.org/about/) of [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) are placed in the directory `assets/img/favicons/`. You may want to replace them with your own. The following sections will guide you how to create and replace the default favicons. The [favicons](https://www.favicon-generator.org/about/) of [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) are placed in the directory `assets/img/favicons/`{: .filepath}. You may want to replace them with your own. The following sections will guide you to create and replace the default favicons.
## Generate the favicon ## Generate the favicon
Prepare a square image (PNG, JPG, or SVG) with a size of 512x512 or more, and then go to the online tool [**Real Favicon Generator**](https://realfavicongenerator.net/) and click button <kbd>Select your Favicon image</kbd> to upload your image file. Prepare a square image (PNG, JPG, or SVG) with a size of 512x512 or more, and then go to the online tool [**Real Favicon Generator**](https://realfavicongenerator.net/) and click the button <kbd>Select your Favicon image</kbd> to upload your image file.
In the next step, the webpage will show all usage scenarios. You can keep the default options, scroll to the bottom of the page, and click the button <kbd>Generate your Favicons and HTML code</kbd> to generate the favicon. In the next step, the webpage will show all usage scenarios. You can keep the default options, scroll to the bottom of the page, and click the button <kbd>Generate your Favicons and HTML code</kbd> to generate the favicon.
@@ -18,20 +18,19 @@ In the next step, the webpage will show all usage scenarios. You can keep the de
Download the generated package, unzip and delete the following two from the extracted files: Download the generated package, unzip and delete the following two from the extracted files:
- `browserconfig.xml` - `browserconfig.xml`{: .filepath}
- `site.webmanifest` - `site.webmanifest`{: .filepath}
Now, copy the remaining image files (`PNG` and `ICO`) to cover the original files in the folder `assets/img/favicons/` of your Jekyll site. If your Jekyll site doesn't have this directory yet, just create one. And then copy the remaining image files (`.PNG`{: .filepath} and `.ICO`{: .filepath}) to cover the original files in the directory `assets/img/favicons/`{: .filepath} of your Jekyll site. If your Jekyll site doesn't have this directory yet, just create one.
The following table will helps you understand the changes to the favicon files: The following table will help you understand the changes to the favicon files:
| File(s) | From Online Tool | From Chirpy | | File(s) | From Online Tool | From Chirpy |
|---------------------|:---------------------------------:|:-----------:| |---------------------|:---------------------------------:|:-----------:|
| `*.PNG` | ✓ | ✗ | | `*.PNG` | ✓ | ✗ |
| `*.ICO` | ✓ | ✗ | | `*.ICO` | ✓ | ✗ |
| `browserconfig.xml` | ✗ | ✓ |
| `site.webmanifest` | ✗ | ✓ |
> Note: ✓ means keep, ✗ means delete. > ✓ means keep, ✗ means delete.
{: .prompt-info }
The next time you build the site, the favicon will be replaced with a customized edition. The next time you build the site, the favicon will be replaced with a customized edition.

View File

@@ -1,6 +1,6 @@
--- ---
title: Enable Google Page Views title: Enable Google Page Views
author: Dinesh Prasanth Moluguwan Krishnamoorthy author: sille_bille
date: 2021-01-03 18:32:00 -0500 date: 2021-01-03 18:32:00 -0500
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [google analytics, pageviews] tags: [google analytics, pageviews]
@@ -13,20 +13,20 @@ This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme bas
### Create GA account and property ### 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. First, you need to set up your account on Google analytics. While you create your account, you must create your first **Property** as well.
1. Head to <https://analytics.google.com/> and click on **Start Measuring** 1. Head to <https://analytics.google.com/> and click on **Start Measuring**
2. Enter your desired _Account Name_ and choose the desired checkboxes 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 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_ 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 5. Hit _Create_ and accept any license popup to set up your Google Analytics account and create your property
### Create Data Stream ### 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: 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 create your first **Data Stream**. If not, follow these steps:
1. Go to **Admin** on the left column 1. Go to **Admin** on the left column
2. Select the desired property from the drop down on the second column 2. Select the desired property from the drop-down on the second column
3. Click on **Data Streams** 3. Click on **Data Streams**
4. Add a stream and click on **Web** 4. Add a stream and click on **Web**
5. Enter your blog's URL 5. Enter your blog's URL
@@ -35,7 +35,7 @@ It should look like this:
![google-analytics-data-stream](/posts/20210103/01-google-analytics-data-stream.png){: width="1086" height="542"} ![google-analytics-data-stream](/posts/20210103/01-google-analytics-data-stream.png){: width="1086" height="542"}
Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml` file 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`{: .filepath} file:
```yaml ```yaml
google_analytics: google_analytics:
@@ -47,13 +47,13 @@ google_analytics:
``` ```
{: file="_config.yml"} {: file="_config.yml"}
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. When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with the Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pick up your changes. You should now be able to monitor your traffic in real time.
![google-analytics-realtime](/posts/20210103/02-google-analytics-realtime.png){: width="616" height="557"} ![google-analytics-realtime](/posts/20210103/02-google-analytics-realtime.png){: width="616" height="557"}
## Setup Page Views ## 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. 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 the Git bash terminal to run Unix-like commands.
### Setup Google App Engine ### Setup Google App Engine
@@ -67,7 +67,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
5. Select **Python** language and **Standard** environment 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. 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, the 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 7. Go to your App Engine dashboard on your browser and select **API & Services** from the left navigation menu
@@ -77,7 +77,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
10. On the left, Click on _OAuth Consent Screen_ and accept **Configure Consent Screen**. Select **External** since your blog is probably hosted for the public. Click on **Publish** under _Publishing Status_ 10. On the left, Click on _OAuth Consent Screen_ and accept **Configure Consent Screen**. Select **External** since your blog is probably hosted for the public. Click on **Publish** under _Publishing Status_
11. Click on **Credentials** on the left and create a new **OAuth Client IDs** credential. Make sure to add a entry under `Authorized redirect URIs` that matches: `https://<project-id>.<region>.r.appspot.com/admin/auth` 11. Click on **Credentials** on the left and create a new **OAuth Client IDs** credential. Make sure to add an 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. 12. Note down the **Your Client ID** and **Your Client Secret**. You'll need this in the next section.
@@ -113,15 +113,16 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local. 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: 2. Remove the first 2 lines in the [`src/app.yaml`{: .filepath}](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. ```diff
- application: your-project-id
- version: 1
```
4. Enter any random key for `XSRF_KEY`, your `config.py` should look similar to this 3. In `src/config.py`{: .filepath}, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from your App Engine Dashboard.
4. Enter any random key for `XSRF_KEY`, your `config.py`{: .filepath} should look similar to this
```python ```python
#!/usr/bin/python2.7 #!/usr/bin/python2.7
@@ -143,9 +144,11 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
``` ```
{: file="src/config.py"} {: file="src/config.py"}
**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. > 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.
{: .prompt-info }
5. From inside the src/ directory, deploy the app 5. From inside the `src/`{: .filepath} directory, deploy the app
```console ```console
[root@bc96abf71ef8 src]# gcloud app deploy [root@bc96abf71ef8 src]# gcloud app deploy
@@ -202,24 +205,23 @@ In order to reduce the returned results and reduce the network bandwidth, we add
- **filters**: fill in `ga:pagePath=~^/posts/.*/$;ga:pagePath!@=`. - **filters**: fill in `ga:pagePath=~^/posts/.*/$;ga:pagePath!@=`.
Among them, `;` means using _logical AND_ to concatenate two rules. Among them, `;` means using _logical AND_ to concatenate two rules.
If the `site.baseurl` is specified, change the first filtering rule to `ga:pagePath=~^/BASE_URL/posts/.*/$`, where `BASE_URL` is the value of `site.baseurl`. If the `site.baseurl` is specified, change the first filtering rule to `ga:pagePath=~^/BASE_URL/posts/.*/$`, where `BASE_URL` is the value of `site.baseurl`.
After <kbd>Run Query</kbd>, copy the generated contents of **API Query URI** at the bottom of the page, and fill in the **Encoded URI for the query** of SuperProxy on GAE. 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. 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](/posts/20210103/04-superproxy-query.png){: width="1100" height="126"} ![superproxy-query](/posts/20210103/04-superproxy-query.png){: width="1100" height="126"}
## Configure Chirpy to Display Page View ## 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. 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](/posts/20210103/05-superproxy-dashboard.png){: width="1210" height="694"} ![superproxy-dashboard](/posts/20210103/05-superproxy-dashboard.png){: width="1210" height="694"}
Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following: Update the `_config.yml`{: .filepath} file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
```yaml ```yaml
google_analytics: google_analytics:

File diff suppressed because it is too large Load Diff

View File

@@ -10,6 +10,39 @@
font-family: 'Lato', 'Microsoft Yahei', sans-serif; font-family: 'Lato', 'Microsoft Yahei', sans-serif;
} }
%section {
#core-wrapper & {
margin-top: 2.5rem;
margin-bottom: 1.25rem;
&:focus {
outline: none; /* avoid outline in Safari */
}
}
}
%anchor {
.anchor {
font-size: 80%;
}
@media (hover: hover) {
.anchor {
visibility: hidden;
opacity: 0;
transition: opacity 0.25s ease-in, visibility 0s ease-in 0.25s;
}
&:hover {
.anchor {
visibility: visible;
opacity: 1;
transition: opacity 0.25s ease-in, visibility 0s ease-in 0s;
}
}
}
}
%tag-hover { %tag-hover {
background: var(--tag-hover); background: var(--tag-hover);
transition: background 0.35s ease-in-out; transition: background 0.35s ease-in-out;
@@ -39,30 +72,31 @@
transition: color 0.35s ease-in-out; transition: color 0.35s ease-in-out;
} }
%no-cursor {
user-select: none;
}
%no-bottom-border { %no-bottom-border {
border-bottom: none; border-bottom: none;
} }
%section {
#post-wrapper & {
line-height: 1.2;
margin-bottom: 1rem;
}
}
%anchor {
padding-top: 3.5rem;
margin-top: -2.5rem;
}
%cursor-pointer { %cursor-pointer {
cursor: pointer; cursor: pointer;
} }
/* ---------- scss mixin --------- */ %normal-font-style {
font-style: normal;
}
@mixin no-text-decoration { %img-caption {
text-decoration: none; + em {
display: block;
text-align: center;
font-style: normal;
font-size: 80%;
padding: 0;
color: #6d6c6c;
}
} }
%sidebar-links { %sidebar-links {
@@ -70,6 +104,12 @@
user-select: none; user-select: none;
} }
/* ---------- scss mixin --------- */
@mixin no-text-decoration {
text-decoration: none;
}
@mixin ml-mr($value) { @mixin ml-mr($value) {
margin-left: $value; margin-left: $value;
margin-right: $value; margin-right: $value;
@@ -84,28 +124,12 @@
opacity: 0.6; opacity: 0.6;
} }
@mixin semi-bold {
font-weight: 600;
}
@mixin label($font-size: 1rem, $font-weight: 600, $color: var(--label-color)) { @mixin label($font-size: 1rem, $font-weight: 600, $color: var(--label-color)) {
color: $color; color: $color;
font-size: $font-size; font-size: $font-size;
font-weight: $font-weight; font-weight: $font-weight;
} }
@mixin panel-label {
@include label(inherit);
display: block;
line-height: 1.2;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
margin-top: 0;
margin-bottom: 0;
letter-spacing: -0.02em;
}
@mixin align-center { @mixin align-center {
position: relative; position: relative;
left: 50%; left: 50%;
@@ -113,3 +137,15 @@
-ms-transform: translateX(-50%); -ms-transform: translateX(-50%);
transform: translateX(-50%); transform: translateX(-50%);
} }
@mixin prompt($type, $fw-icon, $icon-weight: 900) {
&.prompt-#{$type} {
background-color: var(--prompt-#{$type}-bg);
&::before {
content: $fw-icon;
color: var(--prompt-#{$type}-icon-color);
font-weight: $icon-weight;
}
}
}

View File

@@ -5,23 +5,27 @@
@import "colors/light-syntax"; @import "colors/light-syntax";
@import "colors/dark-syntax"; @import "colors/dark-syntax";
html:not([mode]), html {
html[mode=light] { @media (prefers-color-scheme: light) {
@include light-syntax; &:not([data-mode]),
} &[data-mode=light] {
@include light-syntax;
}
html[mode=dark] { &[data-mode=dark] {
@include dark-syntax; @include dark-syntax;
} }
@media (prefers-color-scheme: dark) {
html:not([mode]),
html[mode=dark] {
@include dark-syntax;
} }
html[mode=light] { @media (prefers-color-scheme: dark) {
@include light-syntax; &:not([data-mode]),
&[data-mode=dark] {
@include dark-syntax;
}
&[data-mode=light] {
@include light-syntax;
}
} }
} }
@@ -38,13 +42,8 @@ $code-radius: 6px;
} }
%code-snippet-padding { %code-snippet-padding {
padding: 1.2rem; padding-left: 1rem;
} padding-right: 1.5rem;
div > pre {
@extend %code-snippet-bg;
@extend %code-snippet-radius;
@extend %code-snippet-padding;
} }
.highlighter-rouge { .highlighter-rouge {
@@ -65,6 +64,8 @@ div > pre {
} }
overflow: auto; overflow: auto;
padding-top: 0.5rem;
padding-bottom: 1rem;
pre { pre {
margin-bottom: 0; margin-bottom: 0;
@@ -74,19 +75,12 @@ div > pre {
} }
table { table {
padding: 0;
border: 0;
td pre { td pre {
overflow: visible; /* Fixed iOS safari overflow-x */ overflow: visible; /* Fixed iOS safari overflow-x */
word-break: normal; /* Fixed iOS safari linenos code break */ word-break: normal; /* Fixed iOS safari linenos code break */
} }
} }
td {
padding: 0;
border: 0;
}
.lineno { .lineno {
padding-right: 0.5rem; padding-right: 0.5rem;
min-width: 2.2rem; min-width: 2.2rem;
@@ -105,7 +99,7 @@ div > pre {
user-select: none; user-select: none;
} }
} //.highlight } /* .highlight */
code { code {
-webkit-hyphens: none; -webkit-hyphens: none;
@@ -120,25 +114,38 @@ code {
background-color: var(--inline-code-bg); background-color: var(--inline-code-bg);
} }
@at-root a > &.highlighter-rouge { &.filepath {
padding-bottom: 0; // show link's underlinke background-color: inherit;
color: var(--filepath-text-color);
font-weight: 600;
padding: 0;
}
a > &.highlighter-rouge {
padding-bottom: 0; /* show link's underlinke */
color: inherit; color: inherit;
} }
@at-root a:hover > &.highlighter-rouge { a:hover > &.highlighter-rouge {
border-bottom: none; border-bottom: none;
} }
blockquote &.highlighter-rouge { blockquote & {
color: inherit; color: inherit;
} }
.highlight > & {
color: transparent;
}
} }
td.rouge-code { td.rouge-code {
padding: 1.2rem 1.5rem 1.2rem 1rem; @extend %code-snippet-padding;
// Prevent some browser extends from /*
// changing the URL string of code block. Prevent some browser extends from
changing the URL string of code block.
*/
a { a {
color: inherit !important; color: inherit !important;
border-bottom: none !important; border-bottom: none !important;
@@ -157,63 +164,82 @@ div {
pre.lineno { pre.lineno {
display: none; display: none;
} }
td.rouge-code { td.rouge-code {
@extend %code-snippet-padding; padding-left: 1.5rem;
} }
} }
} }
.code-header { .code-header {
background: var(--code-header-bg); @extend %no-cursor;
$code-header-height: 2.25rem;
border-top-left-radius: $code-radius; border-top-left-radius: $code-radius;
border-top-right-radius: $code-radius; border-top-right-radius: $code-radius;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
line-height: 1.85rem; height: $code-header-height;
// icons &::before {
i { $dot-size: 0.75rem;
font-size: 1rem; $dot-margin: 0.5rem;
color: var(--lang-badge-muted-color);
&.small { content: "";
font-size: 70%; display: inline-block;
} margin-left: 1rem;
width: $dot-size;
height: $dot-size;
border-radius: 50%;
background-color: var(--code-header-muted-color);
box-shadow:
($dot-size + $dot-margin) 0 0 var(--code-header-muted-color),
($dot-size + $dot-margin) * 2 0 0 var(--code-header-muted-color);
} }
// the label block /* the label block */
span { span {
padding-left: 0.35rem; /* label icon */
&::after {
content: attr(text-data);
font-size: 0.85rem;
font-weight: 600;
color: var(--lang-badge-color);
}
i { i {
margin: 0 0.5rem; font-size: 1rem;
margin-right: 0.4rem;
color: var(--code-header-icon-color);
&.small {
font-size: 70%;
}
} }
@at-root [file] #{&} > i { @at-root [file] #{&} > i {
position: relative; position: relative;
top: 1px; // center the file icon top: 1px; /* center the file icon */
margin-left: 0.25rem;
} }
/* label text */
&::after {
content: attr(data-label-text);
font-size: 0.85rem;
font-weight: 600;
color: var(--code-header-text-color);
}
} }
// clipboard /* clipboard */
button { button {
border: 1px solid var(--code-header-bg); @extend %cursor-pointer;
border: 1px solid transparent;
border-radius: $code-radius; border-radius: $code-radius;
height: $code-header-height;
width: $code-header-height;
padding: 0; padding: 0;
width: 1.95rem;
background-color: inherit; background-color: inherit;
@extend %cursor-pointer; i {
color: var(--code-header-icon-color);
}
&[timeout] { &[timeout] {
&:hover { &:hover {

View File

@@ -4,30 +4,30 @@
/* sidebar */ /* sidebar */
$sidebar-width: 260px !default; // the basic width $sidebar-width: 260px !default; /* the basic width */
$sidebar-width-small: 210px !default; // screen width: >= 850px, <= 1199px (iPad landscape) $sidebar-width-small: 210px !default; /* screen width: >= 850px, <= 1199px (iPad landscape) */
$sidebar-width-large: 350px !default; // screen width: >= 1650px $sidebar-width-large: 350px !default; /* screen width: >= 1650px */
/* tabs of sidebar */ /* tabs of sidebar */
$tab-count: 5 !default; // backward compatible (version <= 4.0.2) $tab-count: 5 !default; /* backward compatible (version <= 4.0.2) */
$tab-height: 3rem !default; $tab-height: 3rem !default;
$tab-cursor-height: 1.6rem !default; $tab-cursor-height: 1.6rem !default;
$cursor-width: 2px !default; // the cursor width of the selected tab $cursor-width: 2px !default; /* the cursor width of the selected tab */
/* other framework sizes */ /* other framework sizes */
$topbar-height: 3rem !default; $topbar-height: 3rem !default;
$search-max-width: 210px !default;
$footer-height: 5rem !default; $footer-height: 5rem !default;
$footer-height-mobile: 6rem !default; // screen width: <= 576px $footer-height-mobile: 6rem !default; /* screen width: <= 576px */
$main-content-max-width: 1150px !default; $main-content-max-width: 1250px !default;
$panel-max-width: 300px !default; $bottom-min-height: 35rem !default;
$post-extend-min-height: 35rem !default;
/* syntax highlight */ /* syntax highlight */

View File

@@ -74,15 +74,15 @@
--highlighter-rouge-color: #de6b18; --highlighter-rouge-color: #de6b18;
--highlight-lineno-color: #6c6c6d; --highlight-lineno-color: #6c6c6d;
--inline-code-bg: #272822; --inline-code-bg: #272822;
--code-header-bg: #353535; --code-header-text-color: #6a6a6a;
--lang-badge-color: #858586; --code-header-muted-color: rgb(60 60 60);
--lang-badge-muted-color: #6c6c6d; --code-header-icon-color: rgb(86 86 86);
--clipboard-checked-color: #2bcc2b; --clipboard-checked-color: #2bcc2b;
--filepath-text-color: #bdbdbd;
.highlight { .highlight {
.gp { color: #818c96; } .gp { color: #818c96; }
} }
pre { color: #bfbfbf; } /* override Bootstrap */ pre { color: #bfbfbf; } /* override Bootstrap */
kbd { background-color: black; }
} }

View File

@@ -8,8 +8,6 @@
--mask-bg: rgb(68, 69, 70); --mask-bg: rgb(68, 69, 70);
--main-wrapper-bg: rgb(27, 27, 30); --main-wrapper-bg: rgb(27, 27, 30);
--main-border-color: rgb(44, 45, 45); --main-border-color: rgb(44, 45, 45);
--scrollbar-track-bg: rgba(0, 0, 0, 0.3);
--scrollbar-thumb-bg: rgb(173 171 171 / 50%);
/* Common color */ /* Common color */
--text-color: rgb(175, 176, 177); --text-color: rgb(175, 176, 177);
@@ -67,6 +65,19 @@
--card-bg: rgb(39, 40, 43); --card-bg: rgb(39, 40, 43);
--card-border-color: rgb(53, 53, 60); --card-border-color: rgb(53, 53, 60);
--card-box-shadow: var(--main-wrapper-bg); --card-box-shadow: var(--main-wrapper-bg);
--preview-img-bg: radial-gradient(circle, rgb(22 22 24) 0%, rgb(32 32 32) 100%);
--kbd-wrap-color: #6a6a6a;
--kbd-text-color: #d3d3d3;
--kbd-bg-color: #242424;
--prompt-text-color: rgb(216 212 212 / 75%);
--prompt-tip-bg: rgba(77, 187, 95, 0.2);
--prompt-tip-icon-color: rgb(5 223 5 / 68%);
--prompt-info-bg: rgb(7 59 104 / 80%);
--prompt-info-icon-color: #0075d1;
--prompt-warning-bg: rgb(90 69 3 / 95%);
--prompt-warning-icon-color: rgb(255 165 0 / 80%);
--prompt-danger-bg: rgb(86 28 8 / 80%);
--prompt-danger-icon-color: #cd0202;
/* tags */ /* tags */
--tag-border: rgb(59, 79, 88); --tag-border: rgb(59, 79, 88);
@@ -84,12 +95,8 @@
--timeline-color: rgb(63, 65, 68); --timeline-color: rgb(63, 65, 68);
--timeline-year-dot-color: var(--timeline-color); --timeline-year-dot-color: var(--timeline-color);
/* Footer */ .post img[data-src] {
--footer-bg-color: var(--main-wrapper-bg); filter: brightness(95%);
--footer-link: rgb(171, 171, 171);
.post-content img {
filter: brightness(90%);
} }
hr { hr {
@@ -116,11 +123,13 @@
.card-header { .card-header {
background-color: var(--card-header-bg); background-color: var(--card-header-bg);
} }
.list-group-item { .list-group-item {
border-left: none; border-left: none;
border-right: none; border-right: none;
padding-left: 2rem; padding-left: 2rem;
border-color: var(--categories-border); border-color: var(--categories-border);
&:last-child { &:last-child {
border-bottom-color: var(--card-bg); border-bottom-color: var(--card-bg);
} }
@@ -128,13 +137,21 @@
} }
#archives li:nth-child(odd) { #archives li:nth-child(odd) {
background-image: linear-gradient( background-image:
to left, linear-gradient(
rgb(26, 26, 30), to left,
rgb(39, 39, 45), rgb(26, 26, 30),
rgb(39, 39, 45), rgb(39, 39, 45),
rgb(39, 39, 45), rgb(39, 39, 45),
rgb(26, 26, 30)); rgb(39, 39, 45),
rgb(26, 26, 30)
);
} }
} // dark-scheme color-scheme: dark;
#disqus_thread {
color-scheme: none;
}
} /* dark-scheme */

View File

@@ -71,9 +71,14 @@
--highlighter-rouge-color: #2f2f2f; --highlighter-rouge-color: #2f2f2f;
--highlight-lineno-color: #c2c6cc; --highlight-lineno-color: #c2c6cc;
--inline-code-bg: #f3f3f3; --inline-code-bg: #f3f3f3;
--code-header-bg: #eaeaea; --code-header-text-color: #a3a3b1;
--lang-badge-color: rgb(128 128 128 / 87%); --code-header-muted-color: #ebebeb;
--lang-badge-muted-color: rgb(128 128 128 / 36%); --code-header-icon-color: #d1d1d1;
--clipboard-checked-color: #43c743; --clipboard-checked-color: #43c743;
} // light-syntax [class^=prompt-] {
--inline-code-bg: #fbfafa;
--highlighter-rouge-color: rgb(82 82 82);
}
} /* light-syntax */

View File

@@ -8,8 +8,6 @@
--mask-bg: #c1c3c5; --mask-bg: #c1c3c5;
--main-wrapper-bg: white; --main-wrapper-bg: white;
--main-border-color: #f3f3f3; --main-border-color: #f3f3f3;
--scrollbar-track-bg: rgba(0, 0, 0, 0.3);
--scrollbar-thumb-bg: rgba(0, 0, 0, 0.3);
/* Common color */ /* Common color */
--text-color: #34343c; --text-color: #34343c;
@@ -66,6 +64,23 @@
--tb-odd-bg: #fbfcfd; --tb-odd-bg: #fbfcfd;
--tb-border-color: #eaeaea; --tb-border-color: #eaeaea;
--dash-color: silver; --dash-color: silver;
--preview-img-bg: radial-gradient(circle, rgb(255 255 255) 0%, rgb(249 249 249) 100%);
--kbd-wrap-color: #bdbdbd;
--kbd-text-color: var(--text-color);
--kbd-bg-color: white;
--prompt-text-color: rgb(46 46 46 / 77%);
--prompt-tip-bg: rgb(123 247 144 / 20%);
--prompt-tip-icon-color: #03b303;
--prompt-info-bg: #e1f5fe;
--prompt-info-icon-color: #0070cb;
--prompt-warning-bg: rgb(255 243 205);
--prompt-warning-icon-color: #ef9c03;
--prompt-danger-bg: rgb(248 215 218 / 56%);
--prompt-danger-icon-color: #df3c30;
[class^=prompt-] {
--link-underline-color: rgb(219 216 216);
}
/* Categories */ /* Categories */
--categories-hover-bg: var(--btn-border-color); --categories-hover-bg: var(--btn-border-color);
@@ -76,7 +91,4 @@
--timeline-node-bg: #c2c6cc; --timeline-node-bg: #c2c6cc;
--timeline-year-dot-color: #ffffff; --timeline-year-dot-color: #ffffff;
/* Footer */ } /* light-scheme */
--footer-bg-color: #ffffff;
--footer-link: #424242;
} // light-scheme

View File

@@ -1,7 +1,7 @@
/*! /*!
* The styles for Jekyll theme Chirpy * The styles for Jekyll theme Chirpy
* *
* Chirpy v4.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy) * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -41,6 +41,7 @@
&:not(:first-child) { &:not(:first-child) {
position: relative; position: relative;
left: 4px; left: 4px;
&::after { &::after {
left: 67px; left: 67px;
} }
@@ -98,6 +99,7 @@
.date { .date {
white-space: nowrap; white-space: nowrap;
display: inline-block; display: inline-block;
&.month { &.month {
width: 1.4rem; width: 1.4rem;
text-align: center; text-align: center;
@@ -120,6 +122,7 @@
z-index: 1; z-index: 1;
} }
} }
&.day { &.day {
font-size: 85%; font-size: 85%;
font-family: 'Lato', sans-serif; font-family: 'Lato', sans-serif;
@@ -127,7 +130,7 @@
margin-right: -2px; margin-right: -2px;
width: 1.2rem; width: 1.2rem;
position: relative; position: relative;
left: -.15rem; left: -0.15rem;
} }
} // #archives .date } // #archives .date
@@ -136,6 +139,7 @@
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
#archives { #archives {
margin-top: -1rem; margin-top: -1rem;
ul { ul {
letter-spacing: 0; letter-spacing: 0;
} }

View File

@@ -3,7 +3,7 @@
*/ */
.dash { .dash {
margin: 0 .5rem .6rem .5rem; margin: 0 0.5rem 0.6rem 0.5rem;
border-bottom: 2px dotted var(--dash-color); border-bottom: 2px dotted var(--dash-color);
} }
@@ -60,8 +60,9 @@
#page-tag { #page-tag {
ul > li { ul > li {
&::before { &::before {
margin: 0 .5rem; margin: 0 0.5rem;
} }
> a { > a {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View File

@@ -22,24 +22,29 @@
border-radius: 50%; border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color); border: 1px solid var(--btn-paginator-border-color);
background-color: var(--button-bg); background-color: var(--button-bg);
&:hover { &:hover {
background-color: var(--btn-paginator-hover-color); background-color: var(--btn-paginator-hover-color);
} }
} }
&.active { &.active {
.page-link { .page-link {
background-color: var(--btn-paginator-hover-color); background-color: var(--btn-paginator-hover-color);
color: var(--btn-text-color); color: var(--btn-text-color);
} }
} }
&.disabled { &.disabled {
cursor: not-allowed; cursor: not-allowed;
.page-link { .page-link {
color: rgba(108, 117, 125, 0.57); color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color); border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg); background-color: var(--button-bg);
} }
} }
&:first-child .page-link, &:first-child .page-link,
&:last-child .page-link { &:last-child .page-link {
border-radius: 50%; border-radius: 50%;
@@ -69,9 +74,14 @@
.post-meta { .post-meta {
i { i {
font-size: 0.73rem; font-size: 0.73rem;
&:not(:first-child) {
margin-left: 1.2rem;
}
} }
span:not(:last-child) {
margin-right: 1.2rem; em {
@extend %normal-font-style;
} }
} }
@@ -79,6 +89,7 @@
margin-top: 0.6rem; margin-top: 0.6rem;
margin-bottom: 0.6rem; margin-bottom: 0.6rem;
color: var(--post-list-text-color); color: var(--post-list-text-color);
> p { > p {
/* Make preview shorter on the homepage */ /* Make preview shorter on the homepage */
margin: 0; margin: 0;
@@ -96,13 +107,13 @@
padding-left: 3px; padding-left: 3px;
color: var(--pin-color); color: var(--pin-color);
} }
> span { > span {
display: none; display: none;
} }
} }
} // .post-preview } // .post-preview
} // #post-list } // #post-list
/* Hide SideBar and TOC */ /* Hide SideBar and TOC */
@@ -122,9 +133,9 @@
/* Sidebar is visible */ /* Sidebar is visible */
@media all and (min-width: 831px) { @media all and (min-width: 831px) {
#post-list { #post-list {
margin-top: 1.5rem; margin-top: 1.5rem;
.post-preview .post-meta { .post-preview .post-meta {
.pin { .pin {
background: var(--pin-bg); background: var(--pin-bg);

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