mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-19 06:06:54 +00:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18bd1a91ef | ||
|
|
4dd4915bed | ||
|
|
a227ae386d | ||
|
|
32bd36f016 | ||
|
|
aa23becd14 | ||
|
|
b2f0b4cb1b | ||
|
|
209058b84a | ||
|
|
562fcd4fd8 | ||
|
|
22115f3797 | ||
|
|
9f3619e54a | ||
|
|
5b0aaa5403 | ||
|
|
733bb0fbfa | ||
|
|
0d47beba97 | ||
|
|
c0ba181246 | ||
|
|
313c44f238 | ||
|
|
46c2cfe64e | ||
|
|
cc4f18a5a2 | ||
|
|
4491c82b02 | ||
|
|
b9b8dd8cf1 | ||
|
|
9a1eab2635 | ||
|
|
30b013f354 | ||
|
|
4d4e9a063e | ||
|
|
afccb144b1 | ||
|
|
e87ef0d40e | ||
|
|
42e0617bde | ||
|
|
edeb08aa28 | ||
|
|
b0a35de9c6 | ||
|
|
b3e6fc56f7 | ||
|
|
618ae9dcbc | ||
|
|
47e5c3a917 | ||
|
|
f9706411e7 | ||
|
|
b22da94134 | ||
|
|
4476a7d755 | ||
|
|
ea4cd78921 | ||
|
|
752d0330b7 | ||
|
|
fbbd387402 | ||
|
|
bec344f6e9 | ||
|
|
ba47cc0509 | ||
|
|
34d54f9349 | ||
|
|
d1963af964 | ||
|
|
eff2a24f4c | ||
|
|
3caafbd50d | ||
|
|
cb37a1909d | ||
|
|
88eac91909 | ||
|
|
0bb9c47cf9 |
76
.github/CODE_OF_CONDUCT.md
vendored
Normal file
76
.github/CODE_OF_CONDUCT.md
vendored
Normal 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
|
||||||
16
.github/CONTRIBUTING.md
vendored
16
.github/CONTRIBUTING.md
vendored
@@ -2,15 +2,21 @@
|
|||||||
|
|
||||||
I want to thank you for sparing a time to improve this project! Here are some guidelines for contributing:
|
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 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.
|
To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a [`Feature Request`](https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md) issue to discuss whether your idea fits the project.
|
||||||
|
|
||||||
Generally, contribute to the project by:
|
Generally, contribute to the project by:
|
||||||
|
|
||||||
1. Fork this project.
|
1. Fork this project on GitHub and clone it locally.
|
||||||
2. Create a new branch `my-new-feature`(or `fix-a-bug`), then complete the development, commit and push.
|
2. Create a new branch named `feature/my-feature` (or `feature/fix-a-bug`), which branch from `develop`:
|
||||||
3. Submit a new `Pull Request`.
|
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ git checkout -b feature/<my-feature> develop
|
||||||
|
```
|
||||||
|
> Please note that the new branch name must include the prefix `feature/`.
|
||||||
|
|
||||||
|
3. After completing the development, commit and push to remote.
|
||||||
|
4. Submit a new **pull request** to the `develop` branch of upstream, i.e., `cotes2020/jekyll-theme-chirpy:develop`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
:tada:Your volunteering will make the open source world more beautiful, thanks again!:tada:
|
:tada: Your volunteering will make the open source world more beautiful, thanks again! :tada:
|
||||||
22
.github/ISSUE_TEMPLATE/bug_report.md
vendored
22
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -4,19 +4,27 @@ about: Create a report to help us improve
|
|||||||
labels: bug
|
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. -->
|
<!-- A clear and concise description of what the bug is. -->
|
||||||
|
|
||||||
**To Reproduce**
|
**To Reproduce**
|
||||||
<!--
|
|
||||||
Steps to reproduce the behavior:
|
Steps to reproduce the behavior:
|
||||||
|
|
||||||
1. Go to '...'
|
1. Go to '...'
|
||||||
2. Click on '....'
|
2. Click on '....'
|
||||||
3. Scroll down to '....'
|
3. Scroll down to '....'
|
||||||
4. See error
|
4. See error
|
||||||
-->
|
|
||||||
|
|
||||||
**Expected behavior**
|
**Expected behavior**
|
||||||
<!-- A clear and concise description of what you expected to happen. -->
|
<!-- A clear and concise description of what you expected to happen. -->
|
||||||
@@ -24,12 +32,14 @@ Steps to reproduce the behavior:
|
|||||||
**Screenshots**
|
**Screenshots**
|
||||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
<!-- 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]
|
- OS: [e.g. iOS]
|
||||||
- Browser: [e.g. chrome, safari]
|
- Browser: [e.g. chrome, safari]
|
||||||
- Version: [e.g. 22]
|
- Version: [e.g. 22]
|
||||||
|
|
||||||
**Smartphone (please complete the following information):**
|
**Smartphone**
|
||||||
|
<!-- please complete the following information -->
|
||||||
- Device: [e.g. iPhone6]
|
- Device: [e.g. iPhone6]
|
||||||
- OS: [e.g. iOS8.1]
|
- OS: [e.g. iOS8.1]
|
||||||
- Browser: [e.g. stock browser, safari]
|
- Browser: [e.g. stock browser, safari]
|
||||||
|
|||||||
19
.github/ISSUE_TEMPLATE/feature_request.md
vendored
19
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -4,18 +4,27 @@ about: Suggest an idea for this project
|
|||||||
labels: enhancement
|
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 `develop` branch of the latest code.
|
||||||
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
## Is your feature request related to a problem? Please describe
|
||||||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
|
## Describe the solution you'd like
|
||||||
<!-- A clear and concise description of what you want to happen. -->
|
<!-- A clear and concise description of what you want to happen. -->
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
|
## Describe alternatives you've considered
|
||||||
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
||||||
|
|
||||||
|
|
||||||
**Additional context**
|
## Additional context
|
||||||
<!-- Add any other context or screenshots about the feature request here. -->
|
<!-- Add any other context or screenshots about the feature request here. -->
|
||||||
|
|||||||
55
.github/ISSUE_TEMPLATE/question.md
vendored
55
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -4,54 +4,17 @@ about: Ask what ever you want
|
|||||||
labels: question
|
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
|
||||||
**Don't understand what the README or Wiki says.**
|
|
||||||
Point out the parts that are hard for you to understand.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
<!-- Please complete the following list of tasks, and then check it by change the "[ ]" to "[x]" -->
|
||||||
**Want to complain about my bad days.**
|
|
||||||
Don't hesitate to share your story!
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
- [ ] I have read the [tutorials](https://chirpy.cotes.info/categories/tutorial/) and know the correct effect of the functional design.
|
||||||
**Just wanted to say hi to the author.**
|
- [ ] There are no similar question on existing issues (including closed ones).
|
||||||
Hi, I'm ..., have a nice day !
|
- [ ] I searched the Internet for related problems, but still couldn't solve it.
|
||||||
-->
|
- [ ] My question is based on the latest code of `master` branch.
|
||||||
|
|
||||||
|
|
||||||
<!--
|
## Description
|
||||||
**Not sure if it's a bug**
|
<!-- Please describe your question. -->
|
||||||
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.
|
|
||||||
-->
|
|
||||||
45
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
45
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
## 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
e.g. 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:
|
||||||
|
* Jekyll 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
|
||||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -1,13 +1,11 @@
|
|||||||
name: 'Continuous Integration'
|
name: 'Continuous Integration'
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
|
||||||
- stable
|
|
||||||
tags-ignore:
|
tags-ignore:
|
||||||
- '*'
|
- '*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '.github/**'
|
- '.github/**'
|
||||||
- '!.github/workflows/**'
|
- '!.github/workflows/ci.yml'
|
||||||
- '.travis.yml'
|
- '.travis.yml'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
|
|||||||
13
.github/workflows/issues-cleaner.yml
vendored
13
.github/workflows/issues-cleaner.yml
vendored
@@ -13,11 +13,12 @@ jobs:
|
|||||||
uses: actions/stale@v3
|
uses: actions/stale@v3
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
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_STALE }} days'
|
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-pr-message: 'Stale pull request message'
|
stale-issue-label: 'stale'
|
||||||
stale-issue-label: 'no-activity'
|
exempt-issue-labels: 'pending, in progress'
|
||||||
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: 'no-activity'
|
stale-pr-label: 'stale'
|
||||||
exempt-pr-labels: 'pending,in-progress'
|
exempt-pr-labels: 'pending, in progress'
|
||||||
days-before-stale: ${{ env.DAYS_TO_STALE }}
|
days-before-stale: ${{ env.DAYS_TO_STALE }}
|
||||||
days-before-close: ${{ env.DAYS_TO_CLOSE }}
|
days-before-close: ${{ env.DAYS_TO_CLOSE }}
|
||||||
|
# debug-only: true
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ script:
|
|||||||
- bash _cibuild.sh
|
- bash _cibuild.sh
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only: stable
|
only: master
|
||||||
|
|
||||||
git:
|
git:
|
||||||
depth: false # for posts lastmod
|
depth: false # for posts lastmod
|
||||||
|
|||||||
49
README.md
49
README.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
🌏 English • [简体中文](docs/README_zh-CN.md)
|
🌏 English • [简体中文](docs/README_zh-CN.md)
|
||||||
|
|
||||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=event%3Apush)
|
[](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
|
||||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
|
[](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
|
||||||
[](https://996.icu)
|
[](https://996.icu)
|
||||||
|
|
||||||
@@ -22,8 +22,9 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
* Pinned Posts
|
||||||
* Configurable theme mode
|
* Configurable theme mode
|
||||||
* Two-level Categories
|
* Double-level Categories
|
||||||
* Last modified date for posts
|
* Last modified date for posts
|
||||||
* Table of Contents
|
* Table of Contents
|
||||||
* Automatically recommend related posts
|
* Automatically recommend related posts
|
||||||
@@ -46,15 +47,15 @@ To improve the writing experience, we need to use some script tools. If your mac
|
|||||||
|
|
||||||
* Debian
|
* Debian
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ sudo apt-get install coreutils
|
$ sudo apt-get install coreutils
|
||||||
```
|
```
|
||||||
|
|
||||||
* macOS
|
* macOS
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ brew install coreutils
|
$ brew install coreutils
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Jekyll Plugins
|
### Jekyll Plugins
|
||||||
@@ -65,7 +66,7 @@ $ brew install coreutils
|
|||||||
$ git clone git@github.com:USER/jekyll-theme-chirpy.git -b master
|
$ git clone git@github.com:USER/jekyll-theme-chirpy.git -b master
|
||||||
```
|
```
|
||||||
|
|
||||||
and replace the `USER` above to your GitHub username.
|
And replace the `USER` above to your GitHub username.
|
||||||
|
|
||||||
The first time you run or build the project on local machine, perform the installation of Jekyll plugins. Go to the root of repo and run:
|
The first time you run or build the project on local machine, perform the installation of Jekyll plugins. Go to the root of repo and run:
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ $ bundle install
|
|||||||
|
|
||||||
### Directory Structure
|
### Directory Structure
|
||||||
|
|
||||||
The main files and related brief introductions are listed below.
|
The main files and related brief introductions are listed below:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
jekyll-theme-chirpy/
|
jekyll-theme-chirpy/
|
||||||
@@ -112,8 +113,9 @@ jekyll-theme-chirpy/
|
|||||||
|
|
||||||
As mentioned above, some files or directories should be removed from your repo:
|
As mentioned above, some files or directories should be removed from your repo:
|
||||||
|
|
||||||
- .travis.yml
|
```terminal
|
||||||
- .github
|
$ rm -rf .travis.yml .github _posts/*
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
@@ -163,7 +165,7 @@ Before the deployment begins, checkout the file `_config.yml` and make sure that
|
|||||||
|
|
||||||
By deploying the site in this way, you're allowed to push the source code directly to the remote.
|
By deploying the site in this way, you're allowed to push the source code directly to the remote.
|
||||||
|
|
||||||
> **Note**: If you want to use any third-party Jekyll plugins that not in [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally).
|
> **Note**: If you want to use any third-party Jekyll plugins that not on [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally).
|
||||||
|
|
||||||
**1**. Rename the repository to:
|
**1**. Rename the repository to:
|
||||||
|
|
||||||
@@ -172,27 +174,24 @@ By deploying the site in this way, you're allowed to push the source code direct
|
|||||||
|User or Organization | `<username>.github.io`|
|
|User or Organization | `<username>.github.io`|
|
||||||
|Project| Any one except `<username>.github.io`, let's say `project`|
|
|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
|
```console
|
||||||
$ bash tools/init.sh
|
$ 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
|
```terminal
|
||||||
[INFO] Success to update lastmod for 4 post(s).
|
[INFO] Success to update lastmod for 4 post(s).
|
||||||
[INFO] Succeed! 3 category-pages created.
|
[INFO] Succeed! 3 category-pages created.
|
||||||
[INFO] Succeed! 4 tag-pages created.
|
[INFO] Succeed! 4 tag-pages created.
|
||||||
[Automation] Updated the Categories, Tags, Lastmod for post(s).
|
[INFO] Published successfully!
|
||||||
11 files changed, 46 insertions(+), 3 deletions(-)
|
|
||||||
...
|
|
||||||
Updated the Categories, Tags, Lastmod for post(s).
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**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:
|
**4**. Check it out:
|
||||||
|
|
||||||
@@ -204,7 +203,7 @@ Updated the Categories, Tags, Lastmod for post(s).
|
|||||||
|
|
||||||
#### Option 2: Build Locally
|
#### Option 2: Build Locally
|
||||||
|
|
||||||
For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any another plugins that not in the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**.
|
For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any other plugin that not on the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**.
|
||||||
|
|
||||||
**1**. Browse to GitHub website, create a brand new repo named:
|
**1**. Browse to GitHub website, create a brand new repo named:
|
||||||
|
|
||||||
@@ -234,7 +233,7 @@ The generated static files will be placed in the root of `/path/to/local/project
|
|||||||
|
|
||||||
#### Finishing work
|
#### 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
|
### Documentation
|
||||||
|
|||||||
13
_config.yml
13
_config.yml
@@ -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: ''
|
baseurl: ''
|
||||||
|
|
||||||
# Change to your timezone › http://www.timezoneconverter.com/cgi-bin/findzone/findzone
|
# Change to your timezone › http://www.timezoneconverter.com/cgi-bin/findzone/findzone
|
||||||
timezone: Asia/Shanghai
|
timezone: Asia/Shanghai
|
||||||
|
|
||||||
google_analytics:
|
google_analytics:
|
||||||
# Fill with your Google Analytics ID
|
id: '' # Fill with your Google Analytics ID
|
||||||
id: ''
|
|
||||||
# The Google Analytics pageviews switch.
|
|
||||||
|
|
||||||
pv:
|
pv:
|
||||||
|
# The Google Analytics pageviews switch.
|
||||||
# DO NOT enable it unless you know how to deploy the Google Analytics superProxy.
|
# DO NOT enable it unless you know how to deploy the Google Analytics superProxy.
|
||||||
enabled: false
|
enabled: false
|
||||||
# the next options only valid when `google_analytics.pv` is enabled.
|
# the next options only valid when `google_analytics.pv` is enabled.
|
||||||
@@ -101,6 +101,8 @@ kramdown:
|
|||||||
line_numbers: true
|
line_numbers: true
|
||||||
start_line: 1
|
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/
|
permalink: /posts/:title/
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
@@ -182,6 +184,7 @@ exclude:
|
|||||||
- tools
|
- tools
|
||||||
- docs
|
- docs
|
||||||
- README.md
|
- README.md
|
||||||
|
- LICENSE
|
||||||
|
|
||||||
sitemap_exclude: # Sitemap will exclude the following items.
|
sitemap_exclude: # Sitemap will exclude the following items.
|
||||||
fuzzy:
|
fuzzy:
|
||||||
|
|||||||
@@ -19,10 +19,13 @@
|
|||||||
icon: 'fas fa-rss'
|
icon: 'fas fa-rss'
|
||||||
noblank: true
|
noblank: true
|
||||||
|
|
||||||
# Complete the url below to enable more contact options
|
# Uncomment and complete the url below to enable more contact options
|
||||||
-
|
# -
|
||||||
icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
|
# icon: 'fab fa-mastodon' # icons powered by <https://fontawesome.com/>
|
||||||
url: '' # Fill with your Linkedin homepage
|
# url: '' # Fill with your mastodon account page
|
||||||
-
|
# -
|
||||||
icon: 'fab fa-stack-overflow'
|
# icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
|
||||||
url: '' # Fill with your stackoverflow homepage
|
# url: '' # Fill with your Linkedin homepage
|
||||||
|
# -
|
||||||
|
# icon: 'fab fa-stack-overflow'
|
||||||
|
# url: '' # Fill with your stackoverflow homepage
|
||||||
|
|||||||
@@ -6,4 +6,6 @@
|
|||||||
|
|
||||||
|
|
||||||
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
|
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
|
||||||
post: "%b %e, %Y"
|
post:
|
||||||
|
long: "%b %e, %Y"
|
||||||
|
short: "%b %e"
|
||||||
|
|||||||
@@ -12,17 +12,17 @@
|
|||||||
|
|
||||||
{% elsif page.layout == 'page' %}
|
{% elsif page.layout == 'page' %}
|
||||||
|
|
||||||
{% if page.title == 'Categories' %}
|
{% if page.type == 'categories' %}
|
||||||
|
|
||||||
<link rel="preload" href="{{ '/assets/css/categories.css' | relative_url }}" as="style">
|
<link rel="preload" href="{{ '/assets/css/categories.css' | relative_url }}" as="style">
|
||||||
<link rel="stylesheet" href="{{ '/assets/css/categories.css' | relative_url }}">
|
<link rel="stylesheet" href="{{ '/assets/css/categories.css' | relative_url }}">
|
||||||
|
|
||||||
{% elsif page.title == 'Tags' %}
|
{% elsif page.type == 'tags' %}
|
||||||
|
|
||||||
<link rel="preload" href="{{ '/assets/css/tags.css' | relative_url }}" as="style">
|
<link rel="preload" href="{{ '/assets/css/tags.css' | relative_url }}" as="style">
|
||||||
<link rel="stylesheet" href="{{ '/assets/css/tags.css' | relative_url }}">
|
<link rel="stylesheet" href="{{ '/assets/css/tags.css' | relative_url }}">
|
||||||
|
|
||||||
{% elsif page.title == 'Archives' %}
|
{% elsif page.type == 'archives' %}
|
||||||
|
|
||||||
<link rel="preload" href="{{ '/assets/css/archives.css' | relative_url }}" as="style">
|
<link rel="preload" href="{{ '/assets/css/archives.css' | relative_url }}" as="style">
|
||||||
<link rel="stylesheet" href="{{ '/assets/css/archives.css' | relative_url }}">
|
<link rel="stylesheet" href="{{ '/assets/css/archives.css' | relative_url }}">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<div id="disqus" class="pt-2 pb-4">
|
<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>
|
</div>
|
||||||
|
|
||||||
<script src="{{ site.baseurl }}/assets/js/lib/jquery.disqusloader.min.js"></script>
|
<script src="{{ site.baseurl }}/assets/js/lib/jquery.disqusloader.min.js"></script>
|
||||||
|
|||||||
@@ -3,7 +3,10 @@
|
|||||||
https://github.com/penibelst/jekyll-compress-html/issues/101
|
https://github.com/penibelst/jekyll-compress-html/issues/101
|
||||||
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
|
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
|
||||||
-->
|
-->
|
||||||
{% if _content contains '<pre class="highlight">' %}
|
{% if include.content contains '<pre class="highlight">' %}
|
||||||
{% assign _content = _content | replace: '<pre class="highlight"><code', '<code' %}
|
{% assign content = include.content | replace: '<pre class="highlight"><code', '<code' %}
|
||||||
{% assign _content = _content | replace: '</code></pre>', '</code>' %}
|
{% assign content = content | replace: '</code></pre>', '</code>' %}
|
||||||
{% endif %}
|
{{ content }}
|
||||||
|
{% else %}
|
||||||
|
{{ include.content }}
|
||||||
|
{% endif %}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
{% elsif page.layout == 'page' %}
|
{% elsif page.layout == 'page' %}
|
||||||
|
|
||||||
{% if page.title == 'Categories' %}
|
{% if page.type == 'categories' %}
|
||||||
<script src="{{ '/assets/js/categories.min.js' | relative_url }}" async></script>
|
<script src="{{ '/assets/js/categories.min.js' | relative_url }}" async></script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
|
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
{% comment %}
|
{% comment %}
|
||||||
Remove line numbers from code snippets.
|
Remove the line number of the code snippet.
|
||||||
v2.2
|
v2.2
|
||||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||||
© 2020 Cotes Chung
|
© 2020 Cotes Chung
|
||||||
Published under the MIT License
|
Published under the MIT License
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% if _content contains '<td class="rouge-gutter gl"><pre class="lineno">' %}
|
{% assign content = include.content %}
|
||||||
{% assign _content = _content | replace: '<td class="rouge-gutter gl"><pre class="lineno">', '<!-- <td class="rouge-gutter gl"><pre class="lineno">'%}
|
|
||||||
{% assign _content = _content | replace: '</td><td class="rouge-code">', '</td> --><td class="rouge-code">' %}
|
{% if content contains '<td class="rouge-gutter gl"><pre class="lineno">' %}
|
||||||
|
{% assign content = content | replace: '<td class="rouge-gutter gl"><pre class="lineno">', '<!-- <td class="rouge-gutter gl"><pre class="lineno">'%}
|
||||||
|
{% assign content = content | replace: '</td><td class="rouge-code">', '</td> --><td class="rouge-code">' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
{% if site.data.updates %}
|
{% if site.data.updates %}
|
||||||
|
|
||||||
{% include update_list.html %}
|
{% include update-list.html %}
|
||||||
|
|
||||||
{% if update_list.size > 0 %}
|
{% if update_list.size > 0 %}
|
||||||
|
|
||||||
@@ -23,17 +23,12 @@
|
|||||||
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
|
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
|
||||||
|
|
||||||
{% for item in update_list %}
|
{% for item in update_list %}
|
||||||
{% assign post_url = item | split: "::" | last | prepend: "/posts/" | append: "/" %}
|
{% assign post_url = item | split: "::" | last | url_encode | prepend: "/posts/" | append: "/" %}
|
||||||
{% assign post = site.posts | where: "url", post_url | first %}
|
{% assign post = site.posts | where: "url", post_url | first %}
|
||||||
|
|
||||||
{% if post %}
|
{% if post %}
|
||||||
{% assign url = post.url | relative_url %}
|
{% assign url = post.url | relative_url %}
|
||||||
|
|
||||||
<li><a href="{{ url }}">{{ post.title }}</a></li>
|
<li><a href="{{ url }}">{{ post.title }}</a></li>
|
||||||
|
|
||||||
{% assign sum = sum | plus: 1 %}
|
|
||||||
{% if sum >= MAX_SIZE %} {% break %} {% endif %}
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -45,7 +40,7 @@
|
|||||||
|
|
||||||
{% endif %} <!-- site.data.updates -->
|
{% endif %} <!-- site.data.updates -->
|
||||||
|
|
||||||
{% include trending_tags.html %}
|
{% include trending-tags.html %}
|
||||||
|
|
||||||
{% if trending_tags.size > 0 %}
|
{% if trending_tags.size > 0 %}
|
||||||
<div id="access-tags">
|
<div id="access-tags">
|
||||||
@@ -57,16 +52,15 @@
|
|||||||
{% for tag in trending_tags %}
|
{% for tag in trending_tags %}
|
||||||
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
||||||
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
|
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div> <!-- .access -->
|
</div> <!-- .access -->
|
||||||
|
|
||||||
{% if page.layout == 'post' and site.toc and page.toc %}
|
{% if page.layout == 'post' and site.toc and page.toc %}
|
||||||
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
<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 -}}
|
{{- site.data.label.panel.toc -}}
|
||||||
</h3>
|
</h3>
|
||||||
<nav id="toc" data-toggle="toc"></nav>
|
<nav id="toc" data-toggle="toc"></nav>
|
||||||
|
|||||||
@@ -1,75 +1,110 @@
|
|||||||
<!--
|
<!--
|
||||||
The related posts of current post.
|
Recommend the other 3 posts according to the tags and categories of the current post,
|
||||||
Placed in the bottom of every single post.
|
if the number is not enough, use the other latest posts to supplement.
|
||||||
|
|
||||||
v2.0
|
v2.0
|
||||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||||
© 2019 Cotes Chung
|
© 2019 Cotes Chung
|
||||||
Published under the MIT License
|
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 %}
|
{% assign TAG_SCORE = 1 %}
|
||||||
|
|
||||||
|
<!-- Equals to TAG_SCORE / {max_categories_hierarchy} -->
|
||||||
{% assign CATEGORY_SCORE = 0.5 %}
|
{% assign CATEGORY_SCORE = 0.5 %}
|
||||||
|
|
||||||
|
{% assign SEPARATOR = ":" %}
|
||||||
|
|
||||||
{% assign score_list = "" | split: "" %}
|
{% assign score_list = "" | split: "" %}
|
||||||
{% assign post_index = 0 %}
|
{% assign last_index = site.posts.size | minus: 1 %}
|
||||||
|
|
||||||
{% for post in site.posts %}
|
{% for i in (0..last_index) %}
|
||||||
{% if post.url != page.url %}
|
{% assign post = site.posts[i] %}
|
||||||
{% 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 %}
|
|
||||||
|
|
||||||
|
{% if post.url == page.url %}
|
||||||
|
{% continue %}
|
||||||
{% endif %}
|
{% 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 %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
{% assign index_list = "" | split: "" %}
|
||||||
|
|
||||||
{% if score_list.size > 0 %}
|
{% if score_list.size > 0 %}
|
||||||
{% assign score_list = score_list | sort | reverse %}
|
{% 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">
|
<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>
|
<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">
|
<div class="card-deck mb-4">
|
||||||
{% for score_item in score_list %}
|
{% for entry in index_list %}
|
||||||
{% assign data = score_item | split: ":" %}
|
{% assign index = entry | plus: 0 %}
|
||||||
{% assign index = data[1] | plus: 0 %}
|
|
||||||
{% assign post = site.posts[index] %}
|
{% assign post = site.posts[index] %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<a href="{{ post.url | relative_url }}">
|
<a href="{{ post.url | relative_url }}">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<span class="timeago small">
|
{% include timeago.html date=post.date class="small" %}
|
||||||
{{ post.date | date: site.data.date_format.post }}
|
|
||||||
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
|
|
||||||
</span>
|
|
||||||
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
|
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
|
||||||
<div class="text-muted small">
|
<div class="text-muted small">
|
||||||
{% assign content = post.content %}
|
<p>
|
||||||
{% include no-linenos.html %}
|
{% include no-linenos.html content=post.content %}
|
||||||
<p>{{ content | markdownify | strip_html | truncate: 200 | replace: '&', '&' }}</p>
|
{{ content | markdownify | strip_html | truncate: 200 }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% assign count = count | plus: 1 %}
|
|
||||||
{% if count >= MAX_SIZE %}
|
|
||||||
{% break %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div> <!-- .card-deck -->
|
</div> <!-- .card-deck -->
|
||||||
</div>
|
</div> <!-- #related-posts -->
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -9,11 +9,14 @@
|
|||||||
<div class="col-12 col-xl-11 post-content">
|
<div class="col-12 col-xl-11 post-content">
|
||||||
<div id="search-hints">
|
<div id="search-hints">
|
||||||
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags }}</h4>
|
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags }}</h4>
|
||||||
{% include trending_tags.html %}
|
|
||||||
|
{% include trending-tags.html %}
|
||||||
|
|
||||||
{% for tag in trending_tags %}
|
{% for tag in trending_tags %}
|
||||||
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
||||||
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
|
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
|
<div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
{% if start == '/' %}
|
{% if start == '/' %}
|
||||||
{% assign avatar_url = avatar_url | prepend: site.baseurl %}
|
{% assign avatar_url = avatar_url | prepend: site.baseurl %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<img src="{{ avatar_url }}" alt="avatar">
|
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
or item.name == page.tab_active
|
or item.name == page.tab_active
|
||||||
or item.name == "Home" and page.layout == "home" %}active{% endif %}">
|
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">
|
<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>
|
<span>{{ item.name | upcase }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li> <!-- .nav-item -->
|
</li> <!-- .nav-item -->
|
||||||
|
|||||||
27
_includes/timeago.html
Normal file
27
_includes/timeago.html
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
Date format snippet
|
||||||
|
|
||||||
|
v2.4.1
|
||||||
|
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||||
|
© 2020 Cotes Chung
|
||||||
|
MIT License
|
||||||
|
-->
|
||||||
|
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
|
||||||
|
{% if include.tooltip %}
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="{{ include.date | date: site.data.date_format.tooltip }}"
|
||||||
|
{% endif %}>
|
||||||
|
|
||||||
|
{% assign this_year = site.time | date: "%Y" %}
|
||||||
|
{% assign post_year = include.date | date: "%Y" %}
|
||||||
|
|
||||||
|
{% if post_year == this_year %}
|
||||||
|
{{ include.date | date: site.data.date_format.post.short }}
|
||||||
|
{% else %}
|
||||||
|
{{ include.date | date: site.data.date_format.post.long }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
|
||||||
|
|
||||||
|
</span>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{% comment %}
|
{% comment %}
|
||||||
Get the last 5 post from lastmod list.
|
Get the last 5 posts from lastmod list.
|
||||||
v2.2
|
v2.2
|
||||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||||
© 2020 Cotes Chung
|
© 2020 Cotes Chung
|
||||||
@@ -7,15 +7,20 @@
|
|||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% assign MAX_SIZE = 5 %}
|
{% assign MAX_SIZE = 5 %}
|
||||||
{% assign sum = 0 %}
|
|
||||||
{% assign update_list = "" | split: "" %}
|
{% assign all_list = "" | split: "" %}
|
||||||
|
|
||||||
{% for entry in site.data.updates %}
|
{% for entry in site.data.updates %}
|
||||||
{% capture elem %}
|
{% capture elem %}
|
||||||
{{- entry.lastmod -}}::{{- entry.filename -}}
|
{{- entry.lastmod -}}::{{- entry.filename -}}
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
{% assign all_list = all_list | push: elem %}
|
||||||
{% assign update_list = update_list | push: elem %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% assign update_list = update_list | sort | reverse %}
|
{% assign all_list = all_list | sort | reverse %}
|
||||||
|
|
||||||
|
{% assign update_list = "" | split: "" %}
|
||||||
|
|
||||||
|
{% for entry in all_list limit:MAX_SIZE %}
|
||||||
|
{% assign update_list = update_list | push: entry %}
|
||||||
|
{% endfor %}
|
||||||
@@ -18,7 +18,7 @@ layout: page
|
|||||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||||
<span class="dash flex-grow-1"></span>
|
<span class="dash flex-grow-1"></span>
|
||||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
|
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -36,15 +36,12 @@ layout: compress
|
|||||||
<div id="main-wrapper">
|
<div id="main-wrapper">
|
||||||
<div id="main">
|
<div id="main">
|
||||||
|
|
||||||
{% capture _content %}
|
{% include fixlinenos.html content=content %}
|
||||||
{{ content }}
|
|
||||||
{% endcapture %}
|
|
||||||
|
|
||||||
{% include fixlinenos.html %}
|
|
||||||
{{ _content }}
|
|
||||||
|
|
||||||
{% include footer.html %}
|
{% include footer.html %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% include search-results.html %}
|
{% include search-results.html %}
|
||||||
|
|
||||||
</div> <!-- #main-wrapper -->
|
</div> <!-- #main-wrapper -->
|
||||||
|
|||||||
@@ -7,28 +7,67 @@ layout: page
|
|||||||
# MIT Licensed
|
# 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">
|
<div id="post-list">
|
||||||
{% for post in paginator.posts %}
|
|
||||||
|
{% for post in posts %}
|
||||||
|
|
||||||
<div class="post-preview">
|
<div class="post-preview">
|
||||||
<h1>
|
<div class="d-flex justify-content-between pr-xl-2">
|
||||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
<h1><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h1>
|
||||||
</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">
|
<div class="post-content">
|
||||||
<p>
|
<p>
|
||||||
{% assign _content = post.content %}
|
{% include no-linenos.html content=post.content %}
|
||||||
{% include no-linenos.html %}
|
{{ content | markdownify | strip_html | truncate: 200 }}
|
||||||
{{ _content | markdownify | strip_html | truncate: 200 }}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="post-meta text-muted">
|
<div class="post-meta text-muted">
|
||||||
<!-- posted date -->
|
<!-- posted date -->
|
||||||
<i class="far fa-clock fa-fw"></i>
|
<i class="far fa-clock fa-fw"></i>
|
||||||
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
|
{% include timeago.html date=post.date tooltip=true %}
|
||||||
title="{{ post.date | date: site.data.date_format.tooltip }}">
|
|
||||||
{{ post.date | date: site.data.date_format.post }}
|
|
||||||
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
|
|
||||||
</span>
|
|
||||||
<!-- page views -->
|
<!-- page views -->
|
||||||
{% if site.google_analytics.pv.enabled %}
|
{% if site.google_analytics.pv.enabled %}
|
||||||
<i class="far fa-eye fa-fw"></i>
|
<i class="far fa-eye fa-fw"></i>
|
||||||
@@ -38,7 +77,9 @@ layout: page
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- .post-review -->
|
</div> <!-- .post-review -->
|
||||||
{% endfor %}
|
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
</div> <!-- #post-list -->
|
</div> <!-- #post-list -->
|
||||||
|
|
||||||
{% if paginator.total_pages > 0 %}
|
{% if paginator.total_pages > 0 %}
|
||||||
|
|||||||
@@ -19,16 +19,12 @@ layout: default
|
|||||||
<!-- Published date and author -->
|
<!-- Published date and author -->
|
||||||
<div>
|
<div>
|
||||||
Posted
|
Posted
|
||||||
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
|
{% include timeago.html date=page.date tooltip=true %}
|
||||||
title="{{ page.date | date: site.data.date_format.tooltip }}">
|
|
||||||
{{ page.date | date: site.data.date_format.post }}
|
|
||||||
<i class="unloaded">{{ page.date | date_to_xmlschema }}</i>
|
|
||||||
</span>
|
|
||||||
by
|
by
|
||||||
<span class="author">
|
<span class="author">
|
||||||
{% if page.author %}
|
{% if page.author %}
|
||||||
{{ page.author }}
|
{{ page.author }}
|
||||||
{% else%}
|
{% else %}
|
||||||
{{ site.author }}
|
{{ site.author }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
@@ -39,17 +35,18 @@ layout: default
|
|||||||
{{ page.url | split: "/" | last }}
|
{{ page.url | split: "/" | last }}
|
||||||
{%- endcapture -%}
|
{%- endcapture -%}
|
||||||
|
|
||||||
{% assign record = site.data.updates | where: "filename", filename | first %}
|
{% for item in site.data.updates %}
|
||||||
|
{% assign encode_filename = item.filename | url_encode %}
|
||||||
|
{% if filename == encode_filename %}
|
||||||
|
{% assign lastmod = item.lastmod %}
|
||||||
|
{% break %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% if record %}
|
{% if lastmod %}
|
||||||
<div>
|
<div>
|
||||||
Updated
|
Updated
|
||||||
<span class="timeago lastmod"
|
{% include timeago.html date=lastmod class="lastmod" tooltip=true %}
|
||||||
data-toggle="tooltip" data-placement="bottom"
|
|
||||||
title="{{ record.lastmod | date: site.data.date_format.tooltip }}">
|
|
||||||
{{ record.lastmod | date: site.data.date_format.post }}
|
|
||||||
<i class="unloaded">{{ record.lastmod | date_to_xmlschema}}</i>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ layout: page
|
|||||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||||
<span class="dash flex-grow-1"></span>
|
<span class="dash flex-grow-1"></span>
|
||||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
|
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -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
|
## 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.sh` 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.
|
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.
|
||||||
|
|
||||||
@@ -124,6 +124,17 @@ 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
|
## Code Block
|
||||||
|
|
||||||
Markdown symbols <code class="highlighter-rouge">```</code> can easily create a code block as following examples.
|
Markdown symbols <code class="highlighter-rouge">```</code> can easily create a code block as following examples.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ author: Cotes Chung
|
|||||||
date: 2019-08-09 20:55:00 +0800
|
date: 2019-08-09 20:55:00 +0800
|
||||||
categories: [Blogging, Tutorial]
|
categories: [Blogging, Tutorial]
|
||||||
tags: [getting started]
|
tags: [getting started]
|
||||||
|
pin: true
|
||||||
---
|
---
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
@@ -14,15 +15,15 @@ To improve the writing experience, we need to use some script tools. If your mac
|
|||||||
|
|
||||||
* Debian
|
* Debian
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ sudo apt-get install coreutils
|
$ sudo apt-get install coreutils
|
||||||
```
|
```
|
||||||
|
|
||||||
* macOS
|
* macOS
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ brew install coreutils
|
$ brew install coreutils
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Jekyll Plugins
|
## Jekyll Plugins
|
||||||
@@ -33,7 +34,7 @@ $ brew install coreutils
|
|||||||
$ git clone git@github.com:USER/jekyll-theme-chirpy.git -b master
|
$ git clone git@github.com:USER/jekyll-theme-chirpy.git -b master
|
||||||
```
|
```
|
||||||
|
|
||||||
and replace the `USER` above to your GitHub username.
|
And replace the `USER` above to your GitHub username.
|
||||||
|
|
||||||
The first time you run or build the project on local machine, perform the installation of Jekyll plugins. Go to the root of repo and run:
|
The first time you run or build the project on local machine, perform the installation of Jekyll plugins. Go to the root of repo and run:
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ $ bundle install
|
|||||||
|
|
||||||
## Directory Structure
|
## Directory Structure
|
||||||
|
|
||||||
The main files and related brief introductions are listed below.
|
The main files and related brief introductions are listed below:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
jekyll-theme-chirpy/
|
jekyll-theme-chirpy/
|
||||||
@@ -76,9 +77,9 @@ jekyll-theme-chirpy/
|
|||||||
|
|
||||||
As mentioned above, some files or directories should be removed from your repo:
|
As mentioned above, some files or directories should be removed from your repo:
|
||||||
|
|
||||||
- .travis.yml
|
```terminal
|
||||||
- .github
|
$ rm -rf .travis.yml .github _posts/*
|
||||||
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ Before the deployment begins, checkout the file `_config.yml` and make sure that
|
|||||||
|
|
||||||
By deploying the site in this way, you're allowed to push the source code directly to the remote.
|
By deploying the site in this way, you're allowed to push the source code directly to the remote.
|
||||||
|
|
||||||
> **Note**: If you want to use any third-party Jekyll plugins that not in [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally).
|
> **Note**: If you want to use any third-party Jekyll plugins that not on [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally).
|
||||||
|
|
||||||
**1**. Rename the repository to:
|
**1**. Rename the repository to:
|
||||||
|
|
||||||
@@ -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`|
|
|User or Organization | `<username>.github.io`|
|
||||||
|Project| Any one except `<username>.github.io`, let's say `project`|
|
|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
|
```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.
|
> 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
|
```terminal
|
||||||
[INFO] Success to update lastmod for 4 post(s).
|
[INFO] Success to update lastmod for 4 post(s).
|
||||||
[INFO] Succeed! 3 category-pages created.
|
[INFO] Succeed! 3 category-pages created.
|
||||||
[INFO] Succeed! 4 tag-pages created.
|
[INFO] Succeed! 4 tag-pages created.
|
||||||
[Automation] Updated the Categories, Tags, Lastmod for post(s).
|
[INFO] Published successfully!
|
||||||
11 files changed, 46 insertions(+), 3 deletions(-)
|
|
||||||
...
|
|
||||||
Updated the Categories, Tags, Lastmod for post(s).
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**3**. Go to GitHub website and enable GitHub Pages service for the repo.
|
||||||
**3**. Push the changes to `origin/master` then go to GitHub website and enable GitHub Pages service for the repo.
|
|
||||||
|
|
||||||
**4**. Check it out:
|
**4**. Check it out:
|
||||||
|
|
||||||
@@ -170,7 +167,7 @@ Updated the Categories, Tags, Lastmod for post(s).
|
|||||||
|
|
||||||
### Option 2: Build Locally
|
### Option 2: Build Locally
|
||||||
|
|
||||||
For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any another plugins that not in the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**.
|
For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any other plugin that not on the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**.
|
||||||
|
|
||||||
**1**. Browse to GitHub website, create a brand new repo named:
|
**1**. Browse to GitHub website, create a brand new repo named:
|
||||||
|
|
||||||
@@ -200,4 +197,4 @@ The generated static files will be placed in the root of `/path/to/local/project
|
|||||||
|
|
||||||
### Finishing work
|
### 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).
|
||||||
|
|||||||
@@ -31,20 +31,21 @@ read_categories() {
|
|||||||
local _category=$(echo "$_yaml" | grep "^category:")
|
local _category=$(echo "$_yaml" | grep "^category:")
|
||||||
|
|
||||||
if [[ ! -z "$_categories" ]]; then
|
if [[ ! -z "$_categories" ]]; then
|
||||||
echo "$_categories" | sed "s/categories: *//;s/\[//;s/\]//;s/, */,/g;s/\"//g;s/'//g"
|
echo "$_categories" | sed "s/categories: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
|
||||||
elif [[ ! -z "_category" ]]; then
|
elif [[ ! -z "_category" ]]; then
|
||||||
echo "$_category" | sed "s/category: *//;s/\[//;s/\]//;s/, */,/g;s/\"//g;s/'//g"
|
echo "$_category" | sed "s/category: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
read_tags() {
|
read_tags() {
|
||||||
local _yaml=$(_read_yaml $1)
|
local _yaml=$(_read_yaml $1)
|
||||||
echo "$_yaml" | grep "^tags:" | sed "s/tags: *//;s/\[//;s/\]//;s/, */,/g;s/\"//g;s/'//g"
|
echo "$_yaml" | grep "^tags:" | sed "s/tags: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
||||||
if [[ -d categories ]]; then
|
if [[ -d categories ]]; then
|
||||||
rm -rf categories
|
rm -rf categories
|
||||||
fi
|
fi
|
||||||
@@ -53,39 +54,47 @@ init() {
|
|||||||
rm -rf tags
|
rm -rf tags
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d _posts ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir categories tags
|
mkdir categories tags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
create_category() {
|
create_category() {
|
||||||
local _name=$1
|
if [[ ! -z $1 ]]; then
|
||||||
local _filepath="categories/$(echo $_name | sed 's/ /-/g' | awk '{print tolower($0)}').html"
|
local _name=$1
|
||||||
|
local _filepath="categories/$(echo $_name | sed 's/ /-/g' | awk '{print tolower($0)}').html"
|
||||||
|
|
||||||
if [[ ! -f $_filepath ]]; then
|
if [[ ! -f $_filepath ]]; then
|
||||||
echo "---" > $_filepath
|
echo "---" > $_filepath
|
||||||
echo "layout: category" >> $_filepath
|
echo "layout: category" >> $_filepath
|
||||||
echo "title: $_name" >> $_filepath
|
echo "title: $_name" >> $_filepath
|
||||||
echo "category: $_name" >> $_filepath
|
echo "category: $_name" >> $_filepath
|
||||||
echo "---" >> $_filepath
|
echo "---" >> $_filepath
|
||||||
|
|
||||||
((category_count=category_count+1))
|
((category_count=category_count+1))
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
create_tag() {
|
create_tag() {
|
||||||
local _name=$1
|
if [[ ! -z $1 ]]; then
|
||||||
local _filepath="tags/$( echo $_name | sed "s/ /-/g;s/'//g" | awk '{print tolower($0)}' ).html"
|
local _name=$1
|
||||||
|
local _filepath="tags/$( echo $_name | sed "s/ /-/g;s/'//g" | awk '{print tolower($0)}' ).html"
|
||||||
|
|
||||||
if [[ ! -f $_filepath ]]; then
|
if [[ ! -f $_filepath ]]; then
|
||||||
|
|
||||||
echo "---" > $_filepath
|
echo "---" > $_filepath
|
||||||
echo "layout: tag" >> $_filepath
|
echo "layout: tag" >> $_filepath
|
||||||
echo "title: $_name" >> $_filepath
|
echo "title: $_name" >> $_filepath
|
||||||
echo "tag: $_name" >> $_filepath
|
echo "tag: $_name" >> $_filepath
|
||||||
echo "---" >> $_filepath
|
echo "---" >> $_filepath
|
||||||
|
|
||||||
((tag_count=tag_count+1))
|
((tag_count=tag_count+1))
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,46 +106,45 @@ create_tag() {
|
|||||||
# $2 - type specified option
|
# $2 - type specified option
|
||||||
#########################################
|
#########################################
|
||||||
create_pages() {
|
create_pages() {
|
||||||
if [[ $1 == '' ]]; then
|
if [[ ! -z $1 ]]; then
|
||||||
exit 0
|
# split string to array
|
||||||
|
IFS_BAK=$IFS
|
||||||
|
IFS=','
|
||||||
|
local _string=$1
|
||||||
|
|
||||||
|
case $2 in
|
||||||
|
|
||||||
|
$TYPE_CATEGORY)
|
||||||
|
for i in ${_string#,}; do
|
||||||
|
create_category $i
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
|
$TYPE_TAG)
|
||||||
|
for i in ${_string#,}; do
|
||||||
|
create_tag $i
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
IFS=$IFS_BAK
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# split string to array
|
}
|
||||||
IFS_BAK=$IFS
|
|
||||||
IFS=','
|
|
||||||
local _string=$1
|
|
||||||
|
|
||||||
case $2 in
|
|
||||||
|
|
||||||
$TYPE_CATEGORY)
|
|
||||||
for i in ${_string#,}; do
|
|
||||||
create_category $i
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
|
|
||||||
$TYPE_TAG)
|
|
||||||
for i in ${_string#,}; do
|
|
||||||
create_tag $i
|
|
||||||
done
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
IFS=$IFS_BAK
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
init
|
init
|
||||||
|
|
||||||
for _file in $(ls "_posts")
|
for _file in $(find "_posts" -type f \( -iname \*.md -o -iname \*.markdown \))
|
||||||
do
|
do
|
||||||
local _path="_posts/$_file"
|
local _categories=$(read_categories "$_file")
|
||||||
local _categories=$(read_categories "$_path")
|
local _tags=$(read_tags "$_file")
|
||||||
local _tags=$(read_tags "$_path")
|
|
||||||
|
|
||||||
create_pages "$_categories" $TYPE_CATEGORY
|
create_pages "$_categories" $TYPE_CATEGORY
|
||||||
create_pages "$_tags" $TYPE_TAG
|
create_pages "$_tags" $TYPE_TAG
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ OUTPUT_FILE=updates.yml
|
|||||||
|
|
||||||
|
|
||||||
_init() {
|
_init() {
|
||||||
|
|
||||||
if [[ ! -d "$OUTPUT_DIR" ]]; then
|
if [[ ! -d "$OUTPUT_DIR" ]]; then
|
||||||
mkdir "$OUTPUT_DIR"
|
mkdir "$OUTPUT_DIR"
|
||||||
fi
|
fi
|
||||||
@@ -27,7 +28,9 @@ _init() {
|
|||||||
rm -f "$OUTPUT_DIR/$OUTPUT_FILE"
|
rm -f "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch "$OUTPUT_DIR/$OUTPUT_FILE"
|
if [[ ! -d $POST_DIR ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -55,6 +58,10 @@ _has_changed() {
|
|||||||
_dump() {
|
_dump() {
|
||||||
local _lasmod="`git log -1 --pretty=%ad --date=iso $2`"
|
local _lasmod="`git log -1 --pretty=%ad --date=iso $2`"
|
||||||
|
|
||||||
|
if [[ ! -f "$OUTPUT_DIR/$OUTPUT_FILE" ]]; then
|
||||||
|
touch "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "-" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
echo "-" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||||
echo " filename: '$1'" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
echo " filename: '$1'" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||||
echo " lastmod: '$_lasmod'" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
echo " lastmod: '$_lasmod'" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||||
@@ -67,14 +74,12 @@ main() {
|
|||||||
|
|
||||||
local _count=0
|
local _count=0
|
||||||
|
|
||||||
for _file in $(ls -r "$POST_DIR")
|
for _file in $(find ${POST_DIR} -type f \( -iname \*.md -o -iname \*.markdown \))
|
||||||
do
|
do
|
||||||
_filepath="$POST_DIR/$_file"
|
_filename=$(basename $_file | sed 's/[0-9]\([0-9]*-\)//g;s/\..*//' ) # remove date and extension
|
||||||
_filename="${_file%.*}" # jekyll cannot read the extension of a file, so omit it.
|
|
||||||
_filename=${_filename:11} # remove the date
|
|
||||||
|
|
||||||
if _has_changed "$_filepath"; then
|
if _has_changed "$_file"; then
|
||||||
_dump "$_filename" "$_filepath"
|
_dump "$_filename" "$_file"
|
||||||
((_count=_count+1))
|
((_count=_count+1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -755,6 +755,8 @@ a {
|
|||||||
div.post-content {
|
div.post-content {
|
||||||
>table, li>table {
|
>table, li>table {
|
||||||
min-width: 60%;
|
min-width: 60%;
|
||||||
|
display: block;
|
||||||
|
overflow-x: auto;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
|
|||||||
@@ -50,11 +50,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
%anchor {
|
%anchor {
|
||||||
.post-content>&,
|
padding-top: 3.5rem;
|
||||||
#page>& {
|
margin-top: -2.5rem;
|
||||||
padding-top: 3.5rem;
|
|
||||||
margin-top: -2.5rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------- scss mixin ---------*/
|
/*---------- scss mixin ---------*/
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ html[mode=dark] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.highlighter-rouge {
|
.highlighter-rouge {
|
||||||
background: var(--highlight-bg-color);
|
background-color: var(--highlight-bg-color);
|
||||||
@extend %code-snippet-radius;
|
@extend %code-snippet-radius;
|
||||||
color: var(--highlighter-rouge-color);
|
color: var(--highlighter-rouge-color);
|
||||||
margin-bottom: 1.2em; /* Override BS Inline-code style */
|
margin-bottom: 1.2em; /* Override BS Inline-code style */
|
||||||
@@ -94,16 +94,21 @@ code {
|
|||||||
-moz-hyphens: none;
|
-moz-hyphens: none;
|
||||||
hyphens: none;
|
hyphens: none;
|
||||||
&.highlighter-rouge {
|
&.highlighter-rouge {
|
||||||
padding: 2px 4px;
|
padding: 3px 5px;
|
||||||
margin: 0 .15rem;
|
margin: 0 .15rem;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
background-color: var(--inline-code-bg);
|
||||||
}
|
}
|
||||||
@at-root a>&.highlighter-rouge {
|
@at-root a>&.highlighter-rouge {
|
||||||
padding-bottom: 0; // show link's underlinke
|
padding-bottom: 0; // show link's underlinke
|
||||||
|
color: inherit;
|
||||||
}
|
}
|
||||||
@at-root a:hover>&.highlighter-rouge {
|
@at-root a:hover>&.highlighter-rouge {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
blockquote &.highlighter-rouge {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
td.rouge-code {
|
td.rouge-code {
|
||||||
@@ -111,9 +116,10 @@ td.rouge-code {
|
|||||||
padding-right: 1rem;
|
padding-right: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hide line numbers for defualt, console, and terminal code snippets */
|
/* Hide line numbers for default, console, and terminal code snippets */
|
||||||
div {
|
div {
|
||||||
&[class^='highlighter-rouge'],
|
&[class^='highlighter-rouge'],
|
||||||
|
&.language-plaintext.highlighter-rouge,
|
||||||
&.language-console.highlighter-rouge,
|
&.language-console.highlighter-rouge,
|
||||||
&.language-terminal.highlighter-rouge {
|
&.language-terminal.highlighter-rouge {
|
||||||
pre.lineno {
|
pre.lineno {
|
||||||
|
|||||||
@@ -83,6 +83,8 @@
|
|||||||
--highlight-lineno-color: #6c6c6d;
|
--highlight-lineno-color: #6c6c6d;
|
||||||
--highlight-lineno-border-color: #3c4042;
|
--highlight-lineno-border-color: #3c4042;
|
||||||
|
|
||||||
|
--inline-code-bg: var(--highlight-bg-color);
|
||||||
|
|
||||||
.highlight {
|
.highlight {
|
||||||
.gp { color: #818c96; }
|
.gp { color: #818c96; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
/* Home page */
|
/* Home page */
|
||||||
--post-list-text-color: rgb(175, 176, 177);
|
--post-list-text-color: rgb(175, 176, 177);
|
||||||
--btn-patinator-text-color: var(--text-color);
|
--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-bg: rgba(28, 52, 94, 1);
|
||||||
--btn-active-border-color: rgb(66, 94, 138);
|
--btn-active-border-color: rgb(66, 94, 138);
|
||||||
--btn-text-color: var(--text-color);
|
--btn-text-color: var(--text-color);
|
||||||
|
|||||||
@@ -76,4 +76,5 @@
|
|||||||
--highlight-lineno-color: #c2c6cc;
|
--highlight-lineno-color: #c2c6cc;
|
||||||
--highlight-lineno-border-color: #e9ecef;
|
--highlight-lineno-border-color: #e9ecef;
|
||||||
|
|
||||||
|
--inline-code-bg: #f3f3f3;
|
||||||
} // light-syntax
|
} // light-syntax
|
||||||
|
|||||||
@@ -63,12 +63,14 @@
|
|||||||
|
|
||||||
--input-focus-border-color: var(--btn-border-color);
|
--input-focus-border-color: var(--btn-border-color);
|
||||||
|
|
||||||
/* Home */
|
/* Home page */
|
||||||
|
|
||||||
--post-list-text-color: dimgray;
|
--post-list-text-color: dimgray;
|
||||||
|
|
||||||
--btn-patinator-text-color: #555555;
|
--btn-patinator-text-color: #555555;
|
||||||
|
|
||||||
|
--btn-paginator-hover-color: #e9ecef;
|
||||||
|
|
||||||
--btn-active-bg: #2a408e;
|
--btn-active-bg: #2a408e;
|
||||||
|
|
||||||
--btn-active-border-color: #007bff;
|
--btn-active-border-color: #007bff;
|
||||||
|
|||||||
@@ -11,90 +11,101 @@
|
|||||||
#post-list {
|
#post-list {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
padding-right: .5rem;
|
padding-right: .5rem;
|
||||||
.post-meta {
|
|
||||||
i:not(:first-child) { // post-meta icons on HOME
|
.post-preview {
|
||||||
margin-left: 1.5rem;
|
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 {
|
.pagination {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.post-preview {
|
.page-item {
|
||||||
padding-top: 1.5rem;
|
.page-link {
|
||||||
padding-bottom: 1rem;
|
color: var(--btn-patinator-text-color);
|
||||||
border-bottom: 1px solid var(--main-border-color);
|
width: 2.5rem;
|
||||||
>h1 {
|
height: 2.5rem;
|
||||||
font-size: 1.4rem;
|
padding: 0;
|
||||||
margin: 0;
|
text-align: center;
|
||||||
}
|
|
||||||
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;
|
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 2;
|
display: flex;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-pack: center;
|
||||||
}
|
justify-content: center;
|
||||||
}
|
-webkit-box-align: center;
|
||||||
}
|
align-items: center;
|
||||||
|
border-radius: 50%;
|
||||||
.page-item {
|
border: 1px solid var(--btn-paginator-border-color);
|
||||||
.page-link {
|
font-family: 'Lato', sans-serif;
|
||||||
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);
|
|
||||||
background-color: var(--button-bg);
|
background-color: var(--button-bg);
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--btn-paginator-hover-color)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
&.active {
|
||||||
&:first-child .page-link,
|
.page-link {
|
||||||
&:last-child .page-link {
|
background-color: var(--btn-active-bg);
|
||||||
border-radius: 50%;
|
border-color: var(--btn-active-border-color);
|
||||||
}
|
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
|
||||||
&:not(:last-child) {
|
color: var(--btn-text-color);
|
||||||
margin-right: 0.6rem;
|
}
|
||||||
}
|
}
|
||||||
|
&.disabled {
|
||||||
} // .page-item
|
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) {
|
@media all and (max-width: 576px) {
|
||||||
#post-list .post-meta>span i:not(:first-child) {
|
#post-list .post-meta>span i:not(:first-child) {
|
||||||
@@ -118,12 +129,12 @@
|
|||||||
|
|
||||||
.pagination {
|
.pagination {
|
||||||
font-size: .85rem;
|
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 */
|
/* Pannel hidden */
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
|||||||
|
|
||||||
.post-navigation {
|
.post-navigation {
|
||||||
padding-top: 3rem;
|
padding-top: 3rem;
|
||||||
padding-bottom: 2rem;
|
padding-bottom: 4rem;
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
@include btn-post-nav;
|
@include btn-post-nav;
|
||||||
@@ -127,6 +127,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
|||||||
}
|
}
|
||||||
|
|
||||||
#toc-wrapper {
|
#toc-wrapper {
|
||||||
|
margin-top: 7rem;
|
||||||
border-left: 1px solid rgba(158, 158, 158, 0.17);
|
border-left: 1px solid rgba(158, 158, 158, 0.17);
|
||||||
position: -webkit-sticky;
|
position: -webkit-sticky;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
{% if site.google_analytics.pv.enabled %}
|
{% if site.google_analytics.pv.enabled %}
|
||||||
|
|
||||||
{% include_relative data/pv-data.js %}
|
{% include_relative _pv-config.js %}
|
||||||
|
|
||||||
{% include_relative _utils/pageviews.js %}
|
{% include_relative _utils/pageviews.js %}
|
||||||
|
|
||||||
|
|||||||
14
assets/js/_pv-config.js
Normal file
14
assets/js/_pv-config.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/*!
|
||||||
|
PV configuration and Javascript conversion.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const proxyEndpoint = "{{ site.google_analytics.pv.proxy_endpoint }}";
|
||||||
|
|
||||||
|
|
||||||
|
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
|
||||||
|
{% assign enabled = true %}
|
||||||
|
{% else %}
|
||||||
|
{% assign enabled = false %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
const pvCacheEnabled = {{ enabled }};
|
||||||
@@ -24,19 +24,13 @@ function countUp(min, max, destId) {
|
|||||||
|
|
||||||
|
|
||||||
function countPV(path, rows) {
|
function countPV(path, rows) {
|
||||||
/* path permalink looks like: '/posts/post-title/' */
|
|
||||||
var fileName = path.replace(/\/posts\//g, '').replace(/\//g, '.html'); /* e.g. post-title.html */
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
var _v2_url = path.replace(/posts\//g, ''); /* the v2.0+ blog permalink: "/post-title/" */
|
|
||||||
|
|
||||||
for (var i = 0; i < rows.length; ++i) {
|
for (var i = 0; i < rows.length; ++i) {
|
||||||
var gaPath = rows[i][0];
|
var gaPath = rows[i][0];
|
||||||
if (gaPath == path ||
|
if (gaPath == path) { /* path format see: site.permalink */
|
||||||
gaPath == _v2_url ||
|
|
||||||
gaPath.concat('/') == _v2_url ||
|
|
||||||
gaPath.slice(gaPath.lastIndexOf('/') + 1) === fileName) { /* old permalink record */
|
|
||||||
count += parseInt(rows[i][1]);
|
count += parseInt(rows[i][1]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +63,7 @@ function displayPageviews(data) {
|
|||||||
|
|
||||||
if ($("#post-list").length > 0) { /* the Home page */
|
if ($("#post-list").length > 0) { /* the Home page */
|
||||||
$(".post-preview").each(function() {
|
$(".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);
|
tacklePV(rows, path, $(this).find('.pageviews'), hasInit);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -94,10 +88,10 @@ var getInitStatus = (function() {
|
|||||||
|
|
||||||
var PvCache = (function() {
|
var PvCache = (function() {
|
||||||
const KEY_PV = "pv";
|
const KEY_PV = "pv";
|
||||||
const KEY_CREATION = "pv-created-date";
|
const KEY_CREATION = "pv_created_date";
|
||||||
const KEY_PV_TYPE = "pv-type";
|
const KEY_PV_SRC = "pv_source";
|
||||||
|
|
||||||
var PvType = {
|
var Source = {
|
||||||
ORIGIN: "origin",
|
ORIGIN: "origin",
|
||||||
PROXY: "proxy"
|
PROXY: "proxy"
|
||||||
};
|
};
|
||||||
@@ -116,29 +110,29 @@ var PvCache = (function() {
|
|||||||
},
|
},
|
||||||
saveOriginCache: function(pv) {
|
saveOriginCache: function(pv) {
|
||||||
set(KEY_PV, pv);
|
set(KEY_PV, pv);
|
||||||
set(KEY_PV_TYPE, PvType.ORIGIN );
|
set(KEY_PV_SRC, Source.ORIGIN );
|
||||||
set(KEY_CREATION, new Date().toJSON() );
|
set(KEY_CREATION, new Date().toJSON() );
|
||||||
},
|
},
|
||||||
saveProxyCache: function(pv) {
|
saveProxyCache: function(pv) {
|
||||||
set(KEY_PV, pv);
|
set(KEY_PV, pv);
|
||||||
set(KEY_PV_TYPE, PvType.PROXY );
|
set(KEY_PV_SRC, Source.PROXY );
|
||||||
set(KEY_CREATION, new Date().toJSON() );
|
set(KEY_CREATION, new Date().toJSON() );
|
||||||
},
|
},
|
||||||
isOriginCache: function() {
|
isFromOrigin: function() {
|
||||||
return get(KEY_PV_TYPE) == PvType.ORIGIN;
|
return get(KEY_PV_SRC) == Source.ORIGIN;
|
||||||
},
|
},
|
||||||
isProxyCache: function() {
|
isFromProxy: function() {
|
||||||
return get(KEY_PV_TYPE) == PvType.PROXY;
|
return get(KEY_PV_SRC) == Source.PROXY;
|
||||||
},
|
},
|
||||||
isExpired: function() {
|
isExpired: function() {
|
||||||
if (PvCache.isOriginCache() ) {
|
if (PvCache.isFromOrigin() ) {
|
||||||
let date = new Date(get(KEY_CREATION));
|
let date = new Date(get(KEY_CREATION));
|
||||||
date.setDate(date.getDate() + 1); /* fetch origin-data every day */
|
date.setDate(date.getDate() + 1); /* update origin records every day */
|
||||||
return Date.now() >= date.getTime();
|
return Date.now() >= date.getTime();
|
||||||
|
|
||||||
} else if (PvCache.isProxyCache() ) {
|
} else if (PvCache.isFromProxy() ) {
|
||||||
let date = new Date(get(KEY_CREATION) );
|
let date = new Date(get(KEY_CREATION) );
|
||||||
date.setHours(date.getHours() + 1); /* proxy-data is updated every hour */
|
date.setHours(date.getHours() + 1); /* update proxy records per hour */
|
||||||
return Date.now() >= date.getTime();
|
return Date.now() >= date.getTime();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -148,26 +142,46 @@ var PvCache = (function() {
|
|||||||
},
|
},
|
||||||
newerThan: function(pv) {
|
newerThan: function(pv) {
|
||||||
return PvCache.getAllPagevies() > pv.totalsForAllResults["ga:pageviews"];
|
return PvCache.getAllPagevies() > pv.totalsForAllResults["ga:pageviews"];
|
||||||
|
},
|
||||||
|
inspectKeys: function() {
|
||||||
|
if (localStorage.getItem(KEY_PV) == null
|
||||||
|
|| localStorage.getItem(KEY_PV_SRC) == null
|
||||||
|
|| localStorage.getItem(KEY_CREATION) == null) {
|
||||||
|
localStorage.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
})(); /* PvCache */
|
})(); /* PvCache */
|
||||||
|
|
||||||
|
|
||||||
function fetchOriginPageviews(pvData) {
|
function fetchPageviews(fetchOrigin = true, filterOrigin = false) {
|
||||||
if (pvData === undefined) {
|
/* pvCacheEnabled › see: /assets/js/_pv-config.js */
|
||||||
return;
|
if (pvCacheEnabled && fetchOrigin) {
|
||||||
|
fetch('/assets/js/data/pageviews.json')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (filterOrigin) {
|
||||||
|
if (PvCache.newerThan(data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
displayPageviews(data);
|
||||||
|
PvCache.saveOriginCache(JSON.stringify(data));
|
||||||
|
})
|
||||||
|
.then(() => fetchProxyPageviews());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fetchProxyPageviews();
|
||||||
}
|
}
|
||||||
displayPageviews(pvData);
|
|
||||||
PvCache.saveOriginCache(JSON.stringify(pvData));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function fetchProxyPageviews() {
|
function fetchProxyPageviews() {
|
||||||
let proxy = JSON.parse(proxyData); /* see file '/assets/data/pv-data.json' */
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: proxy.url,
|
url: proxyEndpoint, /* see: /assets/js/_pv-config.js */
|
||||||
dataType: 'jsonp',
|
dataType: 'jsonp',
|
||||||
jsonpCallback: "displayPageviews",
|
jsonpCallback: "displayPageviews",
|
||||||
success: function(data, textStatus, jqXHR) {
|
success: function(data, textStatus, jqXHR) {
|
||||||
@@ -184,40 +198,25 @@ $(function() {
|
|||||||
|
|
||||||
if ($('.pageviews').length > 0) {
|
if ($('.pageviews').length > 0) {
|
||||||
|
|
||||||
|
PvCache.inspectKeys();
|
||||||
let cache = PvCache.getData();
|
let cache = PvCache.getData();
|
||||||
|
|
||||||
if (cache) {
|
if (cache) {
|
||||||
|
displayPageviews(cache);
|
||||||
|
|
||||||
if (PvCache.isExpired()) {
|
if (PvCache.isExpired()) {
|
||||||
if (PvCache.isProxyCache() ) {
|
fetchPageviews(true, PvCache.isFromProxy());
|
||||||
let originPvData = pageviews ? JSON.parse(pageviews) : undefined;
|
|
||||||
if (originPvData) {
|
|
||||||
if (PvCache.newerThan(originPvData)) {
|
|
||||||
displayPageviews(cache);
|
|
||||||
} else {
|
|
||||||
fetchOriginPageviews(originPvData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchProxyPageviews();
|
} else {
|
||||||
|
|
||||||
} else if (PvCache.isOriginCache() ) {
|
if (PvCache.isFromOrigin()) {
|
||||||
fetchOriginPageviews(originPvData);
|
fetchPageviews(false);
|
||||||
fetchProxyPageviews();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else { /* still valid */
|
|
||||||
displayPageviews(cache);
|
|
||||||
|
|
||||||
if (PvCache.isOriginCache() ) {
|
|
||||||
fetchProxyPageviews();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let originPvData = pageviews ? JSON.parse(pageviews) : undefined;
|
fetchPageviews();
|
||||||
fetchOriginPageviews(originPvData);
|
|
||||||
fetchProxyPageviews();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,37 +8,41 @@
|
|||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
function timeago(date, isLastmod) {
|
function timeago(iso, isLastmod) {
|
||||||
var now = new Date();
|
let now = new Date();
|
||||||
var past = new Date(date);
|
let past = new Date(iso);
|
||||||
var seconds = Math.floor((now - past) / 1000);
|
|
||||||
|
|
||||||
var year = Math.floor(seconds / 31536000);
|
if (past.getFullYear() != now.getFullYear()) {
|
||||||
if (year >= 1) {
|
toRefresh -= 1;
|
||||||
return year + " year" + (year > 1 ? "s" : "") + " ago";
|
return past.toLocaleString("en-US", {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var month = Math.floor(seconds / 2592000);
|
if (past.getMonth() != now.getMonth()) {
|
||||||
if (month >= 1) {
|
toRefresh -= 1;
|
||||||
return month + " month" + (month > 1 ? "s" : "") + " ago";
|
return past.toLocaleString("en-US", {
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var week = Math.floor(seconds / 604800);
|
let seconds = Math.floor((now - past) / 1000);
|
||||||
if (week >= 1) {
|
|
||||||
return week + " week" + (week > 1 ? "s" : "") + " ago";
|
|
||||||
}
|
|
||||||
|
|
||||||
var day = Math.floor(seconds / 86400);
|
let day = Math.floor(seconds / 86400);
|
||||||
if (day >= 1) {
|
if (day >= 1) {
|
||||||
|
toRefresh -= 1;
|
||||||
return day + " day" + (day > 1 ? "s" : "") + " ago";
|
return day + " day" + (day > 1 ? "s" : "") + " ago";
|
||||||
}
|
}
|
||||||
|
|
||||||
var hour = Math.floor(seconds / 3600);
|
let hour = Math.floor(seconds / 3600);
|
||||||
if (hour >= 1) {
|
if (hour >= 1) {
|
||||||
return hour + " hour" + (hour > 1 ? "s" : "") + " ago";
|
return hour + " hour" + (hour > 1 ? "s" : "") + " ago";
|
||||||
}
|
}
|
||||||
|
|
||||||
var minute = Math.floor(seconds / 60);
|
let minute = Math.floor(seconds / 60);
|
||||||
if (minute >= 1) {
|
if (minute >= 1) {
|
||||||
return minute + " minute" + (minute > 1 ? "s" : "") + " ago";
|
return minute + " minute" + (minute > 1 ? "s" : "") + " ago";
|
||||||
}
|
}
|
||||||
@@ -50,29 +54,30 @@ $(function() {
|
|||||||
function updateTimeago() {
|
function updateTimeago() {
|
||||||
$(".timeago").each(function() {
|
$(".timeago").each(function() {
|
||||||
if ($(this).children("i").length > 0) {
|
if ($(this).children("i").length > 0) {
|
||||||
|
var basic = $(this).text();
|
||||||
var isLastmod = $(this).hasClass('lastmod');
|
var isLastmod = $(this).hasClass('lastmod');
|
||||||
var node = $(this).children("i");
|
var node = $(this).children("i");
|
||||||
var date = node.text(); /* ISO Dates: 'YYYY-MM-DDTHH:MM:SSZ' */
|
var date = node.text(); /* ISO Date: 'YYYY-MM-DDTHH:MM:SSZ' */
|
||||||
$(this).text(timeago(date, isLastmod));
|
$(this).text(timeago(date, isLastmod));
|
||||||
$(this).append(node);
|
$(this).append(node);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (vote == 0 && intervalId != undefined) {
|
if (toRefresh == 0 && intervalId != undefined) {
|
||||||
clearInterval(intervalId); /* stop interval */
|
clearInterval(intervalId); /* stop interval */
|
||||||
}
|
}
|
||||||
return vote;
|
return toRefresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var vote = $(".timeago").length;
|
var toRefresh = $(".timeago").length;
|
||||||
if (vote == 0) {
|
|
||||||
|
if (toRefresh == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateTimeago() > 0) { /* run immediately */
|
if (updateTimeago() > 0) { /* run immediately */
|
||||||
vote = $(".timeago").length; /* resume */
|
var intervalId = setInterval(updateTimeago, 60000); /* run every minute */
|
||||||
var intervalId = setInterval(updateTimeago, 60000); /* loop every minutes */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -42,19 +42,16 @@ const include = [
|
|||||||
|
|
||||||
/* The posts of first Home page and recent update list */
|
/* The posts of first Home page and recent update list */
|
||||||
{% assign post_list = "" | split: "" %}
|
{% assign post_list = "" | split: "" %}
|
||||||
{% assign sum = 0 %}
|
|
||||||
|
|
||||||
{% for post in site.posts %}
|
{% for post in site.posts limit: site.paginate %}
|
||||||
{% assign post_list = post_list | push: post.url %}
|
{% capture post_url %}{{ post.url | relative_url }}{% endcapture %}
|
||||||
{% assign sum = sum | plus: 1 %}
|
{% assign post_list = post_list | push: post_url %}
|
||||||
{% if sum >= site.paginate %}
|
|
||||||
{% break %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% include update_list.html %}
|
{% include update-list.html %}
|
||||||
|
|
||||||
{% for item in update_list %}
|
{% for item in update_list %}
|
||||||
{% assign url = item | split: "::" | last | prepend: "/posts/" | append: "/" %}
|
{% assign url = item | split: "::" | last | url_encode | prepend: "/posts/" | append: "/" | relative_url %}
|
||||||
{% assign post_list = post_list | push: url %}
|
{% assign post_list = post_list | push: url %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@@ -65,7 +62,7 @@ const include = [
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
/* Trending tags */
|
/* Trending tags */
|
||||||
{% include trending_tags.html %}
|
{% include trending-tags.html %}
|
||||||
{% for tag in trending_tags %}
|
{% for tag in trending_tags %}
|
||||||
{% capture tag_url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
{% capture tag_url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
||||||
'{{ tag_url | relative_url }}',
|
'{{ tag_url | relative_url }}',
|
||||||
@@ -106,6 +103,9 @@ const include = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const exclude = [
|
const exclude = [
|
||||||
'/assets/js/data/pv-data.js',
|
{%- if site.google_analytics.pv.proxy_url and site.google_analytics.pv.enabled -%}
|
||||||
|
'{{ site.google_analytics.pv.proxy_url }}',
|
||||||
|
{%- endif -%}
|
||||||
|
'/assets/js/data/pageviews.json',
|
||||||
'/img.shields.io/'
|
'/img.shields.io/'
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
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 data/_pageviews.json %}
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endcapture -%}
|
|
||||||
|
|
||||||
const pageviews = '{{ pv_data }}';
|
|
||||||
@@ -10,8 +10,7 @@ layout: compress
|
|||||||
"categories": "{{ post.categories | join: ', '}}",
|
"categories": "{{ post.categories | join: ', '}}",
|
||||||
"tags": "{{ post.tags | join: ', ' }}",
|
"tags": "{{ post.tags | join: ', ' }}",
|
||||||
"date": "{{ post.date }}",
|
"date": "{{ post.date }}",
|
||||||
{% assign content = post.content %}
|
{% include no-linenos.html 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 %}
|
}{% unless forloop.last %},{% endunless %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
🌏 [English](../README.md) • 简体中文
|
🌏 [English](../README.md) • 简体中文
|
||||||
|
|
||||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=event%3Apush)
|
[](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
|
||||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
|
[](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
|
||||||
[](https://996.icu)
|
[](https://996.icu)
|
||||||
|
|
||||||
@@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
## 功能预览
|
## 功能预览
|
||||||
|
|
||||||
* 自动暗夜模式
|
* 文章置顶
|
||||||
|
* 可配置的全局主题颜色
|
||||||
* 文章最后修改日期
|
* 文章最后修改日期
|
||||||
* 文章目录
|
* 文章目录
|
||||||
* 自动推荐相关文章
|
* 自动推荐相关文章
|
||||||
@@ -113,10 +114,11 @@ jekyll-theme-chirpy/
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
你需要将以下文件或目录删除:
|
如备注所述,部分文件或目录需要被删除:
|
||||||
|
|
||||||
- .travis.yml
|
```terminal
|
||||||
- .github
|
$ rm -rf .travis.yml .github _posts/*
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### 配置文件
|
### 配置文件
|
||||||
@@ -176,25 +178,21 @@ $ bash tools/run.sh
|
|||||||
**2**. 提交本地更改,然后运行:
|
**2**. 提交本地更改,然后运行:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ bash tools/init.sh
|
$ bash tools/publish.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
>**注**: *最后更新* 列表根据文章的 git 修改记录生成,所以运行前先把 `_posts` 目录的修改提交。
|
>**注**: *最后更新* 列表根据文章的 git 修改记录生成,所以运行前先把 `_posts` 目录的修改提交。
|
||||||
|
|
||||||
它会自动生成文章的 *最后修改日期* 和 *分类 / 标签* 页面,并自动提交一个 commit。输出日志类似如下:
|
它会自动生成文章的 *最后修改日期* 和 *分类 / 标签* 页面,并自动提交一个 commit 并推送到 `origin/master` 。输出日志类似如下:
|
||||||
|
|
||||||
```terminal
|
```terminal
|
||||||
[INFO] Success to update lastmod for 4 post(s).
|
[INFO] Success to update lastmod for 4 post(s).
|
||||||
[INFO] Succeed! 3 category-pages created.
|
[INFO] Succeed! 3 category-pages created.
|
||||||
[INFO] Succeed! 4 tag-pages created.
|
[INFO] Succeed! 4 tag-pages created.
|
||||||
[Automation] Updated the Categories, Tags, Lastmod for post(s).
|
[INFO] Published successfully!
|
||||||
11 files changed, 46 insertions(+), 3 deletions(-)
|
|
||||||
...
|
|
||||||
Updated the Categories, Tags, Lastmod for post(s).
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**3**. 到 GitHub 网页为该项目开启 Pages 服务。
|
||||||
**3**. 推送到 `origin/master` 然后到 GitHub 网页为该项目开启 Pages 服务。
|
|
||||||
|
|
||||||
**4**. 网站将运行在:
|
**4**. 网站将运行在:
|
||||||
|
|
||||||
@@ -237,7 +235,7 @@ $ bash tools/build.sh -d /path/to/local/project/
|
|||||||
|
|
||||||
#### 结束工作
|
#### 结束工作
|
||||||
|
|
||||||
无论你选择了哪种方式部署网站到 GitHub Pages, 请开启 `HTTPS` 功能。具体细节参考官方说明:[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)。
|
无论你选择了哪种方式部署网站到 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)。
|
||||||
|
|
||||||
### 文档
|
### 文档
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Archives
|
title: Archives
|
||||||
|
type: archives
|
||||||
# The Archives of posts.
|
# The Archives of posts.
|
||||||
# v2.0
|
# v2.0
|
||||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Categories
|
title: Categories
|
||||||
|
type: categories
|
||||||
# All the Categories of posts
|
# All the Categories of posts
|
||||||
# v2.0
|
# v2.0
|
||||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||||
@@ -8,6 +8,11 @@ title: Categories
|
|||||||
# MIT License
|
# MIT License
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{% assign HEAD_PREFIX = "h_" %}
|
||||||
|
{% assign LIST_PREFIX = "l_" %}
|
||||||
|
|
||||||
|
{% assign group_index = 0 %}
|
||||||
|
|
||||||
{% assign sort_categories = site.categories | sort %}
|
{% assign sort_categories = site.categories | sort %}
|
||||||
|
|
||||||
{% for category in sort_categories %}
|
{% for category in sort_categories %}
|
||||||
@@ -32,7 +37,8 @@ title: Categories
|
|||||||
|
|
||||||
<div class="card categories">
|
<div class="card categories">
|
||||||
<!-- top-category -->
|
<!-- 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>
|
<span>
|
||||||
{% if sub_categories_size > 0 %}
|
{% if sub_categories_size > 0 %}
|
||||||
<i class="far fa-folder-open fa-fw"></i>
|
<i class="far fa-folder-open fa-fw"></i>
|
||||||
@@ -40,33 +46,39 @@ title: Categories
|
|||||||
<i class="far fa-folder fa-fw"></i>
|
<i class="far fa-folder fa-fw"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ site.baseurl }}/categories/{{ category_name | replace: ' ', '-' | downcase | url_encode }}/"
|
<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 -->
|
<!-- content count -->
|
||||||
{% assign top_posts_size = site.categories[category_name] | size %}
|
{% assign top_posts_size = site.categories[category_name] | size %}
|
||||||
<span class="text-muted small font-weight-light">
|
<span class="text-muted small font-weight-light">
|
||||||
{% if sub_categories_size > 0 %}
|
{% if sub_categories_size > 0 %}
|
||||||
{{ sub_categories_size }}
|
{{ sub_categories_size }}
|
||||||
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
|
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ top_posts_size }}
|
{{ top_posts_size }}
|
||||||
post{% if top_posts_size > 1 %}s{% endif %}
|
post{% if top_posts_size > 1 %}s{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- arrow -->
|
<!-- 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>
|
<i class="fas fa-fw fa-angle-down"></i>
|
||||||
{% else %}
|
|
||||||
<i class="fas fa-fw fa-angle-right disabled"></i>
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
</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 -->
|
</div> <!-- .card-header -->
|
||||||
|
|
||||||
<!-- Sub-categories -->
|
<!-- Sub-categories -->
|
||||||
{% if sub_categories_size > 0 %}
|
{% 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">
|
<ul class="list-group">
|
||||||
{% for sub_category in sub_categories %}
|
{% for sub_category in sub_categories %}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
@@ -85,5 +97,7 @@ title: Categories
|
|||||||
|
|
||||||
</div> <!-- .card -->
|
</div> <!-- .card -->
|
||||||
|
|
||||||
|
{% assign group_index = group_index | plus: 1 %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Tags
|
title: Tags
|
||||||
|
type: tags
|
||||||
# All the Tags of posts.
|
# All the Tags of posts.
|
||||||
# v2.0
|
# v2.0
|
||||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# v2.0
|
||||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||||
# © 2019 Cotes Chung
|
# © 2019 Cotes Chung
|
||||||
@@ -15,19 +16,13 @@ LASTMOD=false
|
|||||||
WORK_DIR=$(dirname $(dirname $(realpath "$0")))
|
WORK_DIR=$(dirname $(dirname $(realpath "$0")))
|
||||||
|
|
||||||
check_status() {
|
check_status() {
|
||||||
local _watching_dirs=(
|
local _change=$(git status . -s)
|
||||||
"_post"
|
|
||||||
"_data")
|
|
||||||
|
|
||||||
for i in "${!_watching_dirs[@]}"
|
if [[ ! -z ${_change} ]]; then
|
||||||
do
|
echo "Warning: Commit the following changes first:"
|
||||||
local _dir=${_watching_dirs[${i}]}
|
echo "$_change"
|
||||||
if [[ ! -z $(git status $_dir -s) ]]; then
|
exit 1
|
||||||
echo "Warning: Commit the changes of the directory '$_dir' first."
|
fi
|
||||||
git status -s | grep $_dir
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,12 +67,17 @@ commit() {
|
|||||||
|
|
||||||
if [[ $CATEGORIES = true || $TAGS = true || $LASTMOD = true ]]; then
|
if [[ $CATEGORIES = true || $TAGS = true || $LASTMOD = true ]]; then
|
||||||
msg+=" for post(s)."
|
msg+=" for post(s)."
|
||||||
git commit -m "[Automation] $msg"
|
git commit -m "[Automation] $msg" -q
|
||||||
else
|
else
|
||||||
msg="Nothing changed."
|
msg="Nothing changed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $msg
|
}
|
||||||
|
|
||||||
|
|
||||||
|
push() {
|
||||||
|
git push origin master -q
|
||||||
|
echo "[INFO] Published successfully!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -90,6 +90,9 @@ main() {
|
|||||||
update_files
|
update_files
|
||||||
|
|
||||||
commit
|
commit
|
||||||
|
|
||||||
|
push
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main
|
main
|
||||||
Reference in New Issue
Block a user