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

Compare commits

..

54 Commits
v2.2 ... v2.4

Author SHA1 Message Date
Cotes Chung
46c2cfe64e Improved the page recognition.
Useful for label localization
2020-06-30 17:39:14 +08:00
Cotes Chung
cc4f18a5a2 Simplify the publishing process.
Renamed the tool script.
2020-06-26 18:48:11 +08:00
Cotes Chung
4491c82b02 Omit the license. 2020-06-26 17:33:43 +08:00
Cotes Chung
b9b8dd8cf1 Beautified the comment block. 2020-06-24 20:47:01 +08:00
Cotes Chung
9a1eab2635 Improved the issue templates. 2020-06-24 20:46:24 +08:00
Cotes Chung
30b013f354 Make the tables responsive. (#85) 2020-06-24 20:08:38 +08:00
Cotes Chung
4d4e9a063e Ensure the LocalStroage keys are valid.
Also update the cache key name.
2020-06-24 02:57:02 +08:00
Cotes Chung
afccb144b1 Improved styles for hiding line numbers. 2020-06-24 02:57:02 +08:00
Cotes Chung
e87ef0d40e Fixed the PV cache. 2020-06-24 02:57:02 +08:00
Cotes Chung
42e0617bde Prettified the inline-code code style. 2020-06-22 21:17:58 +08:00
Cotes Chung
edeb08aa28 Removed the line number of the snippet in the search results. 2020-06-17 21:22:44 +08:00
Cotes Chung
b0a35de9c6 Resume page link hover effect. 2020-06-17 16:17:03 +08:00
Cotes Chung
b3e6fc56f7 Improved the generation rules of Categories ID.
Avoid invalidation of icon animations for closed and opened top categories when category names contain a dot.
2020-06-16 16:01:12 +08:00
Cotes Chung
618ae9dcbc Optimized the TOC position. 2020-06-11 22:01:15 +08:00
Felix Wolfsteller
47e5c3a917 Add option for mastodon contact. 2020-06-09 21:05:20 +08:00
Cotes Chung
f9706411e7 Optimized pin icon size. 2020-06-09 20:37:42 +08:00
Cotes Chung
b22da94134 Updated the docs.
- Updated the build badge on ReadMe.
- Improved the PR template.
2020-06-09 20:37:42 +08:00
Cotes Chung
4476a7d755 Improved the community docs.
- Added the PR template & code of conduct
- Improved the issue templates.
2020-06-08 22:54:40 +08:00
Felix Wolfsteller
ea4cd78921 typo fix: s/defualt/default/ 2020-06-08 15:44:59 +02:00
Cotes Chung
752d0330b7 Remove invalid links from categories page. (#79)
To pass the HTML-Proofer test.
2020-06-07 21:51:11 +08:00
Cotes Chung
fbbd387402 Otpimized pin icon layout. 2020-06-07 21:51:11 +08:00
Cotes Chung
bec344f6e9 Fixed references in the Docs. 2020-06-07 21:29:39 +08:00
Cotes Chung
ba47cc0509 Optimized responsive layout. 2020-06-07 21:22:24 +08:00
Cotes Chung
34d54f9349 Super feature: Pinned posts. 2020-06-06 18:51:56 +08:00
Cotes Chung
d1963af964 Update workflow. 2020-06-06 04:01:17 +08:00
Cotes Chung
eff2a24f4c Enhanced the related posts.
If the number of related posts is less than 3, use the latest posts to supplement.
2020-06-05 06:14:40 +08:00
Cotes Chung
3caafbd50d Unified file naming style. 2020-06-05 06:14:40 +08:00
Cotes Chung
cb37a1909d Updated the comments in site config. 2020-06-05 06:14:40 +08:00
Cotes Chung
88eac91909 Fixed anchor position (desktop views). 2020-06-02 22:14:40 +08:00
Cotes Chung
0bb9c47cf9 Hide broken image of avatar. 2020-06-02 16:18:40 +08:00
Cotes Chung
b28724b4d4 Hide the empty trending tags from panel. 2020-06-02 02:34:24 +08:00
Cotes Chung
75c57d1725 Simplified the post JS file. 2020-06-02 02:34:24 +08:00
Cotes Chung
032f5c7f83 Updated the Chinese version README. 2020-06-01 19:51:58 +08:00
Cotes Chung
75e462a9e9 Replaced the blank loading image with HTML trick. 2020-06-01 19:50:29 +08:00
mattpopovich
ef3860004e Small grammar fix 2020-06-01 16:38:31 +08:00
mattpopovich
032706d27f Fixed some spelling/typos 2020-06-01 16:38:31 +08:00
Cotes Chung
02a269910f Optimized sidebar icons location.
screen width >= 1650px
2020-06-01 16:38:31 +08:00
Cotes Chung
abdf73fff4 Added issues cleaner. 2020-05-30 19:21:09 +08:00
Cotes Chung
be1d1554ea Corrected url within mainfest. 2020-05-30 17:48:16 +08:00
Cotes Chung
a2deea6537 Split the CSS selection from head tag. 2020-05-30 17:48:16 +08:00
Cotes Chung
1a2767ca24 Combine local JS.
’yui-compressor’ is no longer used.
2020-05-30 17:48:16 +08:00
Cotes Chung
cfb67a1cb9 Fixed image lazy loading. 2020-05-29 06:18:53 +08:00
Cotes Chung
171faafc67 Unify local links to posts (#65). 2020-05-29 06:18:53 +08:00
Cotes Chung
db5eb0a18a Beautified syntax highlight for language diff. 2020-05-29 06:18:53 +08:00
Cotes Chung
582ea30459 Support the mathematical expressions (#55). 2020-05-29 06:18:53 +08:00
Cotes Chung
064cefd9ff Combine CDN resources. 2020-05-26 23:25:57 +08:00
Cotes Chung
a57baf7e2c Optimized dark mode colors.
- the further reading cards
- button back-to-top
- table
2020-05-26 14:49:54 +08:00
Cotes Chung
473ab64f74 Added Linkedin share on posts (#60). 2020-05-26 00:01:15 +08:00
Cotes Chung
c5783c1289 Reduce the heading font weight. 2020-05-23 20:41:08 +08:00
Cotes Chung
a64d00c1e6 Make lang attribute configurable 2020-05-23 17:07:06 +08:00
Cotes Chung
7382eaa953 Feature: make contact options configurable (#58, #59). 2020-05-23 15:58:21 +08:00
Cotes Chung
bcd394598b Fixed heading layout in blockquote. 2020-05-22 20:49:27 +08:00
Cotes Chung
6d38f643ae Disable PWA at local. 2020-05-22 20:25:52 +08:00
Cotes Chung
532e7ad451 Fixed a bug in the Categories hierarchy. (#48, #57)
When one post have only one category will hit the bug.
2020-05-22 18:06:40 +08:00
86 changed files with 1036 additions and 649 deletions

76
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at cotes.chung@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -2,12 +2,12 @@
I want to thank you for sparing a time to improve this project! Here are some guidelines for contributing
To ensure that the blog design is not confused, this project do not accept suggestions for design changes, such as colors scheme, fonts, typography, etc. If your request is about enhancement, it is recommended to first submit a `Feature Request` type 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` type issue to discuss whether your idea fits the project.
Generally, contribute to the project by:
1. Fork this project.
2. Create a new branch `my-new-freature`(or `fix-a-bug`), then complete the development, commit and push.
2. Create a new branch `my-new-feature`(or `fix-a-bug`), then complete the development, commit and push.
3. Submit a new `Pull Request`.

View File

@@ -4,19 +4,27 @@ about: Create a report to help us improve
labels: bug
---
<!-- Please make sure you have read the README or Wiki, and your question does not appear in other existing issues (including closed ones). Thanks for your cooperation! Now let's start it. -->
<!-- Note: Please follow the template to open a new issue, otherwise your question will probably be ignored. -->
**Describe the bug**
## 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.
- [ ] There are no similar reports on existing issues (including closed ones).
- [ ] I found the bug on the latest code of `master` branch.
## Describe the bug
<!-- A clear and concise description of what the bug is. -->
**To Reproduce**
<!--
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
-->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
@@ -24,12 +32,14 @@ Steps to reproduce the behavior:
**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->
**Desktop (please complete the following information):**
**Desktop**
<!-- Please complete the following information -->
- OS: [e.g. iOS]
- Browser: [e.g. chrome, safari]
- Version: [e.g. 22]
**Smartphone (please complete the following information):**
**Smartphone**
<!-- please complete the following information -->
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser: [e.g. stock browser, safari]

View File

@@ -4,18 +4,27 @@ about: Suggest an idea for this project
labels: enhancement
---
<!-- Please make sure your request does not appear in other existing issues (including closed ones). Thanks for your cooperation. Now, I can't wait to listen your idea! -->
<!-- Note: Please follow the template to open a new issue, otherwise your question will probably be ignored. -->
## Checklist
<!-- Please complete the following list of tasks, and then check it by change the "[ ]" to "[x]" -->
- [ ] 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).
- [ ] 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.
**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 [...] -->
**Describe the solution you'd like**
## Describe the solution you'd like
<!-- 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. -->
**Additional context**
## Additional context
<!-- Add any other context or screenshots about the feature request here. -->

View File

@@ -4,54 +4,23 @@ about: Ask what ever you want
labels: question
---
<!-- Please make sure you have read the README or Wiki, and your question does not appear in other existing issues (including closed ones). Thanks for your cooperation. Now, uncomment the relevant part to describe the situation. -->
<!-- Note: Please follow the template to open a new issue, otherwise your question will probably be ignored. -->
## 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.
- [ ] There are no similar question on existing issues (including closed ones).
- [ ] I searched the Internet for related problems, but still couldn't solve it.
- [ ] My question is based on the latest code of `master` branch.
## I don't understand what the ReadMe/Wiki says
<!--
**Don't understand what the README or Wiki says.**
Point out the parts that are hard for you to understand.
-->
## I have other questions
<!--
**Want to complain about my bad days.**
Don't hesitate to share your story!
-->
<!--
**Just wanted to say hi to the author.**
Hi, I'm ..., have a nice day !
-->
<!--
**Not sure if it's a bug**
Please try to describe the problem
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser: [e.g. chrome, safari]
- Version: [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser: [e.g. stock browser, safari]
- Version: [e.g. 22]
**Additional context**
Add any other context about the problem here.
-->
Please describe your question.
-->

46
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,46 @@
# Description
<!--
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
-->
Fixes #(issue)
## Type of change
<!--
Please select the desired item checkbox and change it to "[x]", then delete options that are not relevant.
-->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
# How Has This Been Tested?
<!--
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
-->
- [ ] I have run `bash ./tools/build.sh && bash ./tools/test.sh` (at the root of the project) locally and passed
- [ ] I have tested this feature in the browser
## Test Configuration
* Browerser type & version:
* Operating system:
* Bundler version:
* Ruby version:
* Jekyl version:
# Checklist:
<!-- 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 own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] 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,4 +1,4 @@
name: build
name: 'Continuous Integration'
on:
push:
branches-ignore:
@@ -7,7 +7,7 @@ on:
- '*'
paths-ignore:
- '.github/**'
- '!.github/workflows/**'
- '!.github/workflows/ci.yml'
- '.travis.yml'
- '.gitignore'
- 'docs/**'

24
.github/workflows/issues-cleaner.yml vendored Normal file
View File

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

View File

@@ -2,7 +2,7 @@
🌏 English • [简体中文](docs/README_zh-CN.md)
[![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=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)
[![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)
@@ -22,12 +22,14 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
## Features
* Pinned Posts
* Configurable theme mode
* Two-level Categories
* Double-level Categories
* Last modified date for posts
* Table of Contents
* Automatically recommend related posts
* Syntax highlighting
* Mathematical expressions
* Search
* Atom Feeds
* Disqus Comments
@@ -39,7 +41,7 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
### Prerequisites
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installtion of basic environment (`Ruby `, `RubyGems` and `Bundler`).
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of basic environment (`Ruby`, `RubyGems` and `Bundler`).
To improve the writing experience, we need to use some script tools. If your machine is running Debian or macOS, make sure that [GNU coreutils](https://www.gnu.org/software/coreutils/) is installed. Otherwise, install by:
@@ -126,7 +128,7 @@ Generally, go to `_config.yml` and configure the variables as needed. Some of th
* `avatar`
It defines the image file location of avatar. The sample image is `/assets/img/sample/avatar.jpg`, and should be replaced by your own one(a square image). Notice that a huge image file will increase the load time of your site, so keep your avatar image size as samll as possible(may be *<https://tinypng.com/>* will help).
It defines the image file location of avatar. The sample image is `/assets/img/sample/avatar.jpg`, and should be replaced by your own one(a square image). Notice that a huge image file will increase the load time of your site, so keep your avatar image size as small as possible(may be *<https://tinypng.com/>* will help).
* `timezone`
@@ -150,7 +152,7 @@ You may want to preview the site content before publishing, so just run the scri
$ bash tools/run.sh
```
Open a modern brower and visit at <http://localhost:4000>.
Open a modern browser and visit at <http://localhost:4000>.
Few days later, you may find that the file modification(e.g. edits to a post) does not refresh in real time by using `run.sh`. Don't worry, the advanced option `-r` (or `--realtime`) will solve this problem, but it requires [**fswatch**](http://emcrisostomo.github.io/fswatch/) to be installed on your machine. Type `-h` for more information.
@@ -171,27 +173,24 @@ By deploying the site in this way, you're allowed to push the source code direct
|User or Organization | `<username>.github.io`|
|Project| Any one except `<username>.github.io`, let's say `project`|
**2**. Commit the changes of the repo first, then run the initialization script:
**2**. Commit the changes of the repo first, then run the publish script:
```terminal
$ bash tools/init.sh
```console
$ bash tools/publish.sh
```
>**Note**: The *Recent Update* requires the posts' latest git-log date, so make sure the changes in `_posts` have been committed before running this command.
> Please note that the *Recent Update* list requires the latest git-log date of posts, thus make sure the changes in `_posts` have been committed before running this command.
it will automatically generates the *Latest Modified Date* and *Categories / Tags* page for the posts and submit a commit. Its output is similar to the following log:
it will automatically generates the *Latest Modified Date* and *Categories / Tags* page for the posts and submit a commit, and then push to `origin/master`. Its output is similar to the following log:
```terminal
[INFO] Success to update lastmod for 4 post(s).
[INFO] Succeed! 3 category-pages created.
[INFO] Succeed! 4 tag-pages created.
[Automation] Updated the Categories, Tags, Lastmod for post(s).
11 files changed, 46 insertions(+), 3 deletions(-)
...
Updated the Categories, Tags, Lastmod for post(s).
[INFO] Published successfully!
```
**3**. Push the changes to `origin/master` then go to GitHub website and enable GitHub Pages service for the repo.
**3**. Go to GitHub website and enable GitHub Pages service for the repo.
**4**. Check it out:
@@ -233,7 +232,7 @@ The generated static files will be placed in the root of `/path/to/local/project
#### Finishing work
No matter which way you choose to deploy the website on GitHub, please enforce the `HTTPS` for it. See official docs: [Configuring a publishing source for your GitHub Pages site](https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https).
No matter which way you choose to deploy the website on GitHub, please enforce the `HTTPS` for it. See official docs: [Securing your GitHub Pages site with HTTPS](https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https).
### Documentation

View File

@@ -45,18 +45,18 @@ google_site_verification: google_meta_tag_verification # change to your verifica
#--------------------------
# if your site type is Project Pages site, change below value to '/projectname'
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
# change below value to '/projectname'.
baseurl: ''
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai
google_analytics:
# Fill with your Google Analytics ID
id: ''
# The Google Analytics pageviews switch.
id: '' # Fill with your Google Analytics ID
pv:
# The Google Analytics pageviews switch.
# DO NOT enable it unless you know how to deploy the Google Analytics superProxy.
enabled: false
# the next options only valid when `google_analytics.pv` is enabled.
@@ -101,6 +101,8 @@ kramdown:
line_numbers: true
start_line: 1
# DO NOT change this unless you're a Pro user on Jekyll and Web development,
# or you think you're smart enough to change other relevant URLs within this template.
permalink: /posts/:title/
defaults:
@@ -158,11 +160,6 @@ defaults:
-
label: Home
url: /
-
scope:
path: assets/data
values:
layout: compress
sass:
@@ -181,12 +178,13 @@ compress_html:
envs: []
exclude:
- vendor # Avoid Jekyll mistakenly read the vender directory on Travis-CI's VM .
- vendor # Avoid Jekyll mistakenly read the vendor directory on Travis-CI's VM .
- Gemfile.lock
- Gemfile
- tools
- docs
- README.md
- LICENSE
sitemap_exclude: # Sitemap will exclude the following items.
fuzzy:

31
_data/contact.yml Normal file
View File

@@ -0,0 +1,31 @@
# The contact options.
# v2.3
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
-
type: github
icon: 'fab fa-github-alt'
-
type: twitter
icon: 'fab fa-twitter'
-
type: email
icon: 'fas fa-envelope'
noblank: true # open link in current tab
-
type: rss
icon: 'fas fa-rss'
noblank: true
# Uncomment and complete the url below to enable more contact options
# -
# icon: 'fab fa-mastodon' # icons powered by <https://fontawesome.com/>
# url: '' # Fill with your mastodon account page
# -
# icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
# url: '' # Fill with your Linkedin homepage
# -
# icon: 'fab fa-stack-overflow'
# url: '' # Fill with your stackoverflow homepage

View File

@@ -24,6 +24,11 @@ platforms:
# Uncomment below if you need to.
# -
# type: Linkedin
# icon: "fab fa-linkedin"
# link: "https://www.linkedin.com/sharing/share-offsite/?url=URL"
#
# -
# type: Weibo
# icon: "fab fa-weibo"
# link: "http://service.weibo.com/share/share.php?title=TITLE&url=URL"

View File

@@ -0,0 +1,54 @@
<!--
CSS selector for site.
Chirpy v2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT Licensed
-->
{% if page.layout == 'home' %}
<link rel="preload" href="{{ '/assets/css/home.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/home.css' | relative_url }}">
{% elsif page.layout == 'page' %}
{% if page.type == 'categories' %}
<link rel="preload" href="{{ '/assets/css/categories.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/categories.css' | relative_url }}">
{% elsif page.type == 'tags' %}
<link rel="preload" href="{{ '/assets/css/tags.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/tags.css' | relative_url }}">
{% elsif page.type == 'archives' %}
<link rel="preload" href="{{ '/assets/css/archives.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/archives.css' | relative_url }}">
{% else %}
<link rel="preload" href="{{ '/assets/css/page.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/page.css' | relative_url }}">
{% endif %}
{% elsif page.layout == 'category' or page.layout == 'tag' %}
<link rel="preload" href="{{ '/assets/css/category-tag.css' | relative_url }}" as="style">
<link rel="stylesheet" href="{{ '/assets/css/category-tag.css' | relative_url }}">
{% elsif page.layout == 'post' %}
<link rel="preload" as="style" href="{{ '/assets/css/post.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/css/post.css' | relative_url }}">
{% if site.toc and page.toc %}
<link rel="preload" as="style" href="{{ '/assets/css/lib/bootstrap-toc.min.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/css/lib/bootstrap-toc.min.css' | relative_url }}" />
{% endif %}
{% endif %}

View File

@@ -8,10 +8,10 @@
-->
<div id="disqus" class="pt-2 pb-4">
<p class="font-italic text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
<p class="font-italic text-center text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
</div>
<script src="{{ site.baseurl }}/assets/lib/jquery.disqusloader.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/lib/jquery.disqusloader.min.js"></script>
<script>
var options = {
scriptUrl: '//{{ site.disqus.shortname }}.disqus.com/embed.js',

View File

@@ -11,22 +11,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>
{%- if page.layout == "home" -%}
{{- site.title -}}
{%- else -%}
{{ page.title }} | {{ site.title }}
{%- endif -%}
{%- unless page.layout == "home" -%}
{{ page.title | append: " | "}}
{%- endunless -%}
{{ site.title }}
</title>
{% seo title=false %}
{% include favicons.html %}
<!-- google fonts -->
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">
<link rel="dns-prefetch" href="https://fonts.gstatic.com">
<!-- ga -->
<!-- GA -->
{% if jekyll.environment == 'production' %}
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials">
<link rel="dns-prefetch" href="https://www.google-analytics.com">
@@ -40,111 +39,37 @@
{% endif %}
{% endif %}
<!-- jsdelivr CDN -->
<!-- jsDelivr CDN -->
<link rel="preconnect" href="cdn.jsdelivr.net">
<link rel="dns-prefetch" href="cdn.jsdelivr.net">
<!-- Bootstrap -->
<link rel="preload" as="style"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin>
<link rel="preload" as="style"
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css"
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
crossorigin="anonymous">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
<!-- Font Awesome -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css"
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
crossorigin="anonymous">
{% if page.layout == 'home' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/home.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/home.css">
{% include css-selector.html %}
{% elsif page.layout == 'page' %}
<!-- JavaScripts -->
{% if page.title == 'Categories' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/categories.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/categories.css">
{% elsif page.title == 'Tags' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/tags.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/tags.css">
{% elsif page.title == 'Archives' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/archives.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/archives.css">
{% else %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/page.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/page.css">
{% endif %}
{% elsif page.layout == 'category' or page.layout == 'tag' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/category-tag.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/category-tag.css">
{% elsif page.layout == 'post' %}
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/post.css">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/post.css">
{% if site.toc and page.toc %}
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" />
{% endif %}
{% endif %}
<!-- jquery -->
<link rel="preload" as="script"
href="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"
<link rel="preload" as="script" href="https://cdn.jsdelivr.net/npm/jquery@3.4.1"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
<!-- popper -->
<link rel="preload" as="script"
href="https://cdn.jsdelivr.net/npm/popper.js@1.15.0/dist/umd/popper.min.js"
integrity="sha256-fTuUgtT7O2rqoImwjrhDgbXTKUwyxxujIMRIK7TbuNU=" crossorigin>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script>
window.jQuery || document.write('<script src="{{ site.baseurl }}/assets/lib/jquery-3.4.1.min.js"><\/script>');
</script>
<script src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" async></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.15.0/dist/umd/popper.min.js"
integrity="sha256-fTuUgtT7O2rqoImwjrhDgbXTKUwyxxujIMRIK7TbuNU=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"
integrity="sha256-5+02zu5UULQkO7w1GIr6vftCgMfFdZcAHeDtFnKZsBs=" crossorigin="anonymous" async></script>
<script src="{{ site.baseurl }}/assets/js/dist/commons.js" async></script>
{% if page.layout == 'home' or page.layout == 'post' %}
<script src="{{ site.baseurl }}/assets/js/dist/timeago.min.js" async></script>
{% if site.google_analytics.pv.enabled %}
<script src="{{ site.baseurl }}/assets/data/pv-data.json"></script>
<script src="{{ site.baseurl }}/assets/lib/countUp.min.js" async></script>
<script src="{{ site.baseurl }}/assets/js/dist/pageviews.min.js" async></script>
{% endif %}
{% endif %}
{% if site.toc and page.toc and page.layout == 'post' %}
<link rel="preload" as="script" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js">
<script src="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js" async></script>
<script src="{{ site.baseurl }}/assets/js/dist/toc.min.js" async></script>
{% endif %}
<script src="{{ site.baseurl }}/assets/js/dist/tooltip-loader.min.js" async></script>
<!-- PWA -->
<script src="{{ '/app.js' | relative_url }}" defer></script>
{% include js-selector.html %}
</head>

View File

@@ -0,0 +1,49 @@
<!--
JS selector for site.
Chirpy v2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT Licensed
-->
{% if page.layout == 'home' %}
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
{% endif %}
<script src="{{ '/assets/js/home.min.js' | relative_url }}" async></script>
{% elsif page.layout == 'post' %}
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
{% endif %}
<script src="{{ '/assets/js/post.min.js' | relative_url }}" async></script>
{% if page.math %}
<!-- MathJax -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
{% endif %}
{% elsif page.layout == 'page' %}
{% if page.type == 'categories' %}
<script src="{{ '/assets/js/categories.min.js' | relative_url }}" async></script>
{% else %}
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
{% endif %}
{% else %}
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
{% endif %}
<!-- PWA -->
{% if jekyll.environment == 'production' %}
<script src="{{ '/app.js' | relative_url }}" defer></script>
{% endif %}

View File

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

View File

@@ -12,7 +12,7 @@
{% if site.data.updates %}
{% include update_list.html %}
{% include update-list.html %}
{% if update_list.size > 0 %}
@@ -27,7 +27,7 @@
{% assign post = site.posts | where: "url", post_url | first %}
{% if post %}
{% assign url = post.url | prepend: site.baseurl %}
{% assign url = post.url | relative_url %}
<li><a href="{{ url }}">{{ post.title }}</a></li>
@@ -45,24 +45,27 @@
{% endif %} <!-- site.data.updates -->
{% include trending-tags.html %}
{% if trending_tags.size > 0 %}
<div id="access-tags">
<h3 data-toc-skip>
{{- site.data.label.panel.trending_tags -}}
</h3>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% include trending-tags.html %}
{% for tag in trending_tags %}
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
{% endfor %}
{% endfor %}
</div>
</div>
{% endif %}
</div> <!-- .access -->
{% if page.layout == 'post' and site.toc and page.toc %}
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<h3 data-toc-skip class="pl-3 pt-2 mb-3">
<h3 data-toc-skip class="pl-3 pt-2 mb-2">
{{- site.data.label.panel.toc -}}
</h3>
<nav id="toc" data-toggle="toc"></nav>

View File

@@ -1,53 +1,94 @@
<!--
The related posts of current post.
Placed in the bottom of every single post.
Recommend the other 3 posts according to the tags and categories of the current post,
if the number is not enough, use the other latest posts to supplement.
v2.0
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
Published under the MIT License
-->
{% assign MAX_SIZE = 3 %}
<!-- The total size of related posts -->
{% assign TOTAL_SIZE = 3 %}
<!-- An random integer that bigger than 0 -->
{% assign TAG_SCORE = 1 %}
<!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->
{% assign CATEGORY_SCORE = 0.5 %}
{% assign SEPARATOR = ":" %}
{% assign score_list = "" | split: "" %}
{% assign post_index = 0 %}
{% assign last_index = site.posts.size | minus: 1 %}
{% for post in site.posts %}
{% if post.url != page.url %}
{% assign score = 0 %}
{% for tag in post.tags %}
{% if page.tags contains tag %}
{% assign score = score | plus: TAG_SCORE %}
{% endif %}
{% endfor %}
{% for category in post.categories %}
{% if page.categories contains category %}
{% assign score = score | plus: CATEGORY_SCORE %}
{% endif %}
{% endfor %}
{% if score > 0 %}
{% capture score_item %}{{ score }}:{{ post_index }}{% endcapture %}
{% assign score_list = score_list | push: score_item %}
{% endif %}
{% for i in (0..last_index) %}
{% assign post = site.posts[i] %}
{% if post.url == page.url %}
{% continue %}
{% endif %}
{% assign post_index = post_index | plus: 1 %}
{% assign score = 0 %}
{% for tag in post.tags %}
{% if page.tags contains tag %}
{% assign score = score | plus: TAG_SCORE %}
{% endif %}
{% endfor %}
{% for category in post.categories %}
{% if page.categories contains category %}
{% assign score = score | plus: CATEGORY_SCORE %}
{% endif %}
{% endfor %}
{% if score > 0 %}
{% capture score_item %}{{ score }}{{ SEPARATOR }}{{ i }}{% endcapture %}
{% assign score_list = score_list | push: score_item %}
{% endif %}
{% endfor %}
{% assign index_list = "" | split: "" %}
{% if score_list.size > 0 %}
{% assign score_list = score_list | sort | reverse %}
{% assign count = 0 %}
{% for entry in score_list limit: TOTAL_SIZE %}
{% assign index = entry | split: SEPARATOR | last %}
{% assign index_list = index_list | push: index %}
{% endfor %}
{% endif %}
<!-- Fill with the other newlest posts -->
{% assign less = TOTAL_SIZE | minus: index_list.size %}
{% if less > 0 %}
{% for i in (0..last_index) %}
{% assign post = site.posts[i] %}
{% if post.url != page.url %}
{% capture cur_index %}{{ i }}{% endcapture %}
{% unless index_list contains cur_index %}
{% assign index_list = index_list | push: cur_index %}
{% assign less = less | minus: 1 %}
{% if less <= 0 %}
{% break %}
{% endif %}
{% endunless %}
{% endif %}
{% endfor %}
{% endif %}
{% if index_list.size > 0 %}
<div id="related-posts" class="mt-4 mb-2 mb-sm-4 pb-2">
<h3 class="pt-2 mt-1 mb-4 ml-1" data-toc-skip>{{ site.data.label.post.relate_posts }}</h3>
<div class="card-deck mb-4">
{% for score_item in score_list %}
{% assign data = score_item | split: ":" %}
{% assign index = data[1] | plus: 0 %}
{% for entry in index_list %}
{% assign index = entry | plus: 0 %}
{% assign post = site.posts[index] %}
<div class="card">
<a href="{{ post.url | relative_url }}">
@@ -65,11 +106,7 @@
</div>
</a>
</div>
{% assign count = count | plus: 1 %}
{% if count >= MAX_SIZE %}
{% break %}
{% endif %}
{% endfor %}
</div> <!-- .card-deck -->
</div>
{% endif %}
</div> <!-- #related-posts -->
{% endif %}

View File

@@ -5,7 +5,6 @@
© 2017-2019 Cotes Chung
MIT License
-->
<script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.7.3/dest/simple-jekyll-search.min.js" integrity="sha256-qcLR00zq6pJk4je3MLgAri8Nn+ZumUlXgTKR2H/xCY0=" crossorigin="anonymous"></script>
{% 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">
@@ -20,11 +19,13 @@
{% capture not_found %}<p class="mt-5">Oops! No result founds.</p>{% endcapture %}
<script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.7.3/dest/simple-jekyll-search.min.js"></script>
<script>
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('search-results'),
json: '{{ site.baseurl }}/assets/data/search.json',
json: '{{ site.baseurl }}/assets/js/data/search.json',
searchResultTemplate: '{{ result_elem | strip_newlines }}',
noResultsText: '{{ not_found }}'
});

View File

@@ -15,15 +15,15 @@
{% if start == '/' %}
{% assign avatar_url = avatar_url | prepend: site.baseurl %}
{% endif %}
<img src="{{ avatar_url }}" alt="avatar">
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'">
</a>
</div>
<div class="profile-text mt-3">
<div id="site-title">
<a href="{{ site.baseurl }}/">{{- site.title -}}</a>
<div class="site-title">
<a href="{{ '/' | relative_url }}">{{- site.title -}}</a>
</div>
<div id="site-subtitle" class="font-italic">{{- site.tagline -}}</div>
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
</div>
</div>
@@ -45,7 +45,7 @@
or item.name == page.tab_active
or item.name == "Home" and page.layout == "home" %}active{% endif %}">
<a href="{{ ref }}" class="nav-link d-flex justify-content-center align-items-center w-100">
<i class="fa-fw {{ item.icon }} ml-3 mr-3 unloaded"></i>
<i class="fa-fw {{ item.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
<span>{{ item.name | upcase }}</span>
</a>
</li> <!-- .nav-item -->
@@ -64,18 +64,27 @@
<span class="icon-border"></span>
{% endif %}
<a href="https://github.com/{{ site.github.username }}" target="_blank">
<i class="fab fa-github-alt"></i>
</a>
<a href="https://twitter.com/{{ site.twitter.username }}" target="_blank">
<i class="fab fa-twitter"></i>
</a>
{% assign email = site.social.email | split: '@' %}
<a href="javascript:window.open('mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@'))">
<i class="fas fa-envelope"></i>
</a>
<a href="{{ site.baseurl }}/feed.xml" target="_blank">
<i class="fas fa-rss"></i>
</a>
{% for entry in site.data.contact %}
{% capture url %}
{%- if entry.type == 'github' -%}
https://github.com/{{ site.github.username }}
{%- elsif entry.type == 'twitter' -%}
https://twitter.com/{{ site.twitter.username }}
{%- elsif entry.type == 'email' -%}
{% assign email = site.social.email | split: '@' %}
javascript:window.open('mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@'))
{%- elsif entry.type == 'rss' -%}
{{ "/feed.xml" | relative_url }}
{%- else -%}
{{ entry.url }}
{%- endif -%}
{% endcapture %}
{% if url != '' %}
<a href="{{ url }}" {% unless entry.noblank %}target="_blank"{% endunless %}>
<i class="{{ entry.icon }}"></i>
</a>
{% endif %}
{% endfor %}
</div>

View File

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

View File

@@ -16,7 +16,7 @@ layout: page
<ul class="post-content pl-0">
{% for post in site.categories[page.category] %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | absolute_url }}">{{ post.title }}</a>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
</li>

View File

@@ -9,13 +9,19 @@ layout: compress
<!DOCTYPE html>
{% if site.lang %}
{% assign lang = site.lang | split: "_" | first %}
{% else %}
{% assign lang = 'en' %}
{% endif %}
{% capture prefer_mode %}
{% if site.theme_mode != "dual" %}
mode="{{ site.theme_mode }}"
{% endif %}
{% endcapture %}
<html lang="en" {{ prefer_mode }} >
<html lang="{{ lang }}" {{ prefer_mode }} >
{% include head.html %}

View File

@@ -7,12 +7,55 @@ layout: page
# MIT Licensed
---
{% assign pinned = site.posts | where_exp: "item", "item.pin == true" %}
{% assign default = site.posts | where_exp: "item", "item.pin == nil " %}
{% assign posts = "" | split: "" %}
<!-- Get pinned posts -->
{% assign offset = paginator.page | minus: 1 | times: paginator.per_page %}
{% assign pinned_num = pinned.size | minus: offset %}
{% if pinned_num > 0 %}
{% for i in (offset..pinned.size) limit: pinned_num %}
{% assign posts = posts | push: pinned[i] %}
{% endfor %}
{% else %}
{% assign pinned_num = 0 %}
{% endif %}
<!-- Get default posts -->
{% assign default_beg = offset | minus: pinned.size %}
{% if default_beg < 0 %}
{% assign default_beg = 0 %}
{% endif %}
{% assign default_num = paginator.posts | size | minus: pinned_num %}
{% assign default_end = default_beg | plus: default_num | minus: 1 %}
{% if default_num > 0 %}
{% for i in (default_beg..default_end) %}
{% assign posts = posts | push: default[i] %}
{% endfor %}
{% endif %}
<div id="post-list">
{% for post in paginator.posts %}
{% for post in posts %}
<div class="post-preview">
<h1>
<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
</h1>
<div class="d-flex justify-content-between pr-xl-2">
<h1><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h1>
{% if post.pin %}
<i class="fas fa-thumbtack fa-fw text-muted mt-1 ml-2 mt-xl-2" data-toggle="tooltip" data-placement="left"
title="Pinned"></i>
{% endif %}
</div>
<div class="post-content">
<p>
{% assign _content = post.content %}
@@ -38,7 +81,9 @@ layout: page
{% endif %}
</div>
</div> <!-- .post-review -->
{% endfor %}
{% endfor %}
</div> <!-- #post-list -->
{% if paginator.total_pages > 0 %}

View File

@@ -64,13 +64,15 @@ layout: default
</div> <!-- .post-meta -->
<div class="post-content">
{% if page.image %}
<img src="{{ page.image }}">
{% endif %}
{{ content }}
<!-- Using lozad. See: <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% if content contains '<img src=' %}
{{ content | replace: '<img src=', '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src=' }}
{% else %}
{{ content }}
{% endif %}
</div>
<div class="post-tail-wrapper text-muted">

View File

@@ -16,7 +16,7 @@ layout: page
<ul class="post-content pl-0">
{% for post in site.tags[page.tag] %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | absolute_url }}">{{ post.title }}</a>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
</li>

View File

@@ -4,9 +4,10 @@ author: Cotes Chung
date: 2019-08-08 11:33:00 +0800
categories: [Blogging, Demo]
tags: [typography]
math: true
---
This Jekyll template totally compatible with Markdown syntax. Now, let's take a look for the text and typography in this theme.
This Jekyll template totally compatible with Markdown syntax. Now, let's take a look for the text and typography in here.
## Titles
@@ -49,7 +50,7 @@ Fluttering and dancing in the breeze.
## Link
[http://127.0.0.1:4000](http://127.0.0.1:4000)
<http://127.0.0.1:4000>
## Footnote
@@ -66,6 +67,15 @@ Click the hook will locate the footnote[^footnote].
This is an example of `Inline Code`.
## Mathematics
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
When \\(a \ne 0\\), there are two solutions to \\(ax^2 + bx + c = 0\\) and they are
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
## Code Snippet

View File

@@ -73,7 +73,7 @@ tag: TAG_NAME # e.g. bee
---
```
With the increasing number of posts, the number of categories and tags will increase several times! If we still manually create these *category*/*tag* type files, it will obviously be a super time-consuming job, and it is very likely to miss some of them(i.e. when you click on the missing `category` or `tag` link from a post or somewhere, it will complain to you '404'). The good news is that we got a lovely script tool `_scripts/sh/create_pages.sh` to finish the boring task. Basically we will use it via `tools/init.sh` instead of running it separately. Check out its use case [here]({{ "/posts/getting-started/#option-1-built-by-github-pages" | relative_url }}).
With the increasing number of posts, the number of categories and tags will increase several times! If we still manually create these *category*/*tag* type files, it will obviously be a super time-consuming job, and it is very likely to miss some of them(i.e. when you click on the missing `category` or `tag` link from a post or somewhere, it will complain to you '404'). The good news is that we got a lovely script tool `_scripts/sh/create_pages.sh` to finish the boring task. Basically we will use it via `tools/publish.sh` instead of running it separately. Check out its use case [here]({{ "/posts/getting-started/#option-1-built-by-github-pages" | relative_url }}).
## Last modified date
@@ -87,7 +87,7 @@ The last modified date of a post is obtained according to its latest git commit
...
```
You can choose to create this file manually, but as you may notice, the better approach is to let it be automatically generated by a tool script. And `_scripts/sh/dump_lastmod.py` was born for this! Similar to the another script `_scripts/sh/create_pages.sh` mentioned above, it is also be called from `tools/init.sh`, so it doesn't have to be used separately.
You can choose to create this file manually, but as you may notice, the better approach is to let it be automatically generated by a tool script. And `_scripts/sh/dump_lastmod.sh` was born for this! Similar to the another script `_scripts/sh/create_pages.sh` mentioned above, it is also be called from `tools/publish.sh`, so it doesn't have to be used separately.
When some posts have been modified since their published date and also the file `_data/updates.yml` was created correctly, a list with the label **Recent Updates** will be displayed in the right panel of the desktop view, which records the five most recently modified articles.
@@ -113,6 +113,28 @@ comments: false
```
## Mathematics
For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by:
```yaml
---
math: true
---
```
## 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:
```yaml
---
pin: true
---
```
## Code Block
Markdown symbols <code class="highlighter-rouge">```</code> can easily create a code block as following examples.
@@ -136,7 +158,7 @@ items:
quantity: 4
```
#### Liquid codes
#### Liquid Codes
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}{%{% endraw %} raw {%raw%}%}{%endraw%}` and `{% raw %}{%{% endraw %} endraw {%raw%}%}{%endraw%}` .
@@ -148,6 +170,8 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{%
```
{% endraw %}
## Learn More
For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/).

View File

@@ -4,11 +4,12 @@ author: Cotes Chung
date: 2019-08-09 20:55:00 +0800
categories: [Blogging, Tutorial]
tags: [getting started]
pin: true
---
## Prerequisites
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installtion of basic environment (`Ruby `, `RubyGems` and `Bundler`).
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of basic environment (`Ruby`, `RubyGems` and `Bundler`).
To improve the writing experience, we need to use some script tools. If your machine is running Debian or macOS, make sure that [GNU coreutils](https://www.gnu.org/software/coreutils/) is installed. Otherwise, install by:
@@ -91,7 +92,7 @@ Generally, go to `_config.yml` and configure the variables as needed. Some of th
* `avatar`
It defines the image file location of avatar. The sample image is `/assets/img/sample/avatar.jpg`, and should be replaced by your own one(a square image). Notice that a huge image file will increase the load time of your site, so keep your avatar image size as samll as possible(may be *<https://tinypng.com/>* will help).
It defines the image file location of avatar. The sample image is `/assets/img/sample/avatar.jpg`, and should be replaced by your own one (a square image). Notice that a huge image file will increase the load time of your site, so keep your avatar image size as small as possible (may be *<https://tinypng.com/>* will help).
* `timezone`
@@ -115,7 +116,7 @@ You may want to preview the site content before publishing, so just run the scri
$ bash tools/run.sh
```
Open a brower and visit <http://localhost:4000>.
Open a browser and visit <http://localhost:4000>.
Few days later, you may find that the file changes does not refresh in real time by using `run.sh`. Don't worry, the advanced option `-r` (or `--realtime`) will solve this problem, but it requires [**fswatch**](http://emcrisostomo.github.io/fswatch/) to be installed on your machine.
@@ -137,28 +138,24 @@ By deploying the site in this way, you're allowed to push the source code direct
|User or Organization | `<username>.github.io`|
|Project| Any one except `<username>.github.io`, let's say `project`|
**2**. Commit the changes of the repo first, then run the initialization script:
**2**. Commit the changes of the repo first, then run the publish script:
```console
$ bash tools/init.sh
$ bash tools/publish.sh
```
> Please note that the *Recent Update* list requires the latest git-log date of posts, thus make sure the changes in `_posts` have been committed before running this command.
it will automatically generates the *Latest Modified Date* and *Categories / Tags* page for the posts and submit a commit. Its output is similar to the following log:
it will automatically generates the *Latest Modified Date* and *Categories / Tags* page for the posts and submit a commit, and then push to `origin/master`. Its output is similar to the following log:
```terminal
[INFO] Success to update lastmod for 4 post(s).
[INFO] Succeed! 3 category-pages created.
[INFO] Succeed! 4 tag-pages created.
[Automation] Updated the Categories, Tags, Lastmod for post(s).
11 files changed, 46 insertions(+), 3 deletions(-)
...
Updated the Categories, Tags, Lastmod for post(s).
[INFO] Published successfully!
```
**3**. Push the changes to `origin/master` then go to GitHub website and enable GitHub Pages service for the repo.
**3**. Go to GitHub website and enable GitHub Pages service for the repo.
**4**. Check it out:
@@ -200,4 +197,4 @@ The generated static files will be placed in the root of `/path/to/local/project
### Finishing work
No matter which way you choose to deploy the website on GitHub, please enforce the `HTTPS` for it. See official docs: [Configuring a publishing source for your GitHub Pages site](https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https).
No matter which way you choose to deploy the website on GitHub, please enforce the `HTTPS` for it. See official docs: [Securing your GitHub Pages site with HTTPS](https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https).

View File

@@ -9,7 +9,7 @@ toc: false
In [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/), the image files of [Favicons](https://www.favicon-generator.org/about/) are placed in `assets/img/favicons/`. You may need to replace them with your own. So let's see how to customize these Favicons.
Whit a square image (PNG, JPG or GIF) in hand, open the site [*Favicon & App Icon Generator*](https://www.favicon-generator.org/) and upload your original image.
With a square image (PNG, JPG or GIF) in hand, open the site [*Favicon & App Icon Generator*](https://www.favicon-generator.org/) and upload your original image.
![upload-image]({{ "/assets/img/sample/upload-image.png" | relative_url }})

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# Files sync monitoer
# Files sync monitor
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
@@ -8,7 +8,7 @@
# $1 -> the origin file with absolute path.
# $2 -> the origin sync directory
# $3 -> the destination sync direcotry
# $3 -> the destination sync directory
# Omit the system temp file
if [[ ! -f $1 ]]; then

View File

@@ -77,11 +77,34 @@ $sidebar-display: "sidebar-display";
overflow-y: auto;
width: $sidebar-width-medium;
z-index: 99;
background: rgb(42, 30, 107);
background: var(--sidebar-bg);
a {
@include sidebar-links;
}
.site-title {
text-align: center;
a {
// color: var(--site-title-color);
font-weight: 900;
font-size: 1.5rem;
letter-spacing: .5px;
&:hover {
color: #fff;
text-decoration: none;
}
}
}
.site-subtitle {
font-size: 95%;
text-align: center;
color: #828282;
line-height: 1.2rem;
word-spacing: 1px;
margin: .5rem 1.5rem 2rem 1.5rem;
}
.sidebar-bottom {
.icon-border+a { // the icon behide mode-toggle
margin-left: .1rem;
@@ -239,29 +262,6 @@ $sidebar-display: "sidebar-display";
}
} // #avatar
#site-title {
text-align: center;
a {
// color: var(--site-title-color);
font-weight: 900;
font-size: 1.5rem;
letter-spacing: .5px;
&:hover {
color: #fff;
text-decoration: none;
}
}
}
#site-subtitle {
font-size: 95%;
text-align: center;
color: #828282;
line-height: 1.2rem;
word-spacing: 1px;
margin: .5rem 1.5rem 2rem 1.5rem;
}
#search-result-wrapper {
display: none;
position: fixed;
@@ -755,6 +755,8 @@ a {
div.post-content {
>table, li>table {
min-width: 60%;
display: block;
overflow-x: auto;
border-collapse: collapse;
border-spacing: 0;
margin-bottom: 1.5rem;
@@ -946,7 +948,7 @@ table {
height: 5rem;
}
#site-subtitle {
.site-subtitle {
@include ml-mr(1.8rem);
}
@@ -1188,12 +1190,12 @@ table {
max-width: 700px;
}
#site-title {
.site-title {
font-size: 1.3rem;
margin-left: 0!important;
}
#site-subtitle {
.site-subtitle {
font-size: 90%;
@include ml-mr(1rem);
}
@@ -1352,56 +1354,54 @@ table {
}
#profile-wrapper {
margin-top: 4rem;
margin-bottom: 3rem;
padding-left: 18%;
margin: 4rem 2rem 3rem 4rem;
-ms-flex-direction: column!important;
}
#avatar {
-webkit-box-pack: normal !important;
-ms-flex-pack: normal !important;
justify-content: normal !important;
>a {
width: 6.2rem;
height: 6.2rem;
#avatar {
-webkit-box-pack: normal !important;
-ms-flex-pack: normal !important;
justify-content: normal !important;
>a {
width: 6.2rem;
height: 6.2rem;
}
}
}
.profile-text {
padding-left: .5rem;
/* .d-flex */
display: -webkit-box!important;
display: -ms-flexbox!important;
display: flex!important;
/* .flex-wrap */
-ms-flex-wrap: wrap!important;
flex-wrap: wrap!important;
/* .align-content-center */
-ms-flex-line-pack: center!important;
align-content: center!important;
}
#site-title a {
font-size: 1.7rem;
letter-spacing: 1px;
}
.profile-text>div {
text-align: left !important;
width: 100%;
}
#site-subtitle {
word-spacing: 0;
padding-right: 3rem;
margin: .3rem 0 0 0;
.profile-text {
margin-left: .5rem;
/* .d-flex */
display: -webkit-box!important;
display: -ms-flexbox!important;
display: flex!important;
/* .flex-wrap */
-ms-flex-wrap: wrap!important;
flex-wrap: wrap!important;
/* .align-content-center */
-ms-flex-line-pack: center!important;
align-content: center!important;
>div {
text-align: left !important;
width: 100%;
}
}
}
#sidebar {
width: $sidebar-width-large;
.site-title a {
font-size: 1.7rem;
letter-spacing: 1px;
margin: 0;
}
.site-subtitle {
word-spacing: 0;
margin: .3rem 0 0 0;
}
ul {
margin-left: 5%;
margin-left: 3%;
>li>a {
padding-left: 2.5rem;
-webkit-box-pack: start!important;
@@ -1457,10 +1457,8 @@ table {
margin-left: 0;
}
}
} // .sidebar-bottom
} // #sidebar
footer>div.d-flex {
width: 87%;
max-width: 1140px;
@@ -1475,6 +1473,7 @@ table {
} // min-width: 1650px
@media all and (min-width: 1700px) {
#topbar-wrapper {
padding-right: calc(100% - #{$sidebar-width-large}

View File

@@ -38,6 +38,7 @@
}
%heading {
font-weight: 400;
font-family: 'Lato', 'Microsoft Yahei', sans-serif;
}
@@ -49,11 +50,8 @@
}
%anchor {
.post-content &,
#page & {
padding-top: 3.5rem;
margin-top: -2.5rem;
}
padding-top: 3.5rem;
margin-top: -2.5rem;
}
/*---------- scss mixin ---------*/

View File

@@ -39,7 +39,7 @@ html[mode=dark] {
}
.highlighter-rouge {
background: var(--highlight-bg-color);
background-color: var(--highlight-bg-color);
@extend %code-snippet-radius;
color: var(--highlighter-rouge-color);
margin-bottom: 1.2em; /* Override BS Inline-code style */
@@ -94,16 +94,21 @@ code {
-moz-hyphens: none;
hyphens: none;
&.highlighter-rouge {
padding: 2px 4px;
padding: 3px 5px;
margin: 0 .15rem;
border-radius: 4px;
background-color: var(--inline-code-bg);
}
@at-root a>&.highlighter-rouge {
padding-bottom: 0; // show link's underlinke
color: inherit;
}
@at-root a:hover>&.highlighter-rouge {
border-bottom: none;
}
blockquote &.highlighter-rouge {
color: inherit;
}
}
td.rouge-code {
@@ -111,9 +116,10 @@ td.rouge-code {
padding-right: 1rem;
}
/* Hide line numbers for defualt, console, and terminal code snippets */
/* Hide line numbers for default, console, and terminal code snippets */
div {
&[class^='highlighter-rouge'],
&.language-plaintext.highlighter-rouge,
&.language-console.highlighter-rouge,
&.language-terminal.highlighter-rouge {
pre.lineno {

View File

@@ -71,8 +71,8 @@
.highlight .gh { } /* Generic Heading & Diff Header */
.highlight .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */
.highlight .gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */
.highlight .gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */
.highlight .gd { color: #f92672; background-color: #561c08 } /* Generic.Deleted & Diff Deleted */
.highlight .gi { color: #a6e22e; background-color: #0b5858 } /* Generic.Inserted & Diff Inserted */
/*----- My styles ------*/
@@ -83,6 +83,8 @@
--highlight-lineno-color: #6c6c6d;
--highlight-lineno-border-color: #3c4042;
--inline-code-bg: var(--highlight-bg-color);
.highlight {
.gp { color: #818c96; }
}

View File

@@ -23,7 +23,7 @@
--link-color: rgb(138, 180, 248);
--link-underline-color: rgb(82, 108, 150);
--main-border-color: rgb(44, 45, 45);
--button-bg: rgb(39, 40, 33);
--button-bg: rgb(39, 40, 43);
--blockquote-border-color: rgb(66, 66, 66);
--blockquote-text-color: rgb(117, 117, 117);
@@ -32,7 +32,6 @@
--btn-backtotop-border-color: var(--btn-border-color);
--btn-box-shadow: var(--main-wrapper-bg);
--card-bg: rgb(39, 40, 33);
--card-header-bg: rgb(51, 50, 50);
--label-color: rgb(108, 117, 125);
@@ -46,6 +45,7 @@
/* Home page */
--post-list-text-color: rgb(175, 176, 177);
--btn-patinator-text-color: var(--text-color);
--btn-paginator-hover-color: rgb(64, 65, 66);
--btn-active-bg: rgba(28, 52, 94, 1);
--btn-active-border-color: rgb(66, 94, 138);
--btn-text-color: var(--text-color);
@@ -56,14 +56,15 @@
--toc-highlight: rgb(116, 178, 243);
--tag-bg: rgb(41, 40, 40);
--tag-hover: rgb(43, 56, 62);
--tb-odd-bg: rgba(52, 53, 42, 0.52); /* odd rows of the posts' table */
--tb-odd-bg: rgba(42, 47, 53, 0.52); /* odd rows of the posts' table */
--tb-even-bg: rgb(31, 31, 34); /* even rows of the posts' table */
--tb-border-color: var(--tb-odd-bg);
--footnote-target-bg: rgb(63, 81, 181);
--btn-share-color: #6c757d;
--btn-share-hover-color: #bfc1ca;
--relate-post-date: var(--text-muted-color);
--card-border-color: var(--main-wrapper-bg);
--card-bg: rgb(39, 40, 43);
--card-border-color: rgb(53, 53, 60);
--card-box-shadow: var(--main-wrapper-bg);
/* tags */

View File

@@ -17,11 +17,11 @@
.highlight .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd { color: #d01040; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi { color: #008080; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
@@ -76,4 +76,5 @@
--highlight-lineno-color: #c2c6cc;
--highlight-lineno-border-color: #e9ecef;
--inline-code-bg: #f3f3f3;
} // light-syntax

View File

@@ -63,12 +63,14 @@
--input-focus-border-color: var(--btn-border-color);
/* Home */
/* Home page */
--post-list-text-color: dimgray;
--btn-patinator-text-color: #555555;
--btn-paginator-hover-color: #e9ecef;
--btn-active-bg: #2a408e;
--btn-active-border-color: #007bff;

View File

@@ -11,90 +11,101 @@
#post-list {
margin-top: 1rem;
padding-right: .5rem;
.post-meta {
i:not(:first-child) { // post-meta icons on HOME
margin-left: 1.5rem;
.post-preview {
padding-top: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--main-border-color);
h1 {
font-size: 1.4rem;
margin: 0;
~i { // pinned icon
font-size: .86rem;
}
}
}
}
.post-meta {
i {
font-size: .73rem;
&:not(:first-child) { // post-meta icons on the homepage
margin-left: 1.5rem;
}
}
}
.post-content {
margin-top: .6rem;
margin-bottom: .6rem;
color: var(--post-list-text-color);
>p {
/* Make preview shorter on the homepage */
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
} // .post-preview
} // #post-list
.pagination {
font-size: 1rem;
a:hover {
text-decoration: none;
}
}
.post-preview {
padding-top: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--main-border-color);
>h1 {
font-size: 1.4rem;
margin: 0;
}
i.far { /* fontawesome icons */
font-size: 86%;
}
.post-content {
margin-top: .6rem;
margin-bottom: .6rem;
color: var(--post-list-text-color);
>p { /* Make preview shorter in Home page*/
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
.page-item {
.page-link {
color: var(--btn-patinator-text-color);
width: 2.5rem;
height: 2.5rem;
padding: 0;
text-align: center;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
}
.page-item {
.page-link {
color: var(--btn-patinator-text-color);
width: 2.5rem;
height: 2.5rem;
padding: 0;
text-align: center;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
}
&.active {
.page-link {
background-color: var(--btn-active-bg);
border-color: var(--btn-active-border-color);
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
color: var(--btn-text-color);
}
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
&:hover {
background-color: var(--btn-paginator-hover-color)
}
}
}
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
&:not(:last-child) {
margin-right: 0.6rem;
}
} // .page-item
&.active {
.page-link {
background-color: var(--btn-active-bg);
border-color: var(--btn-active-border-color);
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
color: var(--btn-text-color);
}
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg);
}
}
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item
} // .pagination
@media all and (max-width: 576px) {
#post-list .post-meta>span i:not(:first-child) {
@@ -118,12 +129,12 @@
.pagination {
font-size: .85rem;
.page-item .page-link {
width: 2.2rem;
height: 2.2rem;
}
}
.page-item .page-link {
width: 2.2rem;
height: 2.2rem;
}
}
/* Pannel hidden */

View File

@@ -56,7 +56,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
.post-navigation {
padding-top: 3rem;
padding-bottom: 2rem;
padding-bottom: 4rem;
.btn {
@include btn-post-nav;
@@ -127,6 +127,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
}
#toc-wrapper {
margin-top: 7rem;
border-left: 1px solid rgba(158, 158, 158, 0.17);
position: -webkit-sticky;
position: sticky;

View File

@@ -8,7 +8,7 @@ layout: compress
# MIT License
---
{% assign icon_url = "/assets/img/favicons/" | relative_url %}
{% assign icon_url = "/assets/img/favicons" | relative_url %}
{
"name": "{{ site.title }}",

21
assets/js/_commons.js Normal file
View File

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

View File

@@ -5,6 +5,7 @@
* © 2018-2019 Cotes Chung
* MIT License
*/
$(function() {
var didScroll;
@@ -13,7 +14,7 @@ $(function() {
var topbarHeight = $('#topbar-wrapper').outerHeight();
$(window).scroll(function(event) {
if ($("#topbar-title").is(":hidden")) { // Not in small screens
if ($("#topbar-title").is(":hidden")) { /* Not in small screens */
didScroll = true;
}
});
@@ -28,12 +29,12 @@ $(function() {
function hasScrolled() {
var st = $(this).scrollTop();
// Make sure they scroll more than delta
/* Make sure they scroll more than delta */
if (Math.abs(lastScrollTop - st) <= delta)
return;
if (st > lastScrollTop && st > topbarHeight) {
// Scroll Down
/* Scroll Down */
$('#topbar-wrapper').removeClass('topbar-down').addClass('topbar-up');
if ( $('#toc-wrapper').length > 0) {
@@ -45,11 +46,11 @@ $(function() {
}
if ($('#search-input').is(':focus')) {
$('#search-input').blur(); // remove focus
$('#search-input').blur(); /* remove focus */
}
} else {
// Scroll Up
/* Scroll Up */
if (st + $(window).height() < $(document).height()) {
$('#topbar-wrapper').removeClass('topbar-up').addClass('topbar-down');
if ( $('#toc-wrapper').length > 0) {

View File

@@ -5,7 +5,8 @@
* © 2018-2019 Cotes Chung
* MIT License
*/
$(function(){
$(function() {
var DEFAULT = $("#topbar-title").text().trim();
var title = ($("div.post>h1").length > 0) ?
@@ -18,12 +19,12 @@ $(function(){
}
}
// Replace topbar title while scroll screens.
/* Replace topbar title while scroll screens. */
$(window).scroll(function () {
if ($("#post-list").length // in Home page
|| $("div.post>h1").is(":hidden") // is tab pages
|| $("#topbar-title").is(":hidden") // not mobile screens
|| $("#sidebar.sidebar-expand").length) { // when the sidebar trigger is clicked
if ($("#post-list").length /* in Home page */
|| $("div.post>h1").is(":hidden") /* is tab pages */
|| $("#topbar-title").is(":hidden") /* not mobile screens */
|| $("#sidebar.sidebar-expand").length) { /* when the sidebar trigger is clicked */
return false;
}
@@ -36,9 +37,9 @@ $(function(){
$("#topbar-title").text(DEFAULT);
}
}
})
});
// Click title remove hover effect.
/* Click title remove hover effect. */
$('#topbar-title').click(function() {
$('body,html').animate({scrollTop: 0}, 800);
});

22
assets/js/_home-post.js Normal file
View File

@@ -0,0 +1,22 @@
/*!
JS group for layout Home or Post
Chirpy v2.3
https://github.com/cotes2020/jekyll-theme-chirpy
© 2020 Cotes Chung
MIT License
*/
{% include_relative _commons.js %}
{% include_relative _utils/timeago.js %}
{% if site.google_analytics.pv.enabled %}
const proxyData = '{"url": "{{ site.google_analytics.pv.proxy_endpoint }}"}';
{% include_relative _utils/pageviews.js %}
{% include_relative lib/_countUp.min.js %}
{% endif %}

View File

@@ -10,8 +10,8 @@ $(function() {
var child_prefix = "l_";
var parent_prefix = "h_";
// close up top-category
$(".collapse").on("hide.bs.collapse", function() { // Bootstrap collapse events.
/* close up top-category */
$(".collapse").on("hide.bs.collapse", function() { /* Bootstrap collapse events. */
var parent_id = parent_prefix + $(this).attr('id').substring(child_prefix.length);
if (parent_id) {
$("#" + parent_id + " .far.fa-folder-open").attr("class", "far fa-folder fa-fw");
@@ -20,7 +20,7 @@ $(function() {
}
});
// expand the top category
/* expand the top category */
$(".collapse").on("show.bs.collapse", function() {
var parent_id = parent_prefix + $(this).attr('id').substring(child_prefix.length);
if (parent_id) {

View File

@@ -35,7 +35,7 @@ function countPV(path, rows) {
if (gaPath == path ||
gaPath == _v2_url ||
gaPath.concat('/') == _v2_url ||
gaPath.slice(gaPath.lastIndexOf('/') + 1) === fileName) { // old permalink record
gaPath.slice(gaPath.lastIndexOf('/') + 1) === fileName) { /* old permalink record */
count += parseInt(rows[i][1]);
}
}
@@ -67,13 +67,13 @@ function displayPageviews(data) {
var hasInit = getInitStatus();
var rows = data.rows;
if ($("#post-list").length > 0) { // the Home page
if ($("#post-list").length > 0) { /* the Home page */
$(".post-preview").each(function() {
var path = $(this).children("h1").children("a").attr("href");
var path = $(this).children("div").children("h1").children("a").attr("href");
tacklePV(rows, path, $(this).find('.pageviews'), hasInit);
});
} else if ($(".post").length > 0) { // the post
} else if ($(".post").length > 0) { /* the post */
var path = window.location.pathname;
tacklePV(rows, path, $('#pv'), hasInit);
}
@@ -94,8 +94,8 @@ var getInitStatus = (function() {
var PvCache = (function() {
const KEY_PV = "pv";
const KEY_CREATION = "pv-created-date";
const KEY_PV_TYPE = "pv-type";
const KEY_CREATION = "pv_created_date";
const KEY_PV_TYPE = "pv_type";
var PvType = {
ORIGIN: "origin",
@@ -133,12 +133,12 @@ var PvCache = (function() {
isExpired: function() {
if (PvCache.isOriginCache() ) {
let date = new Date(get(KEY_CREATION));
date.setDate(date.getDate() + 1); // fetch origin-data every day
date.setDate(date.getDate() + 1); /* fetch origin-data every day */
return Date.now() >= date.getTime();
} else if (PvCache.isProxyCache() ) {
let date = new Date(get(KEY_CREATION) );
date.setHours(date.getHours() + 1); // proxy-data is updated every hour
date.setHours(date.getHours() + 1); /* proxy-data is updated every hour */
return Date.now() >= date.getTime();
}
return false;
@@ -148,10 +148,17 @@ var PvCache = (function() {
},
newerThan: function(pv) {
return PvCache.getAllPagevies() > pv.totalsForAllResults["ga:pageviews"];
},
inspectKeys: function() {
if (localStorage.getItem(KEY_PV) == null
|| localStorage.getItem(KEY_PV_TYPE) == null
|| localStorage.getItem(KEY_CREATION) == null) {
localStorage.clear();
}
}
};
})(); // PvCache
})(); /* PvCache */
function fetchOriginPageviews(pvData) {
@@ -164,7 +171,7 @@ function fetchOriginPageviews(pvData) {
function fetchProxyPageviews() {
let proxy = JSON.parse(proxyData); // see file '/assets/data/pv-data.json'
let proxy = JSON.parse(proxyData); /* see file '/assets/data/pv-data.json' */
$.ajax({
type: 'GET',
url: proxy.url,
@@ -184,6 +191,8 @@ $(function() {
if ($('.pageviews').length > 0) {
PvCache.inspectKeys();
let cache = PvCache.getData();
if (cache) {
@@ -205,7 +214,7 @@ $(function() {
fetchProxyPageviews();
}
} else { // still valid
} else { /* still valid */
displayPageviews(cache);
if (PvCache.isOriginCache() ) {

View File

@@ -7,4 +7,4 @@
*/
$(function () {
$('[data-toggle="tooltip"]').tooltip();
})
});

13
assets/js/categories.min.js vendored Normal file
View File

@@ -0,0 +1,13 @@
---
layout: compress
# JS for layout tab Categories.
# Chirpy v2.3
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT License
---
{% include_relative _commons.js %}
{% include_relative _utils/category-collapse.js %}

View File

@@ -1,4 +1,6 @@
---
layout: compress
# The list to be cached by PWA
# Chirpy v2.2
# https://github.com/cotes2020/jekyll-theme-chirpy
@@ -17,15 +19,13 @@ const include = [
'{{ "/assets/css/page.css" | relative_url }}',
'{{ "/assets/css/post.css" | relative_url }}',
'{{ "/assets/css/category-tag.css" | relative_url }}',
'{{ "/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" | relative_url }}',
'{{ "/assets/css/lib/bootstrap-toc.min.css" | relative_url }}',
/*--- Javascripts ---*/
'{{ "/assets/js/dist/commons.js" | relative_url }}',
'{{ "/assets/js/dist/timeago.min.js" | relative_url }}',
'{{ "/assets/js/dist/category-collapse.min.js" | relative_url }}',
'{{ "/assets/js/dist/toc.min.js" | relative_url }}',
'{{ "/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js" | relative_url }}',
'{{ "/assets/js/home.min.js" | relative_url }}',
'{{ "/assets/js/page.min.js" | relative_url }}',
'{{ "/assets/js/post.min.js" | relative_url }}',
/*--- HTML ---*/
@@ -52,7 +52,7 @@ const include = [
{% endif %}
{% endfor %}
{% include update_list.html %}
{% include update-list.html %}
{% for item in update_list %}
{% assign url = item | split: "::" | last | prepend: "/posts/" | append: "/" %}
{% assign post_list = post_list | push: url %}
@@ -98,12 +98,7 @@ const include = [
/*--- Others ---*/
{% if site.google_analytics.pv.enabled %}
'{{ "/assets/lib/countUp.min.js" | relative_url }}',
'{{ "/assets/js/dist/pageviews.min.js" | relative_url }}',
{% endif %}
'{{ "/assets/data/search.json" | relative_url }}',
'{{ "/assets/js/data/search.json" | relative_url }}',
'{{ "/404.html" | relative_url }}',
'{{ "/app.js" | relative_url }}',
@@ -111,6 +106,6 @@ const include = [
];
const exclude = [
'/assets/data/pv-data.json',
'/assets/js/data/pv-cache.js',
'/img.shields.io/'
];

View File

@@ -1,8 +1,7 @@
---
layout: compress
---
const proxyData = '{"url": "{{ site.google_analytics.pv.proxy_endpoint }}"}';
{%- capture pv_data -%}
{%- if site.google_analytics.pv.cache and site.google_analytics.pv.enabled -%}
{% include_relative _pageviews.json %}

View File

@@ -1,4 +1,5 @@
---
layout: compress
---
[
@@ -9,9 +10,9 @@
"categories": "{{ post.categories | join: ', '}}",
"tags": "{{ post.tags | join: ', ' }}",
"date": "{{ post.date }}",
{% assign content = post.content %}
{% assign _content = post.content %}
{% include no-linenos.html %}
"snippet": "{{ content | strip_html | strip_newlines | remove_chars | escape | truncate: 300 | replace: '\', '\\\\' }}"
"snippet": "{{ _content | strip_html | strip_newlines | remove_chars | escape | truncate: 300 | replace: '\', '\\\\' }}"
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]

View File

@@ -1 +0,0 @@
$(window).scroll(function(){if($(this).scrollTop()>50&&$("#sidebar-trigger").css("display")=="none"){$("#back-to-top").fadeIn()}else{$("#back-to-top").fadeOut()}});$(function(){$("#back-to-top").click(function(){$("body,html").animate({scrollTop:0},800);return false})});

View File

@@ -1 +0,0 @@
function copyLink(a){if(!a||0===a.length){a=window.location.href}var b=$("<input>");$("body").append(b);b.val(a).select();document.execCommand("copy");b.remove();alert("Link copied successfully!")};

View File

@@ -1 +0,0 @@
$(function(){var j=$("#sidebar-trigger");var o=$("#search-trigger");var h=$("#search-cancel");var b=$("#search-cleaner");var e=$("#main");var c=$("#topbar-title");var k=$("#search-wrapper");var i=$("#search-result-wrapper");var g=$("#search-results");var l=$("#search-input");var a=$("#search-hints");var d=(function(){var p=0;return{block:function(){p=$(window).scrollTop()},release:function(){$("html,body").scrollTop(p)},getOffset:function(){return p}}})();var m=(function(){return{on:function(){j.addClass("unloaded");c.addClass("unloaded");o.addClass("unloaded");k.addClass("d-flex");h.addClass("loaded")},off:function(){h.removeClass("loaded");k.removeClass("d-flex");j.removeClass("unloaded");c.removeClass("unloaded");o.removeClass("unloaded")}}})();var n=(function(){var p=false;return{on:function(){if(!p){i.removeClass("unloaded");e.addClass("hidden");p=true;d.block()}},off:function(){if(p){g.empty();if(a.hasClass("unloaded")){a.removeClass("unloaded")}i.addClass("unloaded");b.removeClass("visable");e.removeClass("hidden");l.val("");p=false;d.release()}},isVisable:function(){return p}}})();function f(){return h.hasClass("loaded")}o.click(function(){m.on();n.on();l.focus()});h.click(function(){m.off();n.off()});l.focus(function(){k.addClass("input-focus")});l.focusout(function(){k.removeClass("input-focus")});l.on("keyup",function(p){if(p.keyCode==8&&l.val()==""){if(!f()){n.off()}else{a.removeClass("unloaded")}}else{if(l.val()!=""){n.on();if(!b.hasClass("visible")){b.addClass("visable")}if(f()){a.addClass("unloaded")}}}});b.on("click",function(){l.val("");if(f()){a.removeClass("unloaded");g.empty()}else{n.off()}l.focus();b.removeClass("visable")})});

View File

@@ -1 +0,0 @@
$(function(){var a=(function(){const c="sidebar-display";var d=false;var b=$("body");return{toggle:function(){if(d==false){b.attr(c,"")}else{b.removeAttr(c)}d=!d}}})();$("#sidebar-trigger").click(a.toggle);$("#mask").click(a.toggle)});

View File

@@ -1 +0,0 @@
$(function(){var d;var c=0;var e=5;var b=$("#topbar-wrapper").outerHeight();$(window).scroll(function(f){if($("#topbar-title").is(":hidden")){d=true}});setInterval(function(){if(d){a();d=false}},250);function a(){var f=$(this).scrollTop();if(Math.abs(c-f)<=e){return}if(f>c&&f>b){$("#topbar-wrapper").removeClass("topbar-down").addClass("topbar-up");if($("#toc-wrapper").length>0){$("#toc-wrapper").removeClass("topbar-down")}if($(".access").length>0){$(".access").removeClass("topbar-down")}if($("#search-input").is(":focus")){$("#search-input").blur()}}else{if(f+$(window).height()<$(document).height()){$("#topbar-wrapper").removeClass("topbar-up").addClass("topbar-down");if($("#toc-wrapper").length>0){$("#toc-wrapper").addClass("topbar-down")}if($(".access").length>0){$(".access").addClass("topbar-down")}}}c=f}});

View File

@@ -1 +0,0 @@
$(function(){var a=$("#topbar-title").text().trim();var b=($("div.post>h1").length>0)?$("div.post>h1").text().trim():$("h1").text().trim();if($("#page-category").length||$("#page-tag").length){if(/\s/.test(b)){b=b.replace(/[0-9]/g,"").trim()}}$(window).scroll(function(){if($("#post-list").length||$("div.post>h1").is(":hidden")||$("#topbar-title").is(":hidden")||$("#sidebar.sidebar-expand").length){return false}if($(this).scrollTop()>=95){if($("#topbar-title").text()!=b){$("#topbar-title").text(b)}}else{if($("#topbar-title").text()!=a){$("#topbar-title").text(a)}}});$("#topbar-title").click(function(){$("body,html").animate({scrollTop:0},800)})});

View File

@@ -1 +0,0 @@
$(function(){var b="l_";var a="h_";$(".collapse").on("hide.bs.collapse",function(){var c=a+$(this).attr("id").substring(b.length);if(c){$("#"+c+" .far.fa-folder-open").attr("class","far fa-folder fa-fw");$("#"+c+" i.fas").addClass("rotate");$("#"+c).removeClass("hide-border-bottom")}});$(".collapse").on("show.bs.collapse",function(){var c=a+$(this).attr("id").substring(b.length);if(c){$("#"+c+" .far.fa-folder").attr("class","far fa-folder-open fa-fw");$("#"+c+" i.fas").removeClass("rotate");$("#"+c).addClass("hide-border-bottom")}})});

View File

@@ -1,12 +0,0 @@
---
# Aggregation of common JS.
# © 2018-2019 Cotes Chung
# MIT License
---
{% include_relative _commons/back-to-top.min.js %}
{% include_relative _commons/search-display.min.js %}
{% include_relative _commons/sidebar.min.js %}
{% include_relative _commons/topbar-switch.min.js %}
{% include_relative _commons/topbar-title.min.js %}
{% include_relative _commons/copy-link.min.js %}

View File

@@ -1 +0,0 @@
function countUp(b,a,d){if(b<a){var c=new CountUp(d,b,a);if(!c.error){c.start()}else{console.error(c.error)}}}function countPV(f,e){var g=f.replace(/\/posts\//g,"").replace(/\//g,".html");var d=0;var c=f.replace(/posts\//g,"");for(var b=0;b<e.length;++b){var a=e[b][0];if(a==f||a==c||a.concat("/")==c||a.slice(a.lastIndexOf("/")+1)===g){d+=parseInt(e[b][1])}}return d}function tacklePV(e,f,d,b){var c=countPV(f,e);c=(c==0?1:c);if(!b){d.text(new Intl.NumberFormat().format(c))}else{var a=parseInt(d.text().replace(/,/g,""));if(c>a){countUp(a,c,d.attr("id"))}}}function displayPageviews(c){if(c===undefined){return}var a=getInitStatus();var b=c.rows;if($("#post-list").length>0){$(".post-preview").each(function(){var e=$(this).children("h1").children("a").attr("href");tacklePV(b,e,$(this).find(".pageviews"),a)})}else{if($(".post").length>0){var d=window.location.pathname;tacklePV(b,d,$("#pv"),a)}}}var getInitStatus=(function(){var a=false;return function(){let ret=a;if(!a){a=true}return ret}})();var PvCache=(function(){const e="pv";const b="pv-created-date";const d="pv-type";var c={ORIGIN:"origin",PROXY:"proxy"};function a(g){return localStorage.getItem(g)}function f(g,h){localStorage.setItem(g,h)}return{getData:function(){return JSON.parse(localStorage.getItem(e))},saveOriginCache:function(g){f(e,g);f(d,c.ORIGIN);f(b,new Date().toJSON())},saveProxyCache:function(g){f(e,g);f(d,c.PROXY);f(b,new Date().toJSON())},isOriginCache:function(){return a(d)==c.ORIGIN},isProxyCache:function(){return a(d)==c.PROXY},isExpired:function(){if(PvCache.isOriginCache()){let date=new Date(a(b));date.setDate(date.getDate()+1);return Date.now()>=date.getTime()}else{if(PvCache.isProxyCache()){let date=new Date(a(b));date.setHours(date.getHours()+1);return Date.now()>=date.getTime()}}return false},getAllPagevies:function(){return PvCache.getData().totalsForAllResults["ga:pageviews"]},newerThan:function(g){return PvCache.getAllPagevies()>g.totalsForAllResults["ga:pageviews"]}}})();function fetchOriginPageviews(a){if(a===undefined){return}displayPageviews(a);PvCache.saveOriginCache(JSON.stringify(a))}function fetchProxyPageviews(){let proxy=JSON.parse(proxyData);$.ajax({type:"GET",url:proxy.url,dataType:"jsonp",jsonpCallback:"displayPageviews",success:function(b,c,a){PvCache.saveProxyCache(JSON.stringify(b))},error:function(a,c,b){console.log("Failed to load pageviews from proxy server: "+b)}})}$(function(){if($(".pageviews").length>0){let cache=PvCache.getData();if(cache){if(PvCache.isExpired()){if(PvCache.isProxyCache()){let originPvData=pageviews?JSON.parse(pageviews):undefined;if(originPvData){if(PvCache.newerThan(originPvData)){displayPageviews(cache)}else{fetchOriginPageviews(originPvData)}}fetchProxyPageviews()}else{if(PvCache.isOriginCache()){fetchOriginPageviews(originPvData);fetchProxyPageviews()}}}else{displayPageviews(cache);if(PvCache.isOriginCache()){fetchProxyPageviews()}}}else{let originPvData=pageviews?JSON.parse(pageviews):undefined;fetchOriginPageviews(originPvData);fetchProxyPageviews()}}});

View File

@@ -1 +0,0 @@
$(function(){function d(h,g){var f=new Date();var o=new Date(h);var n=Math.floor((f-o)/1000);var l=Math.floor(n/31536000);if(l>=1){return l+" year"+(l>1?"s":"")+" ago"}var k=Math.floor(n/2592000);if(k>=1){return k+" month"+(k>1?"s":"")+" ago"}var e=Math.floor(n/604800);if(e>=1){return e+" week"+(e>1?"s":"")+" ago"}var m=Math.floor(n/86400);if(m>=1){return m+" day"+(m>1?"s":"")+" ago"}var j=Math.floor(n/3600);if(j>=1){return j+" hour"+(j>1?"s":"")+" ago"}var i=Math.floor(n/60);if(i>=1){return i+" minute"+(i>1?"s":"")+" ago"}return(g?"just":"Just")+" now"}function c(){$(".timeago").each(function(){if($(this).children("i").length>0){var g=$(this).hasClass("lastmod");var f=$(this).children("i");var e=f.text();$(this).text(d(e,g));$(this).append(f)}});if(a==0&&b!=undefined){clearInterval(b)}return a}var a=$(".timeago").length;if(a==0){return}if(c()>0){a=$(".timeago").length;var b=setInterval(c,60000)}});

View File

@@ -1 +0,0 @@
$(function(){if($("#post-wrapper .post-content h1").length==0&&$("#post-wrapper .post-content h2").length==0){$("#toc-wrapper").addClass("unloaded")}});

View File

@@ -1 +0,0 @@
$(function(){$('[data-toggle="tooltip"]').tooltip()});

11
assets/js/home.min.js vendored Normal file
View File

@@ -0,0 +1,11 @@
---
layout: compress
# JS for layout home.
# Chirpy v2.3
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT License
---
{% include_relative _home-post.js %}

11
assets/js/page.min.js vendored Normal file
View File

@@ -0,0 +1,11 @@
---
layout: compress
# JS for layout page by default.
# Chirpy v2.3
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT License
---
{% include_relative _commons.js %}

15
assets/js/post.min.js vendored Normal file
View File

@@ -0,0 +1,15 @@
---
layout: compress
# JS for layout post.
# Chirpy v2.3
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT License
---
{% include_relative _home-post.js %}
{% include_relative lib/_bootstrap-toc.min.js %}
{% include_relative _utils/toc-filter.js %}

File diff suppressed because one or more lines are too long

View File

@@ -2,14 +2,16 @@
🌏 [English](../README.md) • 简体中文
[![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=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)
[![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)
一个不一样的响应式设计 Jekyll 主题(内附神秘工具),采用响应式设计,方便记录、管理、分享你的知识和经验。
一个不一样的 Jekyll 主题,采用响应式设计,方便记录、管理、分享你的知识和经验。[懂的进 »](https://chirpy.cotes.info)
[![Devices Mockup](https://raw.githubusercontent.com/cotes2020/jekyll-theme-chirpy/master/assets/img/sample/devices-mockup.png)](https://chirpy.cotes.info)
> ⚠️ 中文版文档存在更新不及时的风险(开源文档以英文为主,请见谅)。如果发现中、英文内容不匹配的情况,一切以英文版内容为准。如果您愿意的话,可提交 issuse 提醒作者更新中文版 README谢谢。
## 目录
* [功能预览](#功能预览)
@@ -22,15 +24,17 @@
## 功能预览
* 自动暗夜模式
* 文章置顶
* 可配置的全局主题颜色
* 文章最后修改日期
* 文章目录
* 自动推荐相关文章
* 语法高亮
* 二级目录
* 数学表达式
* 搜索
* Atom 订阅
* Disqus 评论
* Disqus 评论
* Google 分析
* GA 浏览报告(高级功能)
* SEO 优化
@@ -41,9 +45,9 @@
### 准备工作
按照 [Jekyll 官方文档](https://jekyllrb.com/docs/installation/) 完成基础环境的安装 (RubyRubyGemBundler 和 Jekyll)。
按照 [Jekyll 官方文档](https://jekyllrb.com/docs/installation/) 完成基础环境的安装 (`Ruby``RubyGem``Bundler`)。
为了使用项目内免费提供的脚本工具提升你的写作体验,如果你的机器系统是 Debian 或者 macOS则需要确保安装了 [GNU coreutils](https://www.gnu.org/software/coreutils/)。否则,通过以下方式获得:
为了使用项目内免费提供的脚本工具增进写作体验,如果你的机器系统是 Debian 或者 macOS则需要确保安装了 [GNU coreutils](https://www.gnu.org/software/coreutils/)。否则,通过以下方式获得:
* Debian
@@ -66,7 +70,6 @@ $ git clone git@github.com:USER/jekyll-theme-chirpy.git -b master
把上述的`USER` 替换为你的 GitHub username。
### 安装 Jekyll 插件
本地首次运行或编译,请在项目根目录下运行:
@@ -121,13 +124,25 @@ jekyll-theme-chirpy/
根据个人需要去修改 `_config.yml` 的变量,大部分都有注释介绍用法。
* 头像
* `url`
示例的头像文件放置在:`/assets/img/sample/avatar.jpg`. 把它换成你自己的头像,路径不限定,越小越好。(压缩图像体积可上这个网站:*<https://tinypng.com/>* ).
定义网站 URL注意结尾不带 `/`。格式: `<protocol>://<domain>`.
* 时区
* `avatar`
定义头像,示例的文件放置在:`/assets/img/sample/avatar.jpg`. 把它换成你自己的头像,路径不限定,越小越好。(压缩图像体积可上这个网站:*<https://tinypng.com/>* ).
时区由 `timezone` 定义,默认为 `亚洲/上海`,如果肉身翻墙要换城市可在此列表找到: [TimezoneConverter](http://www.timezoneconverter.com/cgi-bin/findzone/findzone) 或者 [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
* `timezone`
定义时区 ,默认为 `亚洲/上海`,如果肉身翻墙要换城市可在此列表找到: [TimezoneConverter](http://www.timezoneconverter.com/cgi-bin/findzone/findzone) 或者 [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
* `theme_mode`
定义颜色方案,有三种可选::
- **dual** - 自动跟随系统的 `深色`/`浅色` 设置,当系统或者浏览器不支持深色模式,则默认显示为浅色模式。无论如何,侧边栏左下角都会显示一个颜色切换按钮。
- **dark** - 全程深色模式。
- **light** - 全程浅色模式。
### 本地运行
@@ -162,14 +177,21 @@ $ bash tools/run.sh
**2**. 提交本地更改,然后运行:
```console
$ bash tools/init.sh
$ bash tools/publish.sh
```
>**注**: *最后更新* 列表根据文章的 git 修改记录生成,所以运行前先把 `_posts` 目录的修改提交。
它会自动生成文章的 *最后修改日期* 和 *分类 / 标签* 页面.
它会自动生成文章的 *最后修改日期* 和 *分类 / 标签* 页面,并自动提交一个 commit 并推送到 `origin/master` 。输出日志类似如下:
**3**. 推送到 `origin/master` 然后到 GitHub 网页为该项目开启 Pages 服务。
```terminal
[INFO] Success to update lastmod for 4 post(s).
[INFO] Succeed! 3 category-pages created.
[INFO] Succeed! 4 tag-pages created.
[INFO] Published successfully!
```
**3**. 到 GitHub 网页为该项目开启 Pages 服务。
**4**. 网站将运行在:
@@ -210,22 +232,24 @@ $ bash tools/build.sh -d /path/to/local/project/
|User or Organization | `https://<username>.github.io/`|
|Project| `https://<username>.github.io/project/`|
#### 结束工作
无论你选择了哪种方式部署网站到 GitHub Pages, 请开启 `HTTPS` 功能。具体细节参考官方说明:[Securing your GitHub Pages site with HTTPS](https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https)。
### 文档
更多细节及更佳的阅读体验,请参阅 [线上教程](https://chirpy.cotes.info/categories/tutorial/)。 与此同时,[Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki) 也有一份教程的拷贝。
若想要更多细节及更佳的阅读体验,请参阅 [线上教程](https://chirpy.cotes.info/categories/tutorial/)。 与此同时,[Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki) 也有一份教程的拷贝。
## 参与贡献
三人行必有我师,欢迎提报告 bug, 帮助改进代码质量,或者提交新功能。具体操作规则请参考[此文](.github/CONTRIBUTING.md),谢谢🙏。
三人行必有我师,欢迎提报告 bug, 帮助改进代码质量,或者提交新功能。具体操作规则请参考 [贡献指南](../.github/CONTRIBUTING.md),谢谢 🙏。
## 感谢
这个主题的开发主要基于 [Jekyll](https://jekyllrb.com/) 生态、[Bootstrap](https://getbootstrap.com/)、[Font Awesome](https://fontawesome.com/) 和其他一些出色的工具 (相关文件中可以找到这些工具的版权信息).
:tada:感谢所有参与代码贡献的小伙伴, 他们的 GayHub ID 在这个[列表](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors)。 另外, 提交过 issues(或者未被合并 PR)的高富帅和白富美也不会被遗忘,他/她们帮助报告 bug、分享新点子或者启发了我写出更通俗易懂的文档。
:tada:感谢所有参与代码贡献的小伙伴, 他们的 GayHub ID 在这个[列表](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors)。 另外, 提交过 issues(或者未被合并 PR) 的高富帅和白富美也不会被遗忘,他/她们帮助报告 bug、分享新点子或者启发了我写出更通俗易懂的文档。
## 赞助

3
sw.js
View File

@@ -1,12 +1,13 @@
---
layout: compress
# Chirpy v2.2
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
---
self.importScripts('{{ "/assets/data/cache-list.js" | relative_url }}');
self.importScripts('{{ "/assets/js/data/cache-list.js" | relative_url }}');
var cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M" }}';

View File

@@ -1,6 +1,6 @@
---
title: Archives
type: archives
# The Archives of posts.
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
@@ -24,7 +24,7 @@ title: Archives
{% capture this_month %}{{ post.date | date: "%b" }}{% endcapture %}
<span class="date day">{{ this_day }}</span>
<span class="date month small text-muted">{{ this_month }}</span>
<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div>
</li>
{% if forloop.last %}

View File

@@ -1,6 +1,6 @@
---
title: Categories
type: categories
# All the Categories of posts
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
@@ -8,6 +8,11 @@ title: Categories
# MIT License
---
{% assign HEAD_PREFIX = "h_" %}
{% assign LIST_PREFIX = "l_" %}
{% assign group_index = 0 %}
{% assign sort_categories = site.categories | sort %}
{% for category in sort_categories %}
@@ -20,9 +25,11 @@ title: Categories
{% for post in posts_of_category %}
{% assign second_category = post.categories[1] %}
{% unless sub_categories contains second_category %}
{% assign sub_categories = sub_categories | push: second_category %}
{% endunless %}
{% if second_category %}
{% unless sub_categories contains second_category %}
{% assign sub_categories = sub_categories | push: second_category %}
{% endunless %}
{% endif %}
{% endfor %}
{% assign sub_categories = sub_categories | sort %}
@@ -30,7 +37,8 @@ title: Categories
<div class="card categories">
<!-- top-category -->
<div class="card-header d-flex justify-content-between hide-border-bottom" id="h_{{ category_name }}">
<div class="card-header d-flex justify-content-between hide-border-bottom"
id="{{ HEAD_PREFIX }}{{ group_index }}">
<span>
{% if sub_categories_size > 0 %}
<i class="far fa-folder-open fa-fw"></i>
@@ -38,33 +46,39 @@ title: Categories
<i class="far fa-folder fa-fw"></i>
{% endif %}
<a href="{{ site.baseurl }}/categories/{{ category_name | replace: ' ', '-' | downcase | url_encode }}/"
class="ml-1 mr-2">{{ category_name }}</a>
class="ml-1 mr-2">
{{ category_name }}
</a>
<!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %}
{{ sub_categories_size }}
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
{% endif %}
{{ top_posts_size }}
post{% if top_posts_size > 1 %}s{% endif %}
{% if sub_categories_size > 0 %}
{{ sub_categories_size }}
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
{% endif %}
{{ top_posts_size }}
post{% if top_posts_size > 1 %}s{% endif %}
</span>
</span>
<!-- arrow -->
<a href="#l_{{ category_name }}" data-toggle="collapse" aria-expanded="true" class="category-trigger hide-border-bottom">
{% if sub_categories_size > 0%}
{% if sub_categories_size > 0%}
<a href="#{{ LIST_PREFIX }}{{ group_index }}" data-toggle="collapse" aria-expanded="true"
class="category-trigger hide-border-bottom">
<i class="fas fa-fw fa-angle-down"></i>
{% else %}
<i class="fas fa-fw fa-angle-right disabled"></i>
{% endif %}
</a>
{% else %}
<span data-toggle="collapse" class="category-trigger hide-border-bottom disabled">
<i class="fas fa-fw fa-angle-right"></i>
</span>
{% endif %}
</div> <!-- .card-header -->
<!-- Sub-categories -->
{% if sub_categories_size > 0 %}
<div id="l_{{ category_name }}" class="collapse show" aria-expanded="true">
<div id="{{ LIST_PREFIX }}{{ group_index }}" class="collapse show" aria-expanded="true">
<ul class="list-group">
{% for sub_category in sub_categories %}
<li class="list-group-item">
@@ -83,7 +97,7 @@ title: Categories
</div> <!-- .card -->
{% assign group_index = group_index | plus: 1 %}
{% endif %}
{% endfor %}
<script src="{{ site.baseurl }}/assets/js/dist/category-collapse.min.js" async></script>

View File

@@ -1,6 +1,6 @@
---
title: Tags
type: tags
# All the Tags of posts.
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy

View File

@@ -1,80 +0,0 @@
#!/bin/bash
#
# A development tool that use yuicompressor to compress JS files.
#
#
# Requirement:
# - wget
# - JRE
# - yuicompressor https://github.com/yui/yuicompressor
#
#
# Usage: bash /path/to/js-compress.sh
#
# Process:
# input: /path/to/js/source.js --> output: /path/to/js/dist/source.min.js
#
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
set -eu
PROJ_HOME=$(dirname $(dirname $(realpath "$0")))
YUICOMPRESSOR_SRC=https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar
YUICOMPRESSOR=${PROJ_HOME}/tools/package/yuicompressor-2.4.8.jar
JS_ROOT=${PROJ_HOME}/assets/js/
JS_SRC=${JS_ROOT}_src # JS source files
JS_DEST=${JS_ROOT}dist # Compressed output directory
PREFIX_LEN=${#JS_ROOT} # To beautify the log
function init() {
if [[ ! -f $YUICOMPRESSOR ]]; then
if [[ ! -d "${PROJ_HOME}/tools/package/" ]]; then
mkdir -p "${PROJ_HOME}/tools/package/"
fi
wget "$YUICOMPRESSOR_SRC" -P "${PROJ_HOME}/tools/package/" -q
fi
}
function compress() {
# $1 is the source dir
# $2 is the destination dir
# $3 is the sub dir of source dir, nullable
if [[ -z ${3:+unset} ]]
then
sub_dir=""
else
sub_dir="$3/"
fi
for item in $(ls $1)
do
src="$1/$item"
if [[ -d "$src" ]]; then
compress $src $2 $item # recursion
else
if [[ -z $(git status $src -s) ]]; then
continue
fi
if [[ ! -d "$2/${sub_dir}" ]]; then
mkdir -p $2/${sub_dir}
fi
output=$2/${sub_dir}${item%.*}.min.js
echo "java -jar $(basename $YUICOMPRESSOR) ${src:$PREFIX_LEN} -o ${output:$PREFIX_LEN}"
java -jar $YUICOMPRESSOR $src -o $output
fi
done
sub_dir="" # clean up for next recursion.
}
init
compress $JS_SRC $JS_DEST

View File

@@ -1,6 +1,7 @@
#!/bin/bash
#
# Initial the Categories/Tags pages and Lastmod for posts.
# Initial the Categories/Tags pages and Lastmod for posts and then push to remote
#
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
@@ -15,19 +16,13 @@ LASTMOD=false
WORK_DIR=$(dirname $(dirname $(realpath "$0")))
check_status() {
local _watching_dirs=(
"_post"
"_data")
local _change=$(git status . -s)
for i in "${!_watching_dirs[@]}"
do
local _dir=${_watching_dirs[${i}]}
if [[ ! -z $(git status $_dir -s) ]]; then
echo "Warning: Commit the changes of the directory '$_dir' first."
git status -s | grep $_dir
exit 1
fi
done
if [[ ! -z ${_change} ]]; then
echo "Warning: Commit the changes of the changes first:"
echo "$_change"
exit 1
fi
}
@@ -72,12 +67,17 @@ commit() {
if [[ $CATEGORIES = true || $TAGS = true || $LASTMOD = true ]]; then
msg+=" for post(s)."
git commit -m "[Automation] $msg"
git commit -m "[Automation] $msg" -q
else
msg="Nothing changed."
fi
echo $msg
}
push() {
git push origin master -q
echo "[INFO] Published successfully!"
}
@@ -90,6 +90,9 @@ main() {
update_files
commit
push
}
main