mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 21:53:26 +00:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a33b2d78b0 | ||
|
|
1280f89217 | ||
|
|
83bfd32807 | ||
|
|
4ea320b250 | ||
|
|
8909438267 | ||
|
|
9482249999 | ||
|
|
43d4036941 | ||
|
|
a410600205 | ||
|
|
864119e3cc | ||
|
|
4702244ae8 | ||
|
|
b985965bc9 | ||
|
|
a5b002b2d8 | ||
|
|
270d3ba499 | ||
|
|
1f2ed3db60 | ||
|
|
08354cc4f5 | ||
|
|
ea56a900a0 | ||
|
|
8fa1f3b497 | ||
|
|
10bc44367a | ||
|
|
1889b6b4e0 | ||
|
|
aac29d43e5 | ||
|
|
c340199191 | ||
|
|
c7241ba611 | ||
|
|
d7f351b143 | ||
|
|
62aef9f850 | ||
|
|
7d128769f6 | ||
|
|
8d4c1deb15 | ||
|
|
57a4bfdb82 | ||
|
|
5741aa4e18 | ||
|
|
ad5b614304 | ||
|
|
4f1735aad6 | ||
|
|
38b87cfdd7 | ||
|
|
bf8996fb8b | ||
|
|
2bd99ffd33 | ||
|
|
46a8efb38a | ||
|
|
b9fb716e6a | ||
|
|
154fb04987 |
11
.editorconfig
Normal file
11
.editorconfig
Normal file
@@ -0,0 +1,11 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
# 2 space indentation
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
# Unix-style newlines with a newline ending every file
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
22
.github/ISSUE_TEMPLATE/bug_report.md
vendored
22
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -4,8 +4,7 @@ about: Create a report to help us improve
|
||||
labels: bug
|
||||
---
|
||||
|
||||
<!-- Note: Please follow the template to open a new issue, otherwise your question will probably be ignored. If you are new to Jekyll or Github Pages, you may be misreporting bugs. When you are not sure if this is a bug, choose to the `Question` type instead. -->
|
||||
|
||||
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
|
||||
|
||||
## Checklist
|
||||
<!-- Please complete the following list of tasks, and then check it by change the "[ ]" to "[x]" -->
|
||||
@@ -19,11 +18,12 @@ labels: bug
|
||||
### 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. -->
|
||||
@@ -33,21 +33,23 @@ Steps to reproduce the behavior:
|
||||
|
||||
### Software
|
||||
<!-- Please complete the following information -->
|
||||
- Ruby version: [by running: `ruby -v`]
|
||||
- Gem version: [by running: `gem -v`]
|
||||
- Bundler version: [by running: `bundle -v`]
|
||||
- Jekyll version: [by running: `bundle list | grep " jekyll "`]
|
||||
- Ruby version: <!-- by running: `ruby -v` -->
|
||||
- Gem version: <!-- by running: `gem -v`-->
|
||||
- Bundler version: <!-- by running: `bundle -v`-->
|
||||
- Jekyll version: <!-- by running: `bundle list | grep " jekyll "` -->
|
||||
|
||||
### Desktop
|
||||
<!-- Please complete the following information -->
|
||||
<!-- If necessary, uncomment and fill in the following list:
|
||||
- OS: [e.g. macOS 10.15.6]
|
||||
- Browser: [e.g. Chrome 85.0.4183.83 (Official Build) (64-bit)]
|
||||
- Browser: [e.g. Chrome 85.0.4183.83 (64-bit)]
|
||||
-->
|
||||
|
||||
### Smartphone
|
||||
<!-- please complete the following information -->
|
||||
<!-- If necessary, uncomment and fill in the following list:
|
||||
- Device: [e.g. iPhone 6]
|
||||
- OS: [e.g. iOS 13.6.1]
|
||||
- Browser: [e.g. Chrome 22]
|
||||
-->
|
||||
|
||||
### Additional context
|
||||
<!-- Add any other context about the problem here. -->
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -4,7 +4,7 @@ about: Suggest an idea for this project
|
||||
labels: enhancement
|
||||
---
|
||||
|
||||
<!-- Note: Please follow the template to open a new issue, otherwise your question will probably be ignored. -->
|
||||
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
|
||||
|
||||
## Checklist
|
||||
<!-- Please complete the following list of tasks, and then check it by change the "[ ]" to "[x]" -->
|
||||
|
||||
5
.github/ISSUE_TEMPLATE/question.md
vendored
5
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -4,7 +4,7 @@ about: Ask what ever you want
|
||||
labels: question
|
||||
---
|
||||
|
||||
<!-- Note: Please follow the template to open a new issue, otherwise your question will probably be ignored. -->
|
||||
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
|
||||
|
||||
## Checklist
|
||||
|
||||
@@ -15,6 +15,5 @@ labels: question
|
||||
- [ ] 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
|
||||
<!-- Please describe your question. -->
|
||||
<!-- Please describe your question in detial. -->
|
||||
|
||||
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -22,7 +22,7 @@ Please select the desired item checkbox and change it to "[x]", then delete opti
|
||||
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 run `bash ./tools/test.sh --build` (at the root of the project) locally and passed
|
||||
- [ ] I have tested this feature in the browser
|
||||
|
||||
### Test Configuration
|
||||
@@ -41,4 +41,4 @@ Please describe the tests that you ran to verify your changes. Provide instructi
|
||||
- [ ] 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
|
||||
- [ ] Any dependent changes have been merged and published in downstream modules
|
||||
|
||||
50
.github/workflows/ci.yml
vendored
50
.github/workflows/ci.yml
vendored
@@ -24,56 +24,38 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
|
||||
env:
|
||||
GEMS_PATH: ~/vendor/bundle
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '2.6.x'
|
||||
|
||||
- name: Install tools (for Ubuntu)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64
|
||||
sudo add-apt-repository ppa:rmescandon/yq
|
||||
sudo apt update
|
||||
sudo apt install yq -y
|
||||
|
||||
- name: Install tools (for macOS)
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
brew install coreutils
|
||||
brew install yq
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-depth: 0 # for posts's lastmod
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6.x
|
||||
|
||||
- name: Bundle Caching
|
||||
id: bundle-cache
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor/bundle
|
||||
path: ${{ env.GEMS_PATH }}
|
||||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gems-
|
||||
|
||||
- name: Bundle config
|
||||
run: |
|
||||
bundle config path vendor/bundle
|
||||
|
||||
- name: Bundle Install
|
||||
if: steps.bundle-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
bundle install
|
||||
|
||||
- name: Bundle Install locally
|
||||
if: steps.bundle-cache.outputs.cache-hit == 'true'
|
||||
run: |
|
||||
bundle install --local
|
||||
bundle config path ${{ env.GEMS_PATH }}
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- name: Build Site
|
||||
env:
|
||||
JEKYLL_ENV: production
|
||||
run: |
|
||||
bash tools/build.sh
|
||||
bundle exec jekyll b
|
||||
|
||||
- name: Test Site
|
||||
run: |
|
||||
|
||||
2
.github/workflows/issues-cleaner.yml
vendored
2
.github/workflows/issues-cleaner.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
DAYS_TO_CLOSE: ${{ 2 }}
|
||||
uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repo-token: ${{ secrets.GH_PAT }}
|
||||
stale-issue-message: 'This issue is stale because it has been open ${{ env.DAYS_TO_STALE }} days with no activity. Remove stale label or comment or this will be closed in ${{ env.DAYS_TO_CLOSE }} days'
|
||||
stale-issue-label: 'stale'
|
||||
exempt-issue-labels: 'pending, in progress'
|
||||
|
||||
18
.github/workflows/issues-filter.yml
vendored
Normal file
18
.github/workflows/issues-filter.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
name: "Close Irregular Issues"
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
|
||||
jobs:
|
||||
auto_close_issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Automatically close issues that don't follow the issue template
|
||||
uses: lucasbento/auto-close-issues@v1.0.2
|
||||
with:
|
||||
github-token: ${{ secrets.GH_PAT }}
|
||||
issue-close-message: "@${issue.user.login}: hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template. \n> Follow the template to edit this issue and it will automatically reopen."
|
||||
closed-issues-label: "🙁 Not following issue template"
|
||||
54
.github/workflows/pages-deploy.yml.hook
vendored
54
.github/workflows/pages-deploy.yml.hook
vendored
@@ -14,68 +14,58 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
GEMS_PATH: /tmp/bundle
|
||||
GEMS_PATH: ~/vendor/bundle
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6.x
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64
|
||||
sudo add-apt-repository ppa:rmescandon/yq
|
||||
sudo apt update
|
||||
sudo apt install yq -y
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-depth: 0 # for posts's lastmod
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6.x
|
||||
|
||||
- name: Bundle Caching
|
||||
id: bundle-cache
|
||||
uses: actions/cache@v1
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.GEMS_PATH }}
|
||||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gems-
|
||||
|
||||
- name: Bundle config
|
||||
- name: Bundle Install
|
||||
run: |
|
||||
bundle config path ${{ env.GEMS_PATH }}
|
||||
|
||||
- name: Bundle Install
|
||||
if: steps.bundle-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
bundle install
|
||||
|
||||
- name: Bundle Install locally
|
||||
if: steps.bundle-cache.outputs.cache-hit == 'true'
|
||||
run: |
|
||||
bundle install --local
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- name: Check baseurl
|
||||
run: |
|
||||
baseurl="$(grep '^baseurl:' _config.yml | yq r - baseurl)"
|
||||
baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
|
||||
if [[ -n $baseurl ]]; then
|
||||
echo "SPEC_TEST=_site_no_baseurl" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Build Site
|
||||
env:
|
||||
JEKYLL_ENV: production
|
||||
run: |
|
||||
bash tools/build.sh
|
||||
bundle exec jekyll b
|
||||
|
||||
if [[ -n $SPEC_TEST ]]; then
|
||||
# Bypass the defects of htmlproofer
|
||||
bash tools/build.sh -b "" -d "$SPEC_TEST"
|
||||
fi
|
||||
bundle exec jekyll b -b "" -d "$SPEC_TEST"
|
||||
fi
|
||||
|
||||
- name: Test Site
|
||||
run: |
|
||||
bash tools/test.sh "$SPEC_TEST"
|
||||
|
||||
if [[ -n $SPEC_TEST ]]; then
|
||||
bash tools/test.sh -d "$SPEC_TEST"
|
||||
else
|
||||
bash tools/test.sh
|
||||
fi
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
bash tools/deploy.sh
|
||||
|
||||
13
.gitignore
vendored
13
.gitignore
vendored
@@ -1,17 +1,8 @@
|
||||
# hidden files
|
||||
.*
|
||||
!.github
|
||||
|
||||
# python compiled files
|
||||
*.pyc
|
||||
|
||||
# jekyll debug
|
||||
# jekyll cache
|
||||
_site
|
||||
|
||||
# Jeykll Gemfile.lock
|
||||
Gemfile.lock
|
||||
|
||||
# yui-compressor
|
||||
*.jar
|
||||
|
||||
# bundle cache
|
||||
vendor
|
||||
|
||||
10
.travis.yml
10
.travis.yml
@@ -12,18 +12,12 @@ install:
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: "ppa:rmescandon/yq"
|
||||
packages:
|
||||
- libcurl4-openssl-dev # required to avoid SSL error (for htmlproofer)
|
||||
- yq
|
||||
|
||||
script:
|
||||
- >-
|
||||
git clone https://${GH_PAT}@github.com/${GH_USER}/${BUILDER_REPO}.git
|
||||
${HOME}/${BUILDER_REPO} --depth=1 -q
|
||||
- cp -r ${HOME}/${BUILDER_REPO}/framework/* .
|
||||
- bash _cibuild.sh
|
||||
- git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
|
||||
- eval "$BUILD_CMD"
|
||||
|
||||
branches:
|
||||
only: production
|
||||
|
||||
18
Gemfile
18
Gemfile
@@ -1,14 +1,26 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "jekyll", ">=3.8.6"
|
||||
gem "jekyll", ">= 3.8.6", "< 5.0"
|
||||
|
||||
# Official Plugins
|
||||
# plugins
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-paginate"
|
||||
gem "jekyll-redirect-from"
|
||||
gem "jekyll-seo-tag", "~> 2.6.1"
|
||||
gem "jekyll-archives"
|
||||
gem "jekyll-sitemap"
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem "html-proofer"
|
||||
gem "html-proofer", "~> 3.16.0"
|
||||
end
|
||||
|
||||
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
# and associated library.
|
||||
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
|
||||
gem "tzinfo", "~> 1.2"
|
||||
gem "tzinfo-data"
|
||||
end
|
||||
|
||||
# Performance-booster for watching directories on Windows
|
||||
gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?
|
||||
|
||||
53
README.md
53
README.md
@@ -1,13 +1,13 @@
|
||||
# Chirpy
|
||||
|
||||
🌏 English • [简体中文](docs/README_zh-CN.md)
|
||||
Language: English | [简体中文](docs/README_zh-CN.md)
|
||||
|
||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
|
||||
[](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
|
||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
|
||||
[](https://996.icu)
|
||||
|
||||
A minimal, sidebar, responsive web design Jekyll theme, focusing on text presentation, aim to help you easily record and share your knowledge. [Live Demo »](https://chirpy.cotes.info)
|
||||
A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation. Designed to help you record and share your knowledge easily. [Live Demo »](https://chirpy.cotes.info)
|
||||
|
||||
[](https://chirpy.cotes.info)
|
||||
|
||||
@@ -18,7 +18,7 @@ A minimal, sidebar, responsive web design Jekyll theme, focusing on text present
|
||||
- [Usage](#usage)
|
||||
- [Contributing](#contributing)
|
||||
- [Credits](#credits)
|
||||
- [Support](#support)
|
||||
- [Supporting](#supporting)
|
||||
- [License](#license)
|
||||
|
||||
## Features
|
||||
@@ -48,7 +48,7 @@ $ git clone https://github.com/USERNAME/USERNAME.github.io.git -b master --singl
|
||||
|
||||
### Setting up the local envrionment
|
||||
|
||||
If you would like to run or build the project on your local machine, please follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems` and `Bundler`.
|
||||
If you would like to run or build the project on your local machine, please follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
|
||||
|
||||
Before running or building for the first time, please complete the installation of the Jekyll plugins. Go to the root directory of project and run:
|
||||
|
||||
@@ -58,32 +58,16 @@ $ bundle install
|
||||
|
||||
`bundle` will automatically install all the dependencies specified by `Gemfile`.
|
||||
|
||||
In order to generate some extra files (_categories_, _tags_ and _last modified list_), we need to use some tool scripts. And they require dependency package [yq](https://github.com/mikefarah/yq#install) to be installed. What's more, if your machine is running Debian or macOS, you also need to install [GNU coreutils](https://www.gnu.org/software/coreutils/).
|
||||
|
||||
- on Debian:
|
||||
|
||||
```console
|
||||
$ sudo apt-get install coreutils
|
||||
```
|
||||
|
||||
- on macOS:
|
||||
|
||||
```console
|
||||
$ brew install coreutils
|
||||
```
|
||||
|
||||
### Setting up Docker environment (optional)
|
||||
|
||||
If you're a loyal fan of [**Docker**](https://www.docker.com/) or just too lazy to install the packages mentioned in [_Setting up the local envrionment_](#setting-up-the-local-envrionment), please make sure you have **Docker Engine** installed and running, and then get Docker image `jekyll/jekyll` from Docker Hub by the following command:
|
||||
|
||||
```console
|
||||
$ docker pull jekyll/jekyll:latest
|
||||
$ docker pull jekyll/jekyll
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Running [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) requires some extra files, which cannot be generated by Jekyll native commands, so please strictly follow the methods mentioned below to run or deploy your website.
|
||||
|
||||
### Initialization
|
||||
|
||||
Go to the root directory of the project and start initialization:
|
||||
@@ -102,7 +86,7 @@ What it does is:
|
||||
- files under `_posts`
|
||||
- folder `docs`
|
||||
|
||||
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in folder `.github`.
|
||||
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in folder `.github`.
|
||||
|
||||
3. Automatically create a commit to save the changes.
|
||||
|
||||
@@ -120,26 +104,22 @@ Generally, go to `_config.yml` and configure the variables as needed. Some of th
|
||||
You may want to preview the site contents before publishing, so just run it by:
|
||||
|
||||
```terminal
|
||||
$ bash tools/run.sh
|
||||
$ bundle exec jekyll s
|
||||
```
|
||||
|
||||
Then open a browser and visit to <http://localhost:4000>.
|
||||
|
||||
Few days later, you may find that the file changes does not refresh in real time by using `run.sh`. Don't worry, the advanced option `-r` (or `--realtime`) will solve this problem, but it requires [**fswatch**](http://emcrisostomo.github.io/fswatch/) to be installed on your machine.
|
||||
|
||||
### Run on Docker
|
||||
|
||||
Run the site on Docker with the following command:
|
||||
|
||||
```terminal
|
||||
$ docker run --rm -it \
|
||||
$ docker run -it --rm \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
-p 4000:4000 jekyll/jekyll \
|
||||
bash tools/run.sh --docker
|
||||
jekyll serve
|
||||
```
|
||||
|
||||
Please note that on Docker containers, you'll lose the real-time refresh feature.
|
||||
|
||||
### Deployment
|
||||
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [_project site_](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash. For example, `/project`.
|
||||
@@ -148,11 +128,11 @@ Assuming you have already gone through the [initialization](#initialization), yo
|
||||
|
||||
#### Deploy on GitHub Pages
|
||||
|
||||
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using tool scripts to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the Pages service.
|
||||
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the Pages service.
|
||||
|
||||
1. Push any commit to `origin/master` to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
|
||||
|
||||
2. Browse to your repository on GitHub and choose the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_:
|
||||
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_:
|
||||

|
||||
|
||||
3. Visit your website at the address indicated by GitHub.
|
||||
@@ -164,18 +144,17 @@ On platforms other than GitHub, we cannot enjoy the convenience of **GitHub Acti
|
||||
Go to the root of the source project, build your site by:
|
||||
|
||||
```console
|
||||
$ bash tools/build.sh
|
||||
$ JEKYLL_ENV=production bundle exec jekyll b
|
||||
```
|
||||
|
||||
> **Note**: The output path can be specified with the option `-d`.
|
||||
|
||||
Or, build the site with Docker by:
|
||||
|
||||
```terminal
|
||||
$ docker run --rm -it \
|
||||
$ docker run -it --rm \
|
||||
--env JEKYLL_ENV=production \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
jekyll/jekyll \
|
||||
bash tools/build.sh --docker
|
||||
jekyll build
|
||||
```
|
||||
|
||||
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
|
||||
@@ -194,7 +173,7 @@ This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Boot
|
||||
|
||||
:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas or inspired me to write more readable documentation.
|
||||
|
||||
## Support
|
||||
## Supporting
|
||||
|
||||
If you enjoy this theme or find it helpful, please consider becoming my sponsor, I'd really appreciate it! Click the button <kbd>:heart: Sponsor</kbd> at the top of the [Home Page](https://github.com/cotes2020/jekyll-theme-chirpy) and choose a link that suits you to donate; this will encourage and help me better maintain the project.
|
||||
|
||||
|
||||
56
_config.yml
56
_config.yml
@@ -7,7 +7,6 @@
|
||||
|
||||
# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
|
||||
#--------------------------
|
||||
|
||||
title: Chirpy # the main title
|
||||
|
||||
tagline: A text-focused Jekyll theme. # it will display as the sub-title
|
||||
@@ -17,8 +16,8 @@ description: >- # used by seo meta and the atom feed
|
||||
bootstrap Jekyll theme with responsive web design
|
||||
and focuses on text presentation.
|
||||
|
||||
# Replace with the website url, e.g. 'https://username.github.io'
|
||||
url: 'protocol://domain'
|
||||
# fill in the base hostname & protocol for your site, e.g., 'https://username.github.io'
|
||||
url: ''
|
||||
|
||||
author: your_full_name # change to your full name
|
||||
|
||||
@@ -42,7 +41,6 @@ social:
|
||||
# - https://www.linkedin.com/in/username
|
||||
|
||||
google_site_verification: google_meta_tag_verification # change to your verification string
|
||||
|
||||
#--------------------------
|
||||
|
||||
|
||||
@@ -80,7 +78,7 @@ disqus:
|
||||
#
|
||||
theme_mode: dual
|
||||
|
||||
# boolean type, global switch for ToC in posts.
|
||||
# boolean type, the global switch for ToC in posts.
|
||||
toc: true
|
||||
|
||||
paginate: 10
|
||||
@@ -105,16 +103,21 @@ kramdown:
|
||||
# or you think you're smart enough to change other relevant URLs within this template.
|
||||
permalink: /posts/:title/
|
||||
|
||||
collections:
|
||||
tabs:
|
||||
output: true
|
||||
sort_by: order
|
||||
|
||||
|
||||
defaults:
|
||||
-
|
||||
scope:
|
||||
path: "" # An empty string here means all files in the project
|
||||
path: '' # An empty string here means all files in the project
|
||||
type: posts
|
||||
values:
|
||||
layout: post
|
||||
comments: true # Enable comments in posts.
|
||||
toc: true # Display TOC column in posts.
|
||||
location: Post
|
||||
breadcrumb:
|
||||
-
|
||||
label: Posts
|
||||
@@ -124,12 +127,17 @@ defaults:
|
||||
path: _drafts
|
||||
values:
|
||||
comments: false
|
||||
-
|
||||
scope:
|
||||
path: index.html
|
||||
values:
|
||||
breadcrumb:
|
||||
-
|
||||
label: Posts
|
||||
-
|
||||
scope:
|
||||
path: tags
|
||||
values:
|
||||
tab_active: Tags
|
||||
location: Tag
|
||||
breadcrumb:
|
||||
-
|
||||
label: Home
|
||||
@@ -141,8 +149,6 @@ defaults:
|
||||
scope:
|
||||
path: categories
|
||||
values:
|
||||
tab_active: Categories
|
||||
location: Category
|
||||
breadcrumb:
|
||||
-
|
||||
label: Home
|
||||
@@ -152,7 +158,8 @@ defaults:
|
||||
url: /tabs/categories/
|
||||
-
|
||||
scope:
|
||||
path: tabs
|
||||
path: ''
|
||||
type: tabs # see `site.collections`
|
||||
values:
|
||||
layout: page
|
||||
dynamic_title: true # Hide title in mobile screens.
|
||||
@@ -161,7 +168,6 @@ defaults:
|
||||
label: Home
|
||||
url: /
|
||||
|
||||
|
||||
sass:
|
||||
sass_dir: /assets/css
|
||||
style: compressed
|
||||
@@ -176,7 +182,7 @@ compress_html:
|
||||
envs: []
|
||||
|
||||
exclude:
|
||||
- vendor # Avoid Jekyll mistakenly read the vendor directory on Travis-CI's VM .
|
||||
- vendor
|
||||
- Gemfile.lock
|
||||
- Gemfile
|
||||
- tools
|
||||
@@ -184,17 +190,11 @@ exclude:
|
||||
- README.md
|
||||
- LICENSE
|
||||
|
||||
sitemap_exclude: # Sitemap will exclude the following items.
|
||||
fuzzy:
|
||||
- /assets/
|
||||
accurate:
|
||||
- /norobots/
|
||||
- /tabs/
|
||||
- /categories/
|
||||
- /tags/
|
||||
- /posts/
|
||||
- 404.html
|
||||
- feed.xml
|
||||
- sitemap.xml
|
||||
- robots.txt
|
||||
- redirects.json
|
||||
jekyll-archives:
|
||||
enabled: [categories, tags]
|
||||
layouts:
|
||||
category: category
|
||||
tag: tag
|
||||
permalinks:
|
||||
tag: '/tags/:name/'
|
||||
category: '/categories/:name/'
|
||||
|
||||
@@ -21,11 +21,14 @@
|
||||
|
||||
# Uncomment and complete the url below to enable more contact options
|
||||
# -
|
||||
# type: mastodon
|
||||
# icon: 'fab fa-mastodon' # icons powered by <https://fontawesome.com/>
|
||||
# url: '' # Fill with your mastodon account page
|
||||
# -
|
||||
# type: linkedin
|
||||
# icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
|
||||
# url: '' # Fill with your Linkedin homepage
|
||||
# -
|
||||
# type: stack-overflow
|
||||
# icon: 'fab fa-stack-overflow'
|
||||
# url: '' # Fill with your stackoverflow homepage
|
||||
|
||||
3
_data/meta.yml
Normal file
3
_data/meta.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
name: Chirpy
|
||||
version: 2.6.0
|
||||
homepage: https://github.com/cotes2020/jekyll-theme-chirpy/
|
||||
@@ -1,30 +0,0 @@
|
||||
# The tab data.
|
||||
# v2.1
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# MIT Licensed
|
||||
|
||||
|
||||
-
|
||||
name: Home
|
||||
icon: "fas fa-home"
|
||||
-
|
||||
name: Categories
|
||||
icon: "fas fa-stream"
|
||||
path: tabs
|
||||
url: categories
|
||||
-
|
||||
name: "Tags"
|
||||
icon: "fas fa-tags"
|
||||
path: tabs
|
||||
url: tags
|
||||
-
|
||||
name: "Archives"
|
||||
path: tabs
|
||||
url: archives
|
||||
icon: "fas fa-archive"
|
||||
-
|
||||
name: "About"
|
||||
icon: "fas fa-info"
|
||||
path: tabs
|
||||
url: about
|
||||
@@ -12,20 +12,21 @@
|
||||
|
||||
{% elsif page.layout == 'page' %}
|
||||
|
||||
{% if page.type == 'categories' %}
|
||||
{% if page.collection == 'tabs' and page.title != 'About' %}
|
||||
|
||||
<link rel="preload" href="{{ '/assets/css/categories.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/categories.css' | relative_url }}">
|
||||
|
||||
{% elsif page.type == 'tags' %}
|
||||
|
||||
<link rel="preload" href="{{ '/assets/css/tags.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/tags.css' | relative_url }}">
|
||||
|
||||
{% elsif page.type == 'archives' %}
|
||||
|
||||
<link rel="preload" href="{{ '/assets/css/archives.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/archives.css' | relative_url }}">
|
||||
{% if page.title == 'Categories' %}
|
||||
<link rel="preload" href="{{ '/assets/css/categories.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/categories.css' | relative_url }}">
|
||||
|
||||
{% elsif page.title == 'Tags' %}
|
||||
<link rel="preload" href="{{ '/assets/css/tags.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/tags.css' | relative_url }}">
|
||||
|
||||
{% elsif page.title == 'Archives'%}
|
||||
<link rel="preload" href="{{ '/assets/css/archives.css' | relative_url }}" as="style">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/archives.css' | relative_url }}">
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
<div class="footer-right">
|
||||
<p class="mb-0">
|
||||
Powered by
|
||||
<a href="https://jekyllrb.com" target="_blank">Jekyll</a>
|
||||
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
|
||||
with
|
||||
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/">Chirpy</a>
|
||||
<a href="{{ site.data.meta.homepage }}" target="_blank" rel="noopener">{{ site.data.meta.name }}</a>
|
||||
theme.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme" content="{{ site.data.meta.name }} v{{ site.data.meta.version }}">
|
||||
|
||||
{% seo title=false %}
|
||||
|
||||
<title>
|
||||
{%- unless page.layout == "home" -%}
|
||||
@@ -17,8 +20,6 @@
|
||||
{{ site.title }}
|
||||
</title>
|
||||
|
||||
{% seo title=false %}
|
||||
|
||||
{% include favicons.html %}
|
||||
|
||||
<!-- Google Fonts -->
|
||||
@@ -44,10 +45,6 @@
|
||||
<link rel="dns-prefetch" href="cdn.jsdelivr.net">
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link rel="preload" as="style"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
|
||||
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
|
||||
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
|
||||
@@ -62,14 +59,11 @@
|
||||
|
||||
<!-- JavaScripts -->
|
||||
|
||||
<link rel="preload" as="script" href="https://cdn.jsdelivr.net/npm/jquery@3.4.1"
|
||||
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1"
|
||||
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" async></script>
|
||||
<script async
|
||||
src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4/dist/js/bootstrap.min.js"></script>
|
||||
|
||||
{% include js-selector.html %}
|
||||
|
||||
</head>
|
||||
</head>
|
||||
|
||||
@@ -8,38 +8,34 @@
|
||||
|
||||
{% if page.layout == 'home' %}
|
||||
|
||||
<script src="{{ '/assets/js/home.min.js' | relative_url }}" async></script>
|
||||
<script async src="{{ '/assets/js/home.min.js' | relative_url }}"></script>
|
||||
|
||||
{% elsif page.layout == 'post' %}
|
||||
|
||||
<script src="{{ '/assets/js/post.min.js' | relative_url }}" async></script>
|
||||
<script async src="{{ '/assets/js/post.min.js' | relative_url }}"></script>
|
||||
|
||||
{% if page.math %}
|
||||
<!-- MathJax -->
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
|
||||
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
{% endif %}
|
||||
|
||||
{% elsif page.layout == 'page' %}
|
||||
|
||||
{% if page.type == 'categories' %}
|
||||
<script src="{{ '/assets/js/categories.min.js' | relative_url }}" async></script>
|
||||
{% if page.title == 'Categories' and page.collection == 'tabs' %}
|
||||
<script async src="{{ '/assets/js/categories.min.js' | relative_url }}"></script>
|
||||
{% else %}
|
||||
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
|
||||
<script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
|
||||
<script async src="{{ '/assets/js/page.min.js' | relative_url }}"></script>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if jekyll.environment == 'production' %}
|
||||
|
||||
{% include google-analytics.html %}
|
||||
|
||||
<!-- PWA -->
|
||||
<script src="{{ '/app.js' | relative_url }}" defer></script>
|
||||
|
||||
<script defer src="{{ '/app.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
get isDarkMode() { return this.mode == ModeToggle.DARK_MODE; }
|
||||
|
||||
get isLightkMode() { return this.mode == ModeToggle.LIGHT_MODE; }
|
||||
get isLightMode() { return this.mode == ModeToggle.LIGHT_MODE; }
|
||||
|
||||
get hasMode() { return this.mode != null; }
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
flipMode() {
|
||||
if (this.hasMode) {
|
||||
if (this.isSysDarkPrefer) {
|
||||
if (this.isLightkMode) {
|
||||
if (this.isLightMode) {
|
||||
this.clearMode();
|
||||
} else {
|
||||
this.setLight();
|
||||
@@ -115,4 +115,4 @@
|
||||
toggle.flipMode();
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -10,49 +10,38 @@
|
||||
|
||||
<div class="access">
|
||||
|
||||
{% if site.data.updates %}
|
||||
|
||||
{% include update-list.html %}
|
||||
|
||||
{% if update_list.size > 0 %}
|
||||
|
||||
{% include update-list.html %}
|
||||
|
||||
{% if update_list.size > 0 %}
|
||||
|
||||
<div id="access-lastmod" class="post">
|
||||
<h3 data-toc-skip>
|
||||
{{- site.data.label.panel.lastmod -}}
|
||||
</h3>
|
||||
<span>{{- site.data.label.panel.lastmod -}}</span>
|
||||
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
|
||||
|
||||
{% for item in update_list %}
|
||||
{% assign post_url = item | split: "::" | last | url_encode | prepend: "/posts/" | append: "/" %}
|
||||
{% assign post = site.posts | where: "url", post_url | first %}
|
||||
|
||||
{% if post %}
|
||||
{% assign url = post.url | relative_url %}
|
||||
<li><a href="{{ url }}">{{ post.title }}</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% assign index = item | split: "::" | last | plus: 0 %}
|
||||
{% assign post = site.posts[index] %}
|
||||
{% assign url = post.url | relative_url %}
|
||||
<li><a href="{{ url }}">{{ post.title }}</a></li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
</div><!-- #access-lastmod -->
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endif %} <!-- site.data.updates -->
|
||||
</div> <!-- #access-lastmod -->
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% include trending-tags.html %}
|
||||
|
||||
{% if trending_tags.size > 0 %}
|
||||
<div id="access-tags">
|
||||
<h3 data-toc-skip>
|
||||
{{- site.data.label.panel.trending_tags -}}
|
||||
</h3>
|
||||
<span>{{- site.data.label.panel.trending_tags -}}</span>
|
||||
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
|
||||
|
||||
|
||||
{% for tag in trending_tags %}
|
||||
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
||||
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -60,9 +49,9 @@
|
||||
|
||||
{% if page.layout == 'post' and site.toc and page.toc %}
|
||||
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
||||
<h3 data-toc-skip class="pl-3 pt-2 mb-2">
|
||||
<span class="pl-3 pt-2 mb-2">
|
||||
{{- site.data.label.panel.toc -}}
|
||||
</h3>
|
||||
</span>
|
||||
<nav id="toc" data-toggle="toc"></nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -10,17 +10,15 @@
|
||||
<ul class="pagination mt-4 mb-0 pl-lg-2">
|
||||
<!-- left arrow -->
|
||||
{% if paginator.previous_page %}
|
||||
<li class="page-item">
|
||||
<a class="page-link btn-box-shadow" href="{{ site.baseurl }}{{ paginator.previous_page_path }}">
|
||||
{% assign prev_url = paginator.previous_page_path | relative_url %}
|
||||
{% else %}
|
||||
{% assign prev_url = "#" %}
|
||||
{% endif %}
|
||||
<li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
|
||||
<a class="page-link btn-box-shadow" href="{{ prev_url }}" aria-label="previous-page">
|
||||
<i class="fas fa-angle-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link btn-box-shadow" href="#"><i class="fas fa-angle-left"></i></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<!-- endof left arrow -->
|
||||
|
||||
<!-- page numbers -->
|
||||
{% assign left_ellipsis = false %}
|
||||
@@ -51,38 +49,37 @@
|
||||
{% endif %}
|
||||
|
||||
{% if show %}
|
||||
<!-- show number -->
|
||||
<li class="page-item {% if i == paginator.page %} active{% endif %}">
|
||||
<a class="page-link btn-box-shadow" href="{{ site.baseurl }}/{% if i > 1%}page{{ i }}/{% endif %}">{{ i }}</a>
|
||||
<!-- show number -->
|
||||
<li class="page-item {% if i == paginator.page %} active{% endif %}">
|
||||
<a class="page-link btn-box-shadow" href="{{ site.baseurl }}/{% if i > 1%}page{{ i }}/{% endif %}">{{ i }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<!-- hide number -->
|
||||
{% if i < pre and left_ellipsis == false %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link btn-box-shadow">...</span>
|
||||
</li>
|
||||
{% else %}
|
||||
<!-- hide number -->
|
||||
{% if i < pre and left_ellipsis == false %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link btn-box-shadow">...</span>
|
||||
</li>
|
||||
{% assign left_ellipsis = true %}
|
||||
{% elsif i > next and right_ellipsis == false %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link btn-box-shadow">...</span>
|
||||
</li>
|
||||
{% assign right_ellipsis = true %}
|
||||
{% endif %}
|
||||
{% assign left_ellipsis = true %}
|
||||
{% elsif i > next and right_ellipsis == false %}
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link btn-box-shadow">...</span>
|
||||
</li>
|
||||
{% assign right_ellipsis = true %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
<!-- right arrow -->
|
||||
{% if paginator.next_page %}
|
||||
<li class="page-item">
|
||||
<a class="page-link btn-box-shadow" href="{{ site.baseurl }}{{ paginator.next_page_path }}">
|
||||
{% if paginator.next_page_path %}
|
||||
{% assign next_url = paginator.next_page_path | relative_url %}
|
||||
{% else %}
|
||||
{% assign next_url = "#" %}
|
||||
{% endif %}
|
||||
<li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}">
|
||||
<a class="page-link btn-box-shadow" href="{{ next_url }}" aria-label="next-page">
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link btn-box-shadow" href="#"><i class="fas fa-angle-right"></i></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
</ul> <!-- .pagination -->
|
||||
</ul> <!-- .pagination -->
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
{% for share in site.data.share.platforms %}
|
||||
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
|
||||
<a href="{{ link }}" data-toggle="tooltip" data-placement="top"
|
||||
title="{{ share.type }}" target="_blank">
|
||||
title="{{ share.type }}" target="_blank" rel="noopener" aria-label="{{ share.type }}">
|
||||
<i class="fa-fw {{ share.icon }}"></i>
|
||||
</a>
|
||||
{% endfor %}
|
||||
@@ -25,4 +25,4 @@
|
||||
data-toggle="tooltip" data-placement="top" title="Copy link"></i>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
-->
|
||||
|
||||
<div id="nav-wrapper">
|
||||
|
||||
<div id="profile-wrapper" class="d-flex flex-column">
|
||||
<div id="avatar" class="d-flex justify-content-center">
|
||||
<a href="{{ site.baseurl }}/" alt="avatar">
|
||||
@@ -25,31 +26,25 @@
|
||||
</div>
|
||||
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- #profile-wrapper -->
|
||||
|
||||
<ul class="nav flex-column">
|
||||
{% assign page_urls = page.url | split: "/" %}
|
||||
|
||||
{% for item in site.data.tabs %}
|
||||
{% assign ref = site.baseurl | append: "/" %}
|
||||
|
||||
{% if item.path %}
|
||||
{% assign ref = ref | append: item.path | append: "/" %}
|
||||
{% if item.url %}
|
||||
{% assign ref = ref | append: item.url | append: "/" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<li class="nav-item d-flex justify-content-center
|
||||
{% if item.url == page_urls.last
|
||||
or item.name == page.tab_active
|
||||
or item.name == "Home" and page.layout == "home" %}active{% endif %}">
|
||||
<a href="{{ ref }}" class="nav-link d-flex justify-content-center align-items-center w-100">
|
||||
<i class="fa-fw {{ item.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
|
||||
<span>{{ item.name | upcase }}</span>
|
||||
<!-- home -->
|
||||
<li class="nav-item d-flex justify-content-center {% if page.layout == 'home' %}active{% endif %}">
|
||||
<a href="{{ '/' | relative_url }}" class="nav-link d-flex justify-content-center align-items-center w-100">
|
||||
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
|
||||
<span>{{ "HOME" }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- the real tabs -->
|
||||
{% for tab in site.tabs %}
|
||||
<li class="nav-item d-flex justify-content-center {% if tab.url == page.url %}active{% endif %}">
|
||||
<a href="{{ tab.url | relative_url }}" class="nav-link d-flex justify-content-center align-items-center w-100">
|
||||
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
|
||||
<span>{{ tab.title | upcase }}</span>
|
||||
</a>
|
||||
</li> <!-- .nav-item -->
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
</ul> <!-- ul.nav.flex-column -->
|
||||
|
||||
@@ -72,7 +67,7 @@
|
||||
https://twitter.com/{{ site.twitter.username }}
|
||||
{%- elsif entry.type == 'email' -%}
|
||||
{% assign email = site.social.email | split: '@' %}
|
||||
javascript:window.open('mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@'))
|
||||
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
|
||||
{%- elsif entry.type == 'rss' -%}
|
||||
{{ "/feed.xml" | relative_url }}
|
||||
{%- else -%}
|
||||
@@ -81,10 +76,10 @@
|
||||
{% endcapture %}
|
||||
|
||||
{% if url != '' %}
|
||||
<a href="{{ url }}" {% unless entry.noblank %}target="_blank"{% endunless %}>
|
||||
<a href="{{ url }}" aria-label="{{ entry.type }}" {% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
|
||||
<i class="{{ entry.icon }}"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,22 +29,23 @@
|
||||
<i id="sidebar-trigger" class="fas fa-bars fa-fw"></i>
|
||||
|
||||
<div id="topbar-title">
|
||||
{% if page.location %}
|
||||
{{- page.location -}}
|
||||
{% elsif page.layout == "home" %}
|
||||
{{- site.title -}}
|
||||
{% else %}
|
||||
{{- page.title -}}
|
||||
{% endif %}
|
||||
{% if page.layout == 'home' %}
|
||||
{{- site.title -}}
|
||||
{% elsif page.collection == 'tabs' %}
|
||||
{{- page.title -}}
|
||||
{% else %}
|
||||
{{- page.layout | capitalize -}}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<i id="search-trigger" class="fas fa-search fa-fw"></i>
|
||||
<span id="search-wrapper" class="align-items-center">
|
||||
<i class="fas fa-search fa-fw"></i>
|
||||
<input class="form-control" id="search-input" type="search" placeholder="{{ site.data.label.search_hint }}...">
|
||||
<input class="form-control" id="search-input" type="search"
|
||||
aria-label="search" placeholder="{{ site.data.label.search_hint }}...">
|
||||
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
|
||||
</span>
|
||||
<span id="search-cancel" >Cancel</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,24 +8,33 @@
|
||||
|
||||
{% assign MAX = 10 %}
|
||||
|
||||
{% capture tags_array %}
|
||||
{% for tag in site.tags %}
|
||||
{{ tag[1] | size }}::{{ tag[0] | replace: ' ', '-' }}
|
||||
{% endfor %}
|
||||
{% endcapture %}
|
||||
{% assign size_list = "" | split: "" %}
|
||||
{% assign tag_list = "" | split: "" %}
|
||||
|
||||
{% assign all_tags = tags_array | split: " " | sort | reverse %}
|
||||
{% assign count = 0 %}
|
||||
{% for tag in site.tags %}
|
||||
{% assign size = tag | last | size %}
|
||||
{% assign size_list = size_list | push: size %}
|
||||
|
||||
{% assign tag_str = tag | first | replace: " ", "-" | append: "::" | append: size %}
|
||||
{% assign tag_list = tag_list | push: tag_str %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign size_list = size_list | sort | reverse %}
|
||||
|
||||
{% assign tag_list = tag_list | sort_natural %}
|
||||
|
||||
{% assign trending_tags = "" | split: "" %}
|
||||
|
||||
{% for iter in all_tags %}
|
||||
{% assign count = count | plus: 1 %}
|
||||
{% assign tag = iter | split: "::" | last %}
|
||||
|
||||
{% assign trending_tags = trending_tags | push: tag %}
|
||||
|
||||
{% if count >= MAX %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% for size in size_list limit: MAX %}
|
||||
{% for tag_str in tag_list %}
|
||||
{% assign tag = tag_str | split: "::" %}
|
||||
{% assign tag_name = tag | first %}
|
||||
{% assign tag_size = tag | last | plus: 0 %}
|
||||
{% if tag_size == size %}
|
||||
{% unless trending_tags contains tag_name %}
|
||||
{% assign trending_tags = trending_tags | push: tag_name %}
|
||||
{% break %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
|
||||
{% assign all_list = "" | split: "" %}
|
||||
|
||||
{% for entry in site.data.updates %}
|
||||
{% capture elem %}
|
||||
{{- entry.lastmod -}}::{{- entry.filename -}}
|
||||
{% endcapture %}
|
||||
{% assign all_list = all_list | push: elem %}
|
||||
{% for post in site.posts %}
|
||||
{% if post.last_modified_at %}
|
||||
{% capture elem %}
|
||||
{{- post.last_modified_at | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
|
||||
{% endcapture %}
|
||||
{% assign all_list = all_list | push: elem %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign all_list = all_list | sort | reverse %}
|
||||
|
||||
@@ -10,11 +10,11 @@ layout: page
|
||||
<h1 class="pl-lg-2">
|
||||
<i class="far fa-folder-open fa-fw text-muted"></i>
|
||||
{{ page.title }}
|
||||
<span class="lead text-muted pl-2">{{ site.categories[page.category] | size }}</span>
|
||||
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
|
||||
</h1>
|
||||
|
||||
<ul class="post-content pl-0">
|
||||
{% for post in site.categories[page.category] %}
|
||||
{% for post in page.posts %}
|
||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
@@ -22,4 +22,4 @@ layout: page
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -48,12 +48,16 @@ layout: compress
|
||||
|
||||
<div id="mask"></div>
|
||||
|
||||
<a id="back-to-top" href="#" class="btn btn-lg btn-box-shadow" role="button">
|
||||
<a id="back-to-top" href="#" aria-label="back-to-top" class="btn btn-lg btn-box-shadow" role="button">
|
||||
<i class="fas fa-angle-up"></i>
|
||||
</a>
|
||||
|
||||
{% include search-loader.html %}
|
||||
|
||||
{% if site.google_analytics.id and jekyll.environment == 'production' %}
|
||||
{% include google-analytics.html %}
|
||||
{% endif %}
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -31,22 +31,10 @@ layout: default
|
||||
</div>
|
||||
|
||||
<!-- lastmod -->
|
||||
{%- capture filename -%}
|
||||
{{ page.url | split: "/" | last }}
|
||||
{%- endcapture -%}
|
||||
|
||||
{% 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 lastmod %}
|
||||
{% if page.last_modified_at %}
|
||||
<div>
|
||||
Updated
|
||||
{% include timeago.html date=lastmod class="lastmod" tooltip=true %}
|
||||
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -61,7 +49,6 @@ layout: default
|
||||
</div> <!-- .post-meta -->
|
||||
|
||||
<div class="post-content">
|
||||
|
||||
{%- capture img_placehodler -%}
|
||||
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
{% endcapture%}
|
||||
|
||||
@@ -11,10 +11,10 @@ layout: page
|
||||
<h1 class="pl-lg-2">
|
||||
<i class="fa fa-tag fa-fw text-muted"></i>
|
||||
{{ page.title }}
|
||||
<span class="lead text-muted pl-2">{{ site.tags[page.tag] | size }}</span>
|
||||
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
|
||||
</h1>
|
||||
<ul class="post-content pl-0">
|
||||
{% for post in site.tags[page.tag] %}
|
||||
{% for post in page.posts %}
|
||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
@@ -22,4 +22,4 @@ layout: page
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
11
_plugins/posts-lastmod-hook.rb
Normal file
11
_plugins/posts-lastmod-hook.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# Check for changed posts
|
||||
Jekyll::Hooks.register :posts, :post_init do |post|
|
||||
|
||||
commit_num = `git rev-list --count HEAD "#{ post.path }"`
|
||||
|
||||
if commit_num.to_i > 1
|
||||
lastmod_date = `git log -1 --pretty="%ad" --date=iso "#{ post.path }"`
|
||||
post.data['last_modified_at'] = lastmod_date
|
||||
end
|
||||
|
||||
end
|
||||
@@ -31,67 +31,13 @@ In order to accurately record the release date of a post, you should not only se
|
||||
|
||||
### Categories and Tags
|
||||
|
||||
The `categories` of each post is designed to contain up to two elements, and the number of elements in `tags` can be zero to infinity.
|
||||
|
||||
The list of posts belonging to the same *category*/*tag* is recorded on a separate page. At the same time, the number of these *category*/*tag* type pages is equal to the number of `categories` / `tags` elements for all posts, which means that the two number must be exactly the same.
|
||||
|
||||
For instance, let's say there is a post with front matter:
|
||||
The `categories` of each post is designed to contain up to two elements, and the number of elements in `tags` can be zero to infinity. For instance:
|
||||
|
||||
```yaml
|
||||
categories: [Animal, Insect]
|
||||
tags: bee
|
||||
tags: [bee]
|
||||
```
|
||||
|
||||
Then we should have two *category* type pages placed in folder `categories` of root and one *tag* type page placed in folder `tags` of root:
|
||||
|
||||
```sh
|
||||
.
|
||||
├── categories
|
||||
│ ├── animal.html # a category type page
|
||||
│ └── insect.html
|
||||
├── tags
|
||||
│ └── bee.html # a tag type page
|
||||
...
|
||||
```
|
||||
|
||||
and the content of a *category* type page is
|
||||
|
||||
```yaml
|
||||
---
|
||||
layout: category
|
||||
title: CATEGORY_NAME # e.g. Insect
|
||||
category: CATEGORY_NAME # e.g. Insect
|
||||
---
|
||||
```
|
||||
|
||||
the content of a *tag* type page is
|
||||
|
||||
```yaml
|
||||
---
|
||||
layout: tag
|
||||
title: TAG_NAME # e.g. bee
|
||||
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, the browser will complain to you "404 Not Found". The good news is we got a lovely script tool `_scripts/sh/create_pages.sh` to finish the boring tasks. Basically we will use it through `run.sh`, `build.sh` or `deploy.sh` that placed in `tools/` instead of running it separately. Check out its use case [here]({{ "/posts/getting-started/#deployment" | relative_url }}).
|
||||
|
||||
## Last modified date
|
||||
|
||||
The last modified date of a post is obtained according to the post's latest git commit date, and the modified date of all posts are designed to be stored in the file `_data/updates.yml`. Then contents of that file may be as follows:
|
||||
|
||||
```yaml
|
||||
-
|
||||
filename: getting-started # the post filename without date and extension
|
||||
lastmod: 2020-04-13 00:38:56 +0800 # the post last modified date
|
||||
-
|
||||
...
|
||||
```
|
||||
|
||||
You can choose to create this file manually, But the better approach is to let it be automatically generated by a script tool, and `_scripts/sh/dump_lastmod.sh` was born for this! Similar to the other script (`create_pages.sh`) mentioned above, it is also be called from the other superior tools, 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 posts.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
By default, the **T**able **o**f **C**ontents (TOC) is displayed on the right panel of the post. If you want to turn it off globally, go to `_config.yml` and set the value of variable `toc` to `false`. If you want to turn off TOC for specific post, add the following to post's [Front Matter](https://jekyllrb.com/docs/front-matter/):
|
||||
@@ -102,7 +48,6 @@ toc: false
|
||||
---
|
||||
```
|
||||
|
||||
|
||||
## Comments
|
||||
|
||||
Similar to TOC, the [Disqus](https://disqus.com/) comments is loaded by default in each post, and the global switch is defined by variable `comments` in file `_config.yml` . If you want to close the comment for specific post, add the following to the **Front Matter** of the post:
|
||||
@@ -113,7 +58,6 @@ comments: false
|
||||
---
|
||||
```
|
||||
|
||||
|
||||
## Mathematics
|
||||
|
||||
For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by:
|
||||
|
||||
@@ -18,7 +18,7 @@ $ git clone https://github.com/USERNAME/USERNAME.github.io.git -b master --singl
|
||||
|
||||
### Setting up the local envrionment
|
||||
|
||||
If you would like to run or build the project on your local machine, please follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems` and `Bundler`.
|
||||
If you would like to run or build the project on your local machine, please follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
|
||||
|
||||
Before running or building for the first time, please complete the installation of the Jekyll plugins. Go to the root directory of project and run:
|
||||
|
||||
@@ -28,32 +28,16 @@ $ bundle install
|
||||
|
||||
`bundle` will automatically install all the dependencies specified by `Gemfile`.
|
||||
|
||||
In order to generate some extra files (_categories_, _tags_ and _last modified list_), we need to use some tool scripts. And they require dependency package [yq](https://github.com/mikefarah/yq#install) to be installed. What's more, if your machine is running Debian or macOS, you also need to install [GNU coreutils](https://www.gnu.org/software/coreutils/).
|
||||
|
||||
- on Debian:
|
||||
|
||||
```console
|
||||
$ sudo apt-get install coreutils
|
||||
```
|
||||
|
||||
- on macOS:
|
||||
|
||||
```console
|
||||
$ brew install coreutils
|
||||
```
|
||||
|
||||
### Setting up Docker environment (optional)
|
||||
|
||||
If you're a loyal fan of [**Docker**](https://www.docker.com/) or just too lazy to install the packages mentioned in [_Setting up the local envrionment_](#setting-up-the-local-envrionment), please make sure you have **Docker Engine** installed and running, and then get Docker image `jekyll/jekyll` from Docker Hub by the following command:
|
||||
|
||||
```console
|
||||
$ docker pull jekyll/jekyll:latest
|
||||
$ docker pull jekyll/jekyll
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Running [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) requires some extra files, which cannot be generated by Jekyll native commands, so please strictly follow the methods mentioned below to run or deploy your website.
|
||||
|
||||
### Initialization
|
||||
|
||||
Go to the root directory of the project and start initialization:
|
||||
@@ -90,13 +74,11 @@ Generally, go to `_config.yml` and configure the variables as needed. Some of th
|
||||
You may want to preview the site contents before publishing, so just run it by:
|
||||
|
||||
```terminal
|
||||
$ bash tools/run.sh
|
||||
$ bundle exec jekyll s
|
||||
```
|
||||
|
||||
Then open a browser and visit to <http://localhost:4000>.
|
||||
|
||||
Few days later, you may find that the file changes does not refresh in real time by using `run.sh`. Don't worry, the advanced option `-r` (or `--realtime`) will solve this problem, but it requires [**fswatch**](http://emcrisostomo.github.io/fswatch/) to be installed on your machine.
|
||||
|
||||
### Run on Docker
|
||||
|
||||
Run the site on Docker with the following command:
|
||||
@@ -105,10 +87,9 @@ Run the site on Docker with the following command:
|
||||
$ docker run --rm -it \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
-p 4000:4000 jekyll/jekyll \
|
||||
bash tools/run.sh --docker
|
||||
jekyll serve
|
||||
```
|
||||
|
||||
Please note that on Docker containers, you'll lose the real-time refresh feature.
|
||||
|
||||
### Deployment
|
||||
|
||||
@@ -118,11 +99,11 @@ Assuming you have already gone through the [initialization](#initialization), yo
|
||||
|
||||
#### Deploy on GitHub Pages
|
||||
|
||||
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using tool scripts to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the Pages service.
|
||||
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the Pages service.
|
||||
|
||||
1. Push any commit to `origin/master` to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
|
||||
|
||||
2. Browse to your repository on GitHub and choose the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_:
|
||||
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_:
|
||||
{: width="650" class="normal"}
|
||||
|
||||
3. Visit your website at the address indicated by GitHub.
|
||||
@@ -134,18 +115,17 @@ On platforms other than GitHub, we cannot enjoy the convenience of **GitHub Acti
|
||||
Go to the root of the source project, build your site by:
|
||||
|
||||
```console
|
||||
$ bash tools/build.sh
|
||||
$ JEKYLL_ENV=production bundle exec jekyll b
|
||||
```
|
||||
|
||||
> **Note**: The output path can be specified with the option `-d`.
|
||||
|
||||
Or, build the site with Docker by:
|
||||
|
||||
```terminal
|
||||
$ docker run --rm -it \
|
||||
$ docker run -it --rm \
|
||||
--env JEKYLL_ENV=production \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
jekyll/jekyll \
|
||||
bash tools/build.sh --docker
|
||||
jekyll build
|
||||
```
|
||||
|
||||
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
|
||||
|
||||
@@ -22,6 +22,18 @@ Download the generated package, unzip and delete the following two from the extr
|
||||
- browserconfig.xml
|
||||
- manifest.json
|
||||
|
||||
Now, copy the rest image files (`.PNG` and `.ICO`) to cover the original one in folder `assets/img/favicons/`.
|
||||
Now, copy the remaining image files (`.PNG` and `.ICO`) from the extracted `.zip` file to cover the original files in the folder `assets/img/favicons/`.
|
||||
|
||||
Lastly, don't forget to rebuild your site so that the icon becomes your custom edition.
|
||||
The following table helps you understand the changes to the icon file:
|
||||
|
||||
> ✓ means keep, ✗ means delete.
|
||||
|
||||
| File(s) | From Favicon & App Icon Generator | From Chirpy |
|
||||
|---------------------|:---------------------------------:|:-----------:|
|
||||
| `*.PNG` | ✓ | ✗ |
|
||||
| `*.ICO` | ✓ | ✗ |
|
||||
| `browserconfig.xml` | ✗ | ✓ |
|
||||
| `manifest.json` | ✗ | ✓ |
|
||||
|
||||
|
||||
The next time you build the site, the icon will be replaced with a customized edition.
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Create HTML pages for Categories and Tags in posts.
|
||||
#
|
||||
# Usage:
|
||||
# Call from the '_posts' sibling directory.
|
||||
#
|
||||
# v2.2
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# Published under MIT License
|
||||
|
||||
set -eu
|
||||
|
||||
TYPE_CATEGORY=0
|
||||
TYPE_TAG=1
|
||||
|
||||
category_count=0
|
||||
tag_count=0
|
||||
|
||||
_read_yaml() {
|
||||
local _endline="$(grep -n "\-\-\-" "$1" | cut -d: -f 1 | sed -n '2p')"
|
||||
head -"$_endline" "$1"
|
||||
}
|
||||
|
||||
read_categories() {
|
||||
local _yaml="$(_read_yaml "$1")"
|
||||
local _categories="$(echo "$_yaml" | yq r - "categories.*")"
|
||||
local _category="$(echo "$_yaml" | yq r - "category")"
|
||||
|
||||
if [[ -n $_categories ]]; then
|
||||
echo "$_categories"
|
||||
elif [[ -n $_category ]]; then
|
||||
echo "$_category"
|
||||
fi
|
||||
}
|
||||
|
||||
read_tags() {
|
||||
local _yaml="$(_read_yaml "$1")"
|
||||
local _tags="$(echo "$_yaml" | yq r - "tags.*")"
|
||||
local _tag="$(echo "$_yaml" | yq r - "tag")"
|
||||
|
||||
if [[ -n $_tags ]]; then
|
||||
echo "$_tags"
|
||||
elif [[ -n $_tag ]]; then
|
||||
echo "$_tag"
|
||||
fi
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
if [[ -d categories ]]; then
|
||||
rm -rf categories
|
||||
fi
|
||||
|
||||
if [[ -d tags ]]; then
|
||||
rm -rf tags
|
||||
fi
|
||||
|
||||
if [[ ! -d _posts ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir categories tags
|
||||
}
|
||||
|
||||
create_category() {
|
||||
if [[ -n $1 ]]; then
|
||||
local _name=$1
|
||||
local _filepath="categories/$(echo "$_name" | sed 's/ /-/g' | awk '{print tolower($0)}').html"
|
||||
|
||||
if [[ ! -f $_filepath ]]; then
|
||||
echo "---" > "$_filepath"
|
||||
echo "layout: category" >> "$_filepath"
|
||||
echo "title: $_name" >> "$_filepath"
|
||||
echo "category: $_name" >> "$_filepath"
|
||||
echo "---" >> "$_filepath"
|
||||
|
||||
((category_count = category_count + 1))
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
create_tag() {
|
||||
if [[ -n $1 ]]; then
|
||||
local _name=$1
|
||||
local _filepath="tags/$(echo "$_name" | sed "s/ /-/g;s/'//g" | awk '{print tolower($0)}').html"
|
||||
|
||||
if [[ ! -f $_filepath ]]; then
|
||||
|
||||
echo "---" > "$_filepath"
|
||||
echo "layout: tag" >> "$_filepath"
|
||||
echo "title: $_name" >> "$_filepath"
|
||||
echo "tag: $_name" >> "$_filepath"
|
||||
echo "---" >> "$_filepath"
|
||||
|
||||
((tag_count = tag_count + 1))
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#########################################
|
||||
# Create HTML pages for Categories/Tags.
|
||||
# Arguments:
|
||||
# $1 - an array string
|
||||
# $2 - type specified option
|
||||
#########################################
|
||||
create_pages() {
|
||||
if [[ -n $1 ]]; then
|
||||
# split string to array
|
||||
IFS_BAK=$IFS
|
||||
IFS=$'\n'
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
init
|
||||
|
||||
for _file in $(find "_posts" -type f \( -iname \*.md -o -iname \*.markdown \)); do
|
||||
local _categories=$(read_categories "$_file")
|
||||
local _tags=$(read_tags "$_file")
|
||||
|
||||
create_pages "$_categories" $TYPE_CATEGORY
|
||||
create_pages "$_tags" $TYPE_TAG
|
||||
done
|
||||
|
||||
if [[ $category_count -gt 0 ]]; then
|
||||
echo "[INFO] Succeed! $category_count category-pages created."
|
||||
fi
|
||||
|
||||
if [[ $tag_count -gt 0 ]]; then
|
||||
echo "[INFO] Succeed! $tag_count tag-pages created."
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Find out the posts that have been modified and record
|
||||
# its lastmod information to file '_data/updates.yml'
|
||||
#
|
||||
# Usage:
|
||||
# Call from the '_posts' sibling directory.
|
||||
#
|
||||
# v2.2
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# Published under MIT License
|
||||
|
||||
set -eu
|
||||
|
||||
POST_DIR=_posts
|
||||
OUTPUT_DIR=_data
|
||||
OUTPUT_FILE=updates.yml
|
||||
|
||||
_init() {
|
||||
|
||||
if [[ ! -d "$OUTPUT_DIR" ]]; then
|
||||
mkdir "$OUTPUT_DIR"
|
||||
fi
|
||||
|
||||
if [[ -f "$OUTPUT_DIR/$OUTPUT_FILE" ]]; then
|
||||
rm -f "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
fi
|
||||
|
||||
if [[ ! -d $POST_DIR ]]; then
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
_has_changed() {
|
||||
local _log_count="$(git log --pretty=%ad "$1" | wc -l | sed 's/ *//')"
|
||||
_log_count=$((_log_count + 0))
|
||||
|
||||
if [[ $_log_count > 1 ]]; then
|
||||
return 0 # true
|
||||
fi
|
||||
|
||||
return 1 # false
|
||||
}
|
||||
|
||||
###################################
|
||||
# Storage the posts' lastmod.
|
||||
#
|
||||
# Args:
|
||||
# - $1 the post's filename
|
||||
# - $2 the post's filepath
|
||||
# Output:
|
||||
# the file '_data/updates.yml'
|
||||
###################################
|
||||
_dump() {
|
||||
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 " filename: '$1'" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
echo " lastmod: '$_lasmod'" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
_init
|
||||
|
||||
local _count=0
|
||||
|
||||
for _file in $(find ${POST_DIR} -type f \( -iname \*.md -o -iname \*.markdown \)); do
|
||||
_filename="$(basename "$_file" | sed 's/-\-\+/-/;s/[[:digit:]]\([[:digit:]]*-\)//g;s/\..*//')" # remove date and extension
|
||||
|
||||
if _has_changed "$_file"; then
|
||||
_dump "$_filename" "$_file"
|
||||
((_count = _count + 1))
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [[ $_count > 0 ]]; then
|
||||
echo "[INFO] Success to update lastmod for $_count post(s)."
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Files sync monitor
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# MIT Licensed
|
||||
|
||||
# $1 -> the origin file with absolute path.
|
||||
# $2 -> the origin sync directory
|
||||
# $3 -> the destination sync directory
|
||||
|
||||
# Omit the system temp file
|
||||
if [[ ! -f $1 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
src_dir="$(dirname "$(realpath "$1")")"
|
||||
|
||||
dir_prefix="$(realpath "$2")/"
|
||||
|
||||
related_dir="${src_dir:${#dir_prefix}}"
|
||||
|
||||
dest="$(realpath "$3")/${related_dir}"
|
||||
|
||||
if [[ ! -d $dest ]]; then
|
||||
mkdir -p "$dest"
|
||||
fi
|
||||
|
||||
if [[ -f $1 ]]; then
|
||||
cp "$1" "$dest"
|
||||
fi
|
||||
|
||||
if [[ $related_dir == "_posts" ]]; then
|
||||
bash "$3"/_scripts/sh/create_pages.sh
|
||||
bash "$3"/_scripts/sh/dump_lastmod.sh
|
||||
fi
|
||||
@@ -1,5 +1,7 @@
|
||||
---
|
||||
title: About
|
||||
icon: fas fa-info
|
||||
order: 4
|
||||
|
||||
# The About page
|
||||
# v2.0
|
||||
@@ -8,4 +10,5 @@ title: About
|
||||
# MIT License
|
||||
---
|
||||
|
||||
> **Note**: Add Markdown syntax content to file `tabs/about.md` and it will show up on this page.
|
||||
|
||||
> **Note**: Add Markdown syntax content to file `_tabs/about.md` and it will show up on this page.
|
||||
@@ -1,6 +1,8 @@
|
||||
---
|
||||
title: Archives
|
||||
type: archives
|
||||
icon: fas fa-archive
|
||||
order: 3
|
||||
|
||||
# The Archives of posts.
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
@@ -37,4 +39,4 @@ type: archives
|
||||
{% assign last_month = "" %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,8 @@
|
||||
---
|
||||
title: Categories
|
||||
type: categories
|
||||
icon: fas fa-stream
|
||||
order: 1
|
||||
|
||||
# All the Categories of posts
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
@@ -64,8 +66,9 @@ type: categories
|
||||
|
||||
<!-- arrow -->
|
||||
{% if sub_categories_size > 0%}
|
||||
<a href="#{{ LIST_PREFIX }}{{ group_index }}" data-toggle="collapse" aria-expanded="true"
|
||||
class="category-trigger hide-border-bottom">
|
||||
<a href="#{{ LIST_PREFIX }}{{ group_index }}" data-toggle="collapse"
|
||||
aria-expanded="true" aria-label="{{ HEAD_PREFIX }}{{ group_index }}-trigger"
|
||||
class="category-trigger hide-border-bottom">
|
||||
<i class="fas fa-fw fa-angle-down"></i>
|
||||
</a>
|
||||
{% else %}
|
||||
@@ -1,6 +1,8 @@
|
||||
---
|
||||
title: Tags
|
||||
type: tags
|
||||
icon: fas fa-tags
|
||||
order: 2
|
||||
|
||||
# All the Tags of posts.
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
@@ -64,7 +64,7 @@ body {
|
||||
|
||||
/*--- sidebar layout ---*/
|
||||
|
||||
$tab-count: {{ site.data.tabs | size }};
|
||||
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
|
||||
|
||||
$sidebar-display: "sidebar-display";
|
||||
|
||||
@@ -87,7 +87,7 @@ $sidebar-display: "sidebar-display";
|
||||
a {
|
||||
font-weight: 900;
|
||||
font-size: 1.5rem;
|
||||
letter-spacing: .5px;
|
||||
letter-spacing: 0.5px;
|
||||
&:hover {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
@@ -101,17 +101,17 @@ $sidebar-display: "sidebar-display";
|
||||
color: #828282;
|
||||
line-height: 1.2rem;
|
||||
word-spacing: 1px;
|
||||
margin: .5rem 1.5rem 2rem 1.5rem;
|
||||
margin: 0.5rem 1.5rem 2rem 1.5rem;
|
||||
}
|
||||
|
||||
.sidebar-bottom {
|
||||
.icon-border + a { // the icon behide mode-toggle
|
||||
margin-left: .1rem;
|
||||
margin-left: 0.1rem;
|
||||
}
|
||||
}
|
||||
.nav-link {
|
||||
border-radius: 0;
|
||||
font-size: .95rem;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
@@ -133,8 +133,8 @@ $sidebar-display: "sidebar-display";
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
|
||||
>li:last-child {
|
||||
>a {
|
||||
> li:last-child {
|
||||
> a {
|
||||
margin-right: -3px;
|
||||
max-width: calc(100% - 3px);
|
||||
}
|
||||
@@ -160,15 +160,15 @@ $sidebar-display: "sidebar-display";
|
||||
$top: -$offset * $tab-height + $tab-cursor-height / 2;
|
||||
|
||||
@if $i < $tab-count {
|
||||
>li.active:nth-child(#{$i}),
|
||||
>li.nav-item:nth-child(#{$i}):hover {
|
||||
> li.active:nth-child(#{$i}),
|
||||
> li.nav-item:nth-child(#{$i}):hover {
|
||||
~li:last-child::after {
|
||||
@include fix-cursor($top);
|
||||
}
|
||||
}
|
||||
} @else {
|
||||
>li.active:nth-child(#{$i}):last-child::after,
|
||||
>li.nav-item:nth-child(#{$i}):last-child:hover::after {
|
||||
> li.active:nth-child(#{$i}):last-child::after,
|
||||
> li.nav-item:nth-child(#{$i}):last-child:hover::after {
|
||||
@include fix-cursor($top);
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ $sidebar-display: "sidebar-display";
|
||||
font-size: 1.2rem;
|
||||
margin: 2rem 2.5rem 1.6rem;
|
||||
a {
|
||||
margin-bottom: .5rem; // icons may have multi lines
|
||||
margin-bottom: 0.5rem; // icons may have multi lines
|
||||
}
|
||||
|
||||
a:hover, #mode-toggle-wrapper > i:hover {
|
||||
@@ -204,7 +204,7 @@ $sidebar-display: "sidebar-display";
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
border-radius: 50%;
|
||||
margin-top: .75rem;
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
}
|
||||
} // #sidebar
|
||||
@@ -228,7 +228,7 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
#avatar {
|
||||
>a {
|
||||
> a {
|
||||
display: block;
|
||||
width: 6rem;
|
||||
height: 6rem;
|
||||
@@ -295,7 +295,7 @@ $sidebar-display: "sidebar-display";
|
||||
#breadcrumb {
|
||||
font-size: 1rem;
|
||||
color: gray;
|
||||
padding-left: .5rem;
|
||||
padding-left: 0.5rem;
|
||||
a:hover {
|
||||
@extend %link-hover;
|
||||
}
|
||||
@@ -323,7 +323,7 @@ $sidebar-display: "sidebar-display";
|
||||
padding: 0 .5rem;
|
||||
i {
|
||||
z-index: 2;
|
||||
font-size: .9rem;
|
||||
font-size: 0.9rem;
|
||||
color: var(--search-icon-color);
|
||||
}
|
||||
.fa-times-circle { /* button 'clean up' */
|
||||
@@ -341,7 +341,7 @@ $sidebar-display: "sidebar-display";
|
||||
background: center;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
padding: .18rem .3rem;
|
||||
padding: 0.18rem .3rem;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
@@ -366,12 +366,12 @@ $sidebar-display: "sidebar-display";
|
||||
font-size: 1rem;
|
||||
background: var(--search-tag-bg);
|
||||
border: none;
|
||||
padding: .5rem;
|
||||
padding: 0.5rem;
|
||||
margin: 0 1rem 1rem 0;
|
||||
&::before {
|
||||
content: "#";
|
||||
color: var(--text-muted-color);
|
||||
padding-right: .2rem;
|
||||
padding-right: 0.2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,17 +388,17 @@ $sidebar-display: "sidebar-display";
|
||||
@extend %link-hover;
|
||||
}
|
||||
}
|
||||
>div {
|
||||
> div {
|
||||
max-width: 100%;
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
i { // icons
|
||||
color: #818182;
|
||||
margin-right: .15rem;
|
||||
margin-right: 0.15rem;
|
||||
font-size: 80%;
|
||||
}
|
||||
>p {
|
||||
> p {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
@@ -476,13 +476,13 @@ footer {
|
||||
font-size: 0.8rem;
|
||||
color: #7a7b7d;
|
||||
background-color: var(--footer-bg-color);
|
||||
>div.d-flex {
|
||||
> div.d-flex {
|
||||
line-height: 1.2rem;
|
||||
width: 95%;
|
||||
max-width: 1045px;
|
||||
border-top: 1px solid var(--main-border-color);
|
||||
margin-bottom: 1rem;
|
||||
>div {
|
||||
> div {
|
||||
width: 350px;
|
||||
}
|
||||
}
|
||||
@@ -516,29 +516,24 @@ footer {
|
||||
&.topbar-down {
|
||||
top: 6rem;
|
||||
}
|
||||
>div {
|
||||
> div {
|
||||
padding-left: 1rem;
|
||||
border-left: 1px solid var(--main-border-color);
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 4rem;
|
||||
}
|
||||
}
|
||||
h3 {
|
||||
padding-top: .5rem;
|
||||
padding-bottom: .5rem;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
letter-spacing: -0.02em;
|
||||
@include label(inherit, 600);
|
||||
span {
|
||||
@include panel-label;
|
||||
}
|
||||
.post-content {
|
||||
font-size: .9rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#access-tags {
|
||||
>div.post-content > div {
|
||||
> div.post-content > div {
|
||||
max-width: 80%;
|
||||
}
|
||||
.post-tag {
|
||||
@@ -547,8 +542,8 @@ footer {
|
||||
font-size: 0.85rem;
|
||||
background: none;
|
||||
border: 1px solid var(--btn-border-color);
|
||||
border-radius: .8rem;
|
||||
padding: .3rem .5rem;
|
||||
border-radius: 0.8rem;
|
||||
padding: 0.3rem .5rem;
|
||||
margin: 0 .35rem .5rem 0;
|
||||
&:hover {
|
||||
background-color: #2a408e;
|
||||
@@ -561,7 +556,7 @@ footer {
|
||||
|
||||
#access-lastmod {
|
||||
ul {
|
||||
>li {
|
||||
> li {
|
||||
height: 1.8rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -664,12 +659,12 @@ sup {
|
||||
}
|
||||
|
||||
.footnotes ol {
|
||||
margin-top: .5rem;
|
||||
>li {
|
||||
padding-top: .2rem;
|
||||
margin-top: 0.5rem;
|
||||
> li {
|
||||
padding-top: 0.2rem;
|
||||
margin-top: -0.2rem;
|
||||
>p {
|
||||
padding-left: .2em;
|
||||
> p {
|
||||
padding-left: 0.2em;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
margin-bottom: -.8rem;
|
||||
@@ -699,11 +694,11 @@ sup {
|
||||
|
||||
.reversefootnote {
|
||||
@at-root a#{&} {
|
||||
font-size: .6rem;
|
||||
font-size: 0.6rem;
|
||||
position: absolute;
|
||||
line-height: 1;
|
||||
padding-top: .5em;
|
||||
margin-left: .5em;
|
||||
padding-top: 0.5em;
|
||||
margin-left: 0.5em;
|
||||
border-bottom-style: none !important;
|
||||
}
|
||||
}
|
||||
@@ -742,7 +737,7 @@ img {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
em { /* MarkDown italic */
|
||||
padding-right: .2rem;
|
||||
padding-right: 0.2rem;
|
||||
}
|
||||
a:hover {
|
||||
code {
|
||||
@@ -756,7 +751,7 @@ img {
|
||||
div.post-content .table-wrapper {
|
||||
overflow-x: auto;
|
||||
|
||||
>table {
|
||||
> table {
|
||||
min-width: 60%;
|
||||
overflow-x: auto;
|
||||
border-spacing: 0;
|
||||
@@ -817,8 +812,8 @@ div.post-content .table-wrapper {
|
||||
word-wrap: break-word;
|
||||
|
||||
@mixin img($caption: false) {
|
||||
>img:not([style]) {
|
||||
margin: .5rem 0;
|
||||
> img:not([style]) {
|
||||
margin: 0.5rem 0;
|
||||
|
||||
&:not(.normal):not(.left):not(.right) {
|
||||
@include align-center;
|
||||
@@ -830,12 +825,12 @@ div.post-content .table-wrapper {
|
||||
|
||||
&.left {
|
||||
float: left;
|
||||
margin: .75rem 1rem 1rem 0;
|
||||
margin: 0.75rem 1rem 1rem 0;
|
||||
}
|
||||
|
||||
&.right {
|
||||
float: right;
|
||||
margin: .75rem 0 1rem 1rem;
|
||||
margin: 0.75rem 0 1rem 1rem;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -881,12 +876,12 @@ div.post-content .table-wrapper {
|
||||
min-width: 2rem;
|
||||
text-align: center;
|
||||
background: var(--tag-bg);
|
||||
border-radius: .3rem;
|
||||
border-radius: 0.3rem;
|
||||
padding: 0 .4rem;
|
||||
color: inherit;
|
||||
line-height: 1.3rem;
|
||||
&:not(:last-child) {
|
||||
margin-right: .2rem;
|
||||
margin-right: 0.2rem;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
@@ -947,7 +942,7 @@ div.post-content .table-wrapper {
|
||||
}
|
||||
|
||||
.tooltip-inner { /* Overrided BS4 Tooltip */
|
||||
font-size: .7rem;
|
||||
font-size: 0.7rem;
|
||||
max-width: 220px;
|
||||
text-align: left;
|
||||
}
|
||||
@@ -1010,10 +1005,10 @@ div.post-content .table-wrapper {
|
||||
|
||||
footer {
|
||||
height: $footer-height;
|
||||
>div.d-flex {
|
||||
> div.d-flex {
|
||||
width: 100%;
|
||||
padding: 1.5rem 0;
|
||||
margin-bottom: .3rem;
|
||||
margin-bottom: 0.3rem;
|
||||
flex-wrap: wrap;
|
||||
justify-content: left!important;
|
||||
-ms-flex-pack: distribute!important;
|
||||
@@ -1340,14 +1335,14 @@ div.post-content .table-wrapper {
|
||||
|
||||
#main > div.row {
|
||||
padding-left: calc((100% - #{$main-content-max-width}) / 2);
|
||||
>div.col-xl-8 {
|
||||
> div.col-xl-8 {
|
||||
max-width: 850px;
|
||||
}
|
||||
}
|
||||
|
||||
#search-result-wrapper {
|
||||
padding-right: 2rem;
|
||||
>div {
|
||||
> div {
|
||||
max-width: 1110px;
|
||||
}
|
||||
}
|
||||
@@ -1372,8 +1367,8 @@ div.post-content .table-wrapper {
|
||||
|
||||
#main > div.row > div.col-xl-8 {
|
||||
padding-left: 0;
|
||||
>div:first-child {
|
||||
padding-left: .55rem !important;
|
||||
> div:first-child {
|
||||
padding-left: 0.55rem !important;
|
||||
padding-right: 1.9rem !important;
|
||||
}
|
||||
}
|
||||
@@ -1406,14 +1401,14 @@ div.post-content .table-wrapper {
|
||||
-webkit-box-pack: normal !important;
|
||||
-ms-flex-pack: normal !important;
|
||||
justify-content: normal !important;
|
||||
>a {
|
||||
> a {
|
||||
width: 6.2rem;
|
||||
height: 6.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.profile-text {
|
||||
margin-left: .5rem;
|
||||
margin-left: 0.5rem;
|
||||
/* .d-flex */
|
||||
display: -webkit-box!important;
|
||||
display: -ms-flexbox!important;
|
||||
@@ -1424,7 +1419,7 @@ div.post-content .table-wrapper {
|
||||
/* .align-content-center */
|
||||
-ms-flex-line-pack: center!important;
|
||||
align-content: center!important;
|
||||
>div {
|
||||
> div {
|
||||
text-align: left !important;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -1442,12 +1437,12 @@ div.post-content .table-wrapper {
|
||||
|
||||
.site-subtitle {
|
||||
word-spacing: 0;
|
||||
margin: .3rem 0 0 0;
|
||||
margin: 0.3rem 0 0 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-left: 3%;
|
||||
>li > a {
|
||||
> li > a {
|
||||
padding-left: 2.5rem;
|
||||
-webkit-box-pack: start!important;
|
||||
-ms-flex-pack: start!important;
|
||||
@@ -1456,14 +1451,14 @@ div.post-content .table-wrapper {
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
>span {
|
||||
> span {
|
||||
letter-spacing: 3px;
|
||||
}
|
||||
>i {
|
||||
> i {
|
||||
@include icon-round(1.65rem);
|
||||
line-height: 1rem;
|
||||
font-size: .6rem;
|
||||
padding: .5em 0 0 .1em;
|
||||
font-size: 0.6rem;
|
||||
padding: 0.5em 0 0 .1em;
|
||||
display: inline-block!important;
|
||||
}
|
||||
}
|
||||
@@ -1482,22 +1477,22 @@ div.post-content .table-wrapper {
|
||||
i {
|
||||
text-align: center;
|
||||
width: 1.25em;
|
||||
padding-top: .44rem;
|
||||
padding-top: 0.44rem;
|
||||
}
|
||||
}
|
||||
|
||||
#mode-toggle-wrapper {
|
||||
font-size: .9rem;
|
||||
font-size: 0.9rem;
|
||||
i {
|
||||
@include icon-round(2rem);
|
||||
padding-top: .44rem;
|
||||
padding-top: 0.44rem;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-border {
|
||||
@include ml-mr(.2rem);
|
||||
margin-top: .85rem;
|
||||
margin-top: 0.85rem;
|
||||
+a {
|
||||
margin-left: 0;
|
||||
}
|
||||
@@ -1511,7 +1506,7 @@ div.post-content .table-wrapper {
|
||||
|
||||
#search-result-wrapper {
|
||||
width: calc(100% - #{$sidebar-width-large});
|
||||
>div {
|
||||
> div {
|
||||
max-width: #{$main-content-max-width};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,17 @@
|
||||
font-family: 'Roboto Condensed', 'Microsoft Yahei', sans-serif;
|
||||
}
|
||||
|
||||
@mixin panel-label {
|
||||
@include label(inherit);
|
||||
display: block;
|
||||
line-height: 1.2;
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
@mixin align-center {
|
||||
position: relative;
|
||||
left: 50%;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
background-image: linear-gradient(
|
||||
to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
|
||||
}
|
||||
>div {
|
||||
> div {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -111,12 +111,12 @@
|
||||
} // #archives .date
|
||||
|
||||
ul {
|
||||
>li {
|
||||
>div>a {
|
||||
> li {
|
||||
> div > a {
|
||||
/* post title in Archvies */
|
||||
margin-left: 2.5rem;
|
||||
position: relative;
|
||||
top: .1rem;
|
||||
top: 0.1rem;
|
||||
}
|
||||
&::after {
|
||||
@extend %date-timeline;
|
||||
@@ -129,10 +129,10 @@
|
||||
top: -1.61rem;
|
||||
}
|
||||
}
|
||||
&:not(:last-child)>li:last-child::after {
|
||||
&:not(:last-child) > li:last-child::after {
|
||||
height: 3.4rem;
|
||||
}
|
||||
&:last-child>li:last-child::after {
|
||||
&:last-child > li:last-child::after {
|
||||
display: none;
|
||||
}
|
||||
} // #archives ul
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
padding-left: 2rem;
|
||||
>i {
|
||||
> i {
|
||||
@extend %category-icon-color;
|
||||
}
|
||||
&:first-child {
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
}
|
||||
|
||||
.card-header>span>i:first-child {
|
||||
.card-header > span > i:first-child {
|
||||
@extend %category-icon-color;
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
color: #6c757d!important;
|
||||
>i.fas {
|
||||
> i.fas {
|
||||
position: relative;
|
||||
height: .7rem;
|
||||
height: 0.7rem;
|
||||
width: 1rem;
|
||||
transition: 300ms ease all;
|
||||
}
|
||||
@@ -68,4 +68,4 @@
|
||||
-ms-transform: rotate(-90deg); /* IE 9 */
|
||||
-webkit-transform: rotate(-90deg); /* Safari 3-8 */
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
{% include_relative _addon/main.scss %}
|
||||
|
||||
#page-category, #page-tag {
|
||||
ul>li {
|
||||
ul > li {
|
||||
line-height: 1.5rem;
|
||||
padding: .6rem 0;
|
||||
padding: 0.6rem 0;
|
||||
&::before { // dot
|
||||
background: #999;
|
||||
width: 5px;
|
||||
@@ -21,25 +21,25 @@
|
||||
display: block;
|
||||
content: "";
|
||||
position: relative;
|
||||
top: .6rem;
|
||||
margin-right: .5rem;
|
||||
top: 0.6rem;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
>a { /* post's title */
|
||||
> a { /* post's title */
|
||||
font-size: 1.1rem;
|
||||
@extend %no-bottom-border;
|
||||
}
|
||||
>span:last-child {
|
||||
> span:last-child {
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* post's date */
|
||||
}
|
||||
}
|
||||
|
||||
#page-tag h1>i { // tag icon
|
||||
#page-tag h1 > i { // tag icon
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
#page-category h1>i {
|
||||
#page-category h1 > i {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
@@ -59,15 +59,15 @@ a:hover {
|
||||
|
||||
@media all and (max-width: 576px) {
|
||||
#page-category, #page-tag {
|
||||
ul>li {
|
||||
ul > li {
|
||||
&::before {
|
||||
margin: 0 .5rem;
|
||||
}
|
||||
>a {
|
||||
> a {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#post-list {
|
||||
margin-top: 1rem;
|
||||
padding-right: .5rem;
|
||||
padding-right: 0.5rem;
|
||||
|
||||
.post-preview {
|
||||
padding-top: 1.5rem;
|
||||
@@ -21,13 +21,13 @@
|
||||
font-size: 1.4rem;
|
||||
margin: 0;
|
||||
~i { // pinned icon
|
||||
font-size: .86rem;
|
||||
font-size: 0.86rem;
|
||||
}
|
||||
}
|
||||
|
||||
.post-meta {
|
||||
i {
|
||||
font-size: .73rem;
|
||||
font-size: 0.73rem;
|
||||
&:not(:first-child) { // post-meta icons on the homepage
|
||||
margin-left: 1.5rem;
|
||||
}
|
||||
@@ -35,8 +35,8 @@
|
||||
}
|
||||
|
||||
.post-content {
|
||||
margin-top: .6rem;
|
||||
margin-bottom: .6rem;
|
||||
margin-top: 0.6rem;
|
||||
margin-bottom: 0.6rem;
|
||||
color: var(--post-list-text-color);
|
||||
>p {
|
||||
/* Make preview shorter on the homepage */
|
||||
@@ -128,7 +128,7 @@
|
||||
}
|
||||
|
||||
.pagination {
|
||||
font-size: .85rem;
|
||||
font-size: 0.85rem;
|
||||
.page-item .page-link {
|
||||
width: 2.2rem;
|
||||
height: 2.2rem;
|
||||
@@ -142,4 +142,4 @@
|
||||
#post-list {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,20 +89,20 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
p {
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.5rem;
|
||||
margin-top: .3rem;
|
||||
margin-top: 0.3rem;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
a, span {
|
||||
&::before {
|
||||
color: var(--text-muted-color);
|
||||
font-size: .65rem;
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
&:first-child {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
left: .5px;
|
||||
left: 0.5px;
|
||||
&::before {
|
||||
content: $prompt-older
|
||||
}
|
||||
@@ -110,7 +110,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
&:last-child {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
right: .5px;
|
||||
right: 0.5px;
|
||||
&::before {
|
||||
content: $prompt-newer
|
||||
}
|
||||
@@ -132,7 +132,6 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
}
|
||||
|
||||
#toc-wrapper {
|
||||
margin-top: 7rem;
|
||||
border-left: 1px solid rgba(158, 158, 158, 0.17);
|
||||
position: -webkit-sticky;
|
||||
position: sticky;
|
||||
@@ -142,15 +141,15 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
&.topbar-down {
|
||||
top: 6rem;
|
||||
}
|
||||
>h3 {
|
||||
@include label(inherit, 600);
|
||||
> span {
|
||||
@include panel-label;
|
||||
}
|
||||
}
|
||||
|
||||
#toc li>a {
|
||||
line-height: 1rem;
|
||||
padding-top: .5rem;
|
||||
padding-bottom: .5rem;
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +172,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
&:hover {
|
||||
-webkit-transform: translate3d(0, -3px, 0);
|
||||
transform: translate3d(0, -3px, 0);
|
||||
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
|
||||
box-shadow: 0 20px 35px -4px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,8 +181,8 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: .9rem;
|
||||
margin-bottom: .5rem;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 0.5rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
@@ -234,7 +233,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
font-size: 1.2rem;
|
||||
a {
|
||||
&:not(:last-child) {
|
||||
margin-right: .25rem;
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
@@ -244,7 +243,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
}
|
||||
}
|
||||
>i {
|
||||
padding-top: .35rem;
|
||||
padding-top: 0.35rem;
|
||||
&:hover {
|
||||
@extend %btn-share-hovor;
|
||||
}
|
||||
@@ -292,7 +291,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
font-weight: 400;
|
||||
}
|
||||
span:last-child {
|
||||
font-size: .85rem;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
} // .license-wrapper
|
||||
|
||||
@@ -321,8 +320,8 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
content: "\2022";
|
||||
color: rgba(158, 158, 158, 0.8);
|
||||
font-weight: bold;
|
||||
padding-left: .5rem;
|
||||
padding-right: .3rem;
|
||||
padding-left: 0.5rem;
|
||||
padding-right: 0.3rem;
|
||||
}
|
||||
&.flex-column {
|
||||
-webkit-box-orient: horizontal!important;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
.tag {
|
||||
border-radius: 0.7em;
|
||||
padding: 6px 8px 7px;
|
||||
margin-right: .8rem;
|
||||
margin-right: 0.8rem;
|
||||
line-height: 3rem;
|
||||
letter-spacing: 0;
|
||||
border: 1px solid var(--tag-border) !important;
|
||||
@@ -22,4 +22,4 @@
|
||||
font-size: 0.7em;
|
||||
font-family: 'Oswald', sans-serif;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,34 +40,6 @@ const include = [
|
||||
'{{ item | relative_url }}',
|
||||
{% endfor %}
|
||||
|
||||
/* The posts of first Home page and recent update list */
|
||||
{% assign post_list = "" | split: "" %}
|
||||
|
||||
{% for post in site.posts limit: site.paginate %}
|
||||
{% capture post_url %}{{ post.url | relative_url }}{% endcapture %}
|
||||
{% assign post_list = post_list | push: post_url %}
|
||||
{% endfor %}
|
||||
|
||||
{% include update-list.html %}
|
||||
|
||||
{% for item in update_list %}
|
||||
{% assign url = item | split: "::" | last | url_encode | prepend: "/posts/" | append: "/" | relative_url %}
|
||||
{% assign post_list = post_list | push: url %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign post_list = post_list | uniq %}
|
||||
|
||||
{% for url in post_list %}
|
||||
'{{ url }}',
|
||||
{% endfor %}
|
||||
|
||||
/* Trending tags */
|
||||
{% include trending-tags.html %}
|
||||
{% for tag in trending_tags %}
|
||||
{% capture tag_url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
||||
'{{ tag_url | relative_url }}',
|
||||
{% endfor %}
|
||||
|
||||
/*--- Icons ---*/
|
||||
|
||||
{%- capture icon_url -%}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Chirpy
|
||||
|
||||
🌏 [English](../README.md) • 简体中文
|
||||
Language: [English](../README.md) | 简体中文
|
||||
|
||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
|
||||
[](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
|
||||
@@ -51,7 +51,7 @@ $ git clone https://github.com/USERNAME/USERNAME.github.io.git -b master --singl
|
||||
|
||||
### 设置本地环境
|
||||
|
||||
如果你想在本地运行或构建, 参考 [Jekyll Docs](https://jekyllrb.com/docs/installation/)安装 `Ruby`, `RubyGems` 和 `Bundler`。
|
||||
如果你想在本地运行或构建, 参考 [Jekyll Docs](https://jekyllrb.com/docs/installation/)安装 `Ruby`,`RubyGems`,`Jekyll` 和 `Bundler`。
|
||||
|
||||
首次运行或构建时, 请先安装 Jekyll plugins。在项目根目录运行:
|
||||
|
||||
@@ -61,24 +61,17 @@ $ bundle install
|
||||
|
||||
`bundle` 会自动安装 `Gemfile` 内指定的依赖插件。
|
||||
|
||||
为了生成一些额外的文件(Post 的 _分类_、_标签_ 以及 _更新时间列表_),需要用到一些脚本工具。而它们需要安装依赖包 [yq](https://github.com/mikefarah/yq#install)。另外,如果你电脑的操作系统是 Debian 或者 macOS,还需安装 [GNU coreutils](https://www.gnu.org/software/coreutils/):
|
||||
### 配置 Docker 镜像(可选)
|
||||
|
||||
- Debian
|
||||
如果你是 [**Docker**](https://www.docker.com/) 的铁粉,或者不想在本地安装上述 [_设置本地环境_](#设置本地环境) 提到的包, 那么请确保先安装并运行了 **Docker Engine** 然后从 Docker Hub 获取镜像 `jekyll/jekyll`:
|
||||
|
||||
```console
|
||||
$ sudo apt-get install coreutils
|
||||
```
|
||||
```console
|
||||
$ docker pull jekyll/jekyll
|
||||
```
|
||||
|
||||
- macOS
|
||||
|
||||
```console
|
||||
$ brew install coreutils
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
运行 [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) 需要一些额外的文件, 它们不能通过 Jekyll 原生的命令生成,所以请严格依照下列说明去运行或部署此项目。
|
||||
|
||||
### 初始化
|
||||
|
||||
在项目根目录,开始初始化:
|
||||
@@ -112,15 +105,24 @@ $ bash tools/init.sh
|
||||
|
||||
### 本地运行
|
||||
|
||||
使用以下工具可轻松运行:
|
||||
发布之前,在本地预览:
|
||||
|
||||
```terminal
|
||||
$ bash tools/run.sh
|
||||
$ bundle exec jekyll s
|
||||
```
|
||||
|
||||
访问本地服务: <http://localhost:4000>
|
||||
|
||||
如果你想在本地服务运行后,把修改源文件的更改实时刷新,可使用选项 `-r` (或 `--realtime`),不过要先安装依赖 [**fswatch**](http://emcrisostomo.github.io/fswatch/) 。
|
||||
### 用 Docker 运行
|
||||
|
||||
在项目根目录运行命令:
|
||||
|
||||
```terminal
|
||||
$ docker run -it --rm \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
-p 4000:4000 jekyll/jekyll \
|
||||
jekyll serve
|
||||
```
|
||||
|
||||
### 部署
|
||||
|
||||
@@ -130,7 +132,7 @@ $ bash tools/run.sh
|
||||
|
||||
#### 部署到 GitHub Pages
|
||||
|
||||
由于安全原因,GitHub Pages 的构建强制加了 `safe`参数,这导致了我们不能使用脚本工具去创建所需的附加页面。因此,我们可以使用 GitHub Actions 去构建站点,把站点文件存储在一个新分支上,再指定该分支作为 Pages 服务的源。
|
||||
由于安全原因,GitHub Pages 的构建强制加了 `safe`参数,这导致了我们不能使用插件去创建所需的附加页面。因此,我们可以使用 GitHub Actions 去构建站点,把站点文件存储在一个新分支上,再指定该分支作为 Pages 服务的源。
|
||||
|
||||
1. 推送任意一个 commit 到 `origin/master` 以触发 GitHub Actions workflow。一旦 build 完毕并且成功,远端将会自动出现一个新分支 `gh-pages` 用来存储构建的站点文件。
|
||||
|
||||
@@ -147,10 +149,20 @@ $ bash tools/run.sh
|
||||
在项目根目录,运行:
|
||||
|
||||
```console
|
||||
$ bash tools/build.sh -d /path/to/site/
|
||||
$ JEKYLL_ENV=production bundle exec jekyll b
|
||||
```
|
||||
|
||||
生成的静态文件将会在 `/path/to/site/`, 把内部的文件上传到服务器即可。
|
||||
或者通过 Docker 构建:
|
||||
|
||||
```terminal
|
||||
$ docker run -it --rm \
|
||||
--env JEKYLL_ENV=production \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
jekyll/jekyll \
|
||||
jekyll build
|
||||
```
|
||||
|
||||
生成的静态文件将会在 `_site`, 把内部的文件上传到服务器即可。
|
||||
|
||||
### 文档
|
||||
|
||||
|
||||
8
feed.xml
8
feed.xml
@@ -30,10 +30,10 @@ layout: compress
|
||||
<title>{{ post.title }}</title>
|
||||
<link href="{{ post_absolute_url }}" rel="alternate" type="text/html" title="{{ post.title }}" />
|
||||
<published>{{ post.date | date_to_xmlschema }}</published>
|
||||
{% if post.seo.date_modified %}
|
||||
<updated>{{ post.seo.date_modified | date_to_xmlschema }}</updated>
|
||||
{% if post.lastmod %}
|
||||
<updated>{{ post.lastmod | date_to_xmlschema }}</updated>
|
||||
{% else %}
|
||||
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
||||
<updated>{{ post.date | date_to_xmlschema }}</updated>
|
||||
{% endif %}
|
||||
<id>{{ post_absolute_url }}</id>
|
||||
<content src="{{ post_absolute_url }}" />
|
||||
@@ -60,4 +60,4 @@ layout: compress
|
||||
{% endfor %}
|
||||
</feed>
|
||||
{% endcapture %}
|
||||
{{ source | replace: '&', '&' }}
|
||||
{{ source | replace: '&', '&' }}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
---
|
||||
layout: home
|
||||
breadcrumb:
|
||||
-
|
||||
label: Posts
|
||||
|
||||
# Index page
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
---
|
||||
|
||||
91
sitemap.xml
91
sitemap.xml
@@ -1,91 +0,0 @@
|
||||
---
|
||||
layout: compress
|
||||
|
||||
# The Sitemap template
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
|
||||
{% for post in site.posts %}
|
||||
<url>
|
||||
<loc>{{ site.url | append: site.baseurl | append: post.url }}</loc>
|
||||
<lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
|
||||
|
||||
{% if post.sitemap.changefreq %}
|
||||
<changefreq>{{ post.sitemap.changefreq }}</changefreq>
|
||||
{% else %}
|
||||
<changefreq>monthly</changefreq>
|
||||
{% endif %}
|
||||
|
||||
{% if post.sitemap.priority %}
|
||||
<priority>{{ post.sitemap.priority }}</priority>
|
||||
{% else %}
|
||||
<priority>0.5</priority>
|
||||
{% endif %}
|
||||
</url>
|
||||
{% endfor %}
|
||||
|
||||
{% for page in site.pages %}
|
||||
|
||||
{% assign pass = false %}
|
||||
|
||||
{% for fuzzy in site.sitemap_exclude.fuzzy %}
|
||||
{% if page.url contains fuzzy %}
|
||||
{% assign pass = true %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% unless pass %}
|
||||
{% for accurate in site.sitemap_exclude.accurate %}
|
||||
{% assign len = accurate | size %}
|
||||
{% capture beg %}{{ 0 | minus: len }}{% endcapture %}
|
||||
{% capture tail %}{{ page.url | slice: beg, len }}{% endcapture %}
|
||||
|
||||
{% if tail == accurate %}
|
||||
{% assign pass = true %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endunless %}
|
||||
|
||||
{% if pass %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% capture lastmod %}
|
||||
{% if page.lastmod %}
|
||||
{{ page.lastmod }}
|
||||
{% elsif page.date %}
|
||||
{{ page.date }}
|
||||
{% else %}
|
||||
{{ site.time }}
|
||||
{% endif %}
|
||||
{% endcapture %}
|
||||
|
||||
<url>
|
||||
<loc>{{ site.url | append: site.baseurl | append: page.url | remove: "index.html" }}</loc>
|
||||
<lastmod>{{ lastmod | date_to_xmlschema }}</lastmod>
|
||||
|
||||
{% if page.sitemap.changefreq %}
|
||||
<changefreq>{{ page.sitemap.changefreq }}</changefreq>
|
||||
{% else %}
|
||||
<changefreq>monthly</changefreq>
|
||||
{% endif %}
|
||||
|
||||
{% if page.sitemap.priority %}
|
||||
<priority>{{ page.sitemap.priority }}</priority>
|
||||
{% else %}
|
||||
<priority>0.3</priority>
|
||||
{% endif %}
|
||||
</url>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</urlset>
|
||||
4
sw.js
4
sw.js
@@ -13,8 +13,10 @@ var cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M" }}';
|
||||
|
||||
|
||||
function isExcluded(url) {
|
||||
const regex = /(^http(s)?|^\/)/; /* the regex for CORS url or relative url */
|
||||
for (const rule of exclude) {
|
||||
if (url.indexOf(rule) != -1) {
|
||||
if (!regex.test(url) ||
|
||||
url.indexOf(rule) != -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
147
tools/build.sh
147
tools/build.sh
@@ -1,147 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Build jekyll site and store site files in ./_site
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# Published under MIT License
|
||||
|
||||
set -eu
|
||||
|
||||
WORK_DIR="$(dirname "$(dirname "$(realpath "$0")")")"
|
||||
|
||||
CONTAINER="${WORK_DIR}/.container"
|
||||
|
||||
dest="${WORK_DIR}/_site"
|
||||
|
||||
cmd="JEKYLL_ENV=production bundle exec jekyll b"
|
||||
|
||||
docker=false
|
||||
|
||||
config=""
|
||||
|
||||
_help() {
|
||||
echo "Usage:"
|
||||
echo
|
||||
echo " bash build.sh [options]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -b, --baseurl <URL> The site relative url that start with slash, e.g. '/project'"
|
||||
echo " -h, --help Print the help information"
|
||||
echo " -d, --destination <DIR> destination directory (defaults to ./_site)"
|
||||
echo " --docker Build site within docker"
|
||||
echo " --config <CONFIG_a[,CONFIG_b]> Specify config files"
|
||||
}
|
||||
|
||||
_install_tools() {
|
||||
# docker image `jekyll/jekyll` based on Alpine Linux
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
|
||||
apk update
|
||||
apk add yq
|
||||
}
|
||||
|
||||
_init() {
|
||||
cd "$WORK_DIR"
|
||||
|
||||
if [[ -f Gemfile.lock ]]; then
|
||||
rm -f Gemfile.lock
|
||||
fi
|
||||
|
||||
if [[ -d $CONTAINER ]]; then
|
||||
rm -rf "$CONTAINER"
|
||||
fi
|
||||
|
||||
if [[ -d $dest ]]; then
|
||||
bundle exec jekyll clean
|
||||
fi
|
||||
|
||||
local _temp="$(mktemp -d)"
|
||||
cp -r ./* "$_temp"
|
||||
cp -r ./.git "$_temp"
|
||||
mv "$_temp" "$CONTAINER"
|
||||
}
|
||||
|
||||
_build() {
|
||||
cd "$CONTAINER"
|
||||
echo "$ cd $(pwd)"
|
||||
|
||||
bash "_scripts/sh/create_pages.sh"
|
||||
bash "_scripts/sh/dump_lastmod.sh"
|
||||
|
||||
cmd+=" -d $dest"
|
||||
|
||||
if [[ -n $config ]]; then
|
||||
cmd+=" --config $config"
|
||||
fi
|
||||
|
||||
echo "\$ $cmd"
|
||||
eval "$cmd"
|
||||
echo -e "\nBuild success, the site files have been placed in '${dest}'."
|
||||
|
||||
if [[ -d "${dest}/.git" ]]; then
|
||||
if [[ -n $(git -C "$dest" status -s) ]]; then
|
||||
git -C "$dest" add .
|
||||
git -C "$dest" commit -m "[Automation] Update site files." -q
|
||||
echo -e "\nPlease push the changes of $dest to remote master branch.\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
cd .. && rm -rf "$CONTAINER"
|
||||
}
|
||||
|
||||
_check_unset() {
|
||||
if [[ -z ${1:+unset} ]]; then
|
||||
_help
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
opt="$1"
|
||||
case $opt in
|
||||
-b | --baseurl)
|
||||
local _baseurl="$2"
|
||||
if [[ -z $_baseurl ]]; then
|
||||
_baseurl='""'
|
||||
fi
|
||||
cmd+=" -b $_baseurl"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-d | --destination)
|
||||
_check_unset "$2"
|
||||
dest="$(realpath "$2")"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--docker)
|
||||
docker=true
|
||||
shift
|
||||
;;
|
||||
--config)
|
||||
_check_unset "$2"
|
||||
config="$(realpath "$2")"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
_help
|
||||
exit 0
|
||||
;;
|
||||
*) # unknown option
|
||||
_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if $docker; then
|
||||
_install_tools
|
||||
fi
|
||||
|
||||
_init
|
||||
_build
|
||||
}
|
||||
|
||||
main "$@"
|
||||
53
tools/bump-version.sh
Executable file
53
tools/bump-version.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Bump latest version to file `_data/meta.yml`
|
||||
#
|
||||
# v2.5.1
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# Published under MIT License
|
||||
|
||||
set -eu
|
||||
|
||||
META_FILE="_data/meta.yml"
|
||||
|
||||
bump() {
|
||||
_version_field="version: $1"
|
||||
|
||||
if [[ ! -f $META_FILE ]]; then
|
||||
echo "name: Chirpy" > $META_FILE
|
||||
echo "$_version_field" >> $META_FILE
|
||||
echo "homepage: https://github.com/cotes2020/jekyll-theme-chirpy/" >> $META_FILE
|
||||
else
|
||||
sed -i "s/^version:.*/$_version_field/g" $META_FILE
|
||||
fi
|
||||
|
||||
if [[ -n $(git status $META_FILE -s) ]]; then
|
||||
git add $META_FILE
|
||||
git commit -m "Bump version to $1"
|
||||
fi
|
||||
}
|
||||
|
||||
_latest_tag="$(git describe --tags --abbrev=0)"
|
||||
|
||||
echo "Input a version number (hint: latest version is ${_latest_tag:1})"
|
||||
|
||||
read version
|
||||
|
||||
if [[ $version =~ ^[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?$ ]]; then
|
||||
|
||||
if git tag --list | egrep -q "^v$version$"; then
|
||||
echo "Error: version '$version' already exists"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
echo "Bump version to $version"
|
||||
bump "$version"
|
||||
|
||||
echo "Create tag v$version"
|
||||
git tag "v$version"
|
||||
|
||||
else
|
||||
|
||||
echo "Error: Illegal version number: '$version'"
|
||||
fi
|
||||
188
tools/run.sh
188
tools/run.sh
@@ -1,188 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run jekyll site at http://127.0.0.1:4000
|
||||
#
|
||||
# Requirement:
|
||||
# Option '-r, --realtime' needs fswatch › http://emcrisostomo.github.io/fswatch/
|
||||
#
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# Published under MIT License
|
||||
|
||||
set -eu
|
||||
|
||||
WORK_DIR="$(dirname "$(dirname "$(realpath "$0")")")"
|
||||
|
||||
CONTAINER="${WORK_DIR}/.container"
|
||||
SYNC_TOOL=_scripts/sh/sync_monitor.sh
|
||||
|
||||
cmd="bundle exec jekyll s"
|
||||
JEKYLL_DOCKER_HOME="/srv/jekyll"
|
||||
|
||||
realtime=false
|
||||
docker=false
|
||||
|
||||
_help() {
|
||||
echo "Usage:"
|
||||
echo
|
||||
echo " bash run.sh [options]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -H, --host <HOST> Host to bind to"
|
||||
echo " -P, --port <PORT> Port to listen on"
|
||||
echo " -b, --baseurl <URL> The site relative url that start with slash, e.g. '/project'"
|
||||
echo " -h, --help Print the help information"
|
||||
echo " -t, --trace Show the full backtrace when an error occurs"
|
||||
echo " -r, --realtime Make the modified content updated in real time"
|
||||
echo " --docker Run within docker"
|
||||
}
|
||||
|
||||
_cleanup() {
|
||||
rm -rf "$CONTAINER"
|
||||
ps aux | grep fswatch | awk '{print $2}' | xargs kill -9 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
_setup_docker() {
|
||||
# docker image `jekyll/jekyll` based on Alpine Linux
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
|
||||
## CN Apline sources mirror
|
||||
# sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
apk update
|
||||
apk add yq
|
||||
}
|
||||
|
||||
_init() {
|
||||
cd "$WORK_DIR"
|
||||
|
||||
if [[ -f Gemfile.lock ]]; then
|
||||
rm -f Gemfile.lock
|
||||
fi
|
||||
|
||||
if [[ -d $CONTAINER ]]; then
|
||||
rm -rf "$CONTAINER"
|
||||
fi
|
||||
|
||||
mkdir "$CONTAINER"
|
||||
cp -r ./* "$CONTAINER"
|
||||
cp -r ./.git "$CONTAINER"
|
||||
|
||||
if $docker; then
|
||||
local _image_user=$(stat -c "%U" "$JEKYLL_DOCKER_HOME"/.)
|
||||
|
||||
if [[ $_image_user != $(whoami) ]]; then
|
||||
# under Docker for Linux
|
||||
chown -R "$(stat -c "%U:%G" "$JEKYLL_DOCKER_HOME"/.)" "$CONTAINER"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
trap _cleanup INT
|
||||
}
|
||||
|
||||
_check_unset() {
|
||||
if [[ -z ${1:+unset} ]]; then
|
||||
_help
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
_check_command() {
|
||||
if [[ -z $(command -v "$1") ]]; then
|
||||
echo "Error: command '$1' not found !"
|
||||
echo "Hint: Get '$1' on <$2>"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
_run() {
|
||||
cd "$CONTAINER"
|
||||
bash _scripts/sh/create_pages.sh
|
||||
bash _scripts/sh/dump_lastmod.sh
|
||||
|
||||
if $realtime; then
|
||||
|
||||
exclude_regex="\/\..*"
|
||||
|
||||
if [[ $OSTYPE == "darwin"* ]]; then
|
||||
exclude_regex="/\..*" # darwin gcc treat regex '/' as character '/'
|
||||
fi
|
||||
|
||||
fswatch -e "$exclude_regex" -0 -r \
|
||||
--event Created --event Removed \
|
||||
--event Updated --event Renamed \
|
||||
--event MovedFrom --event MovedTo \
|
||||
"$WORK_DIR" | xargs -0 -I {} bash "./${SYNC_TOOL}" {} "$WORK_DIR" . &
|
||||
fi
|
||||
|
||||
if $docker; then
|
||||
cmd+=" -H 0.0.0.0"
|
||||
else
|
||||
cmd+=" -l -o"
|
||||
fi
|
||||
|
||||
echo "\$ $cmd"
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
main() {
|
||||
if $docker; then
|
||||
_setup_docker
|
||||
fi
|
||||
|
||||
_init
|
||||
_run
|
||||
}
|
||||
|
||||
while (($#)); do
|
||||
opt="$1"
|
||||
case $opt in
|
||||
-H | --host)
|
||||
_check_unset "$2"
|
||||
cmd+=" -H $2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
-P | --port)
|
||||
_check_unset "$2"
|
||||
cmd+=" -P $2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-b | --baseurl)
|
||||
_check_unset "$2"
|
||||
if [[ $2 == \/* ]]; then
|
||||
cmd+=" -b $2"
|
||||
else
|
||||
_help
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-t | --trace)
|
||||
cmd+=" -t"
|
||||
shift
|
||||
;;
|
||||
-r | --realtime)
|
||||
_check_command fswatch "http://emcrisostomo.github.io/fswatch/"
|
||||
realtime=true
|
||||
shift
|
||||
;;
|
||||
--docker)
|
||||
docker=true
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
_help
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
main
|
||||
@@ -14,10 +14,56 @@
|
||||
DEST=_site
|
||||
URL_IGNORE=cdn.jsdelivr.net
|
||||
|
||||
_build=false
|
||||
|
||||
help() {
|
||||
echo "Usage:"
|
||||
echo
|
||||
echo " bash ./tools/test.sh [options]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " --build Run Jekyll build before test."
|
||||
echo " -d, --dir <path> Specify the test path."
|
||||
echo " -h, --help Print this information."
|
||||
}
|
||||
|
||||
if [[ -n $1 && -d $1 ]]; then
|
||||
DEST=$1
|
||||
fi
|
||||
|
||||
while (($#)); do
|
||||
opt="$1"
|
||||
case $opt in
|
||||
--build)
|
||||
_build=true
|
||||
shift
|
||||
;;
|
||||
-d | --dir)
|
||||
if [[ ! -d $2 ]]; then
|
||||
echo -e "Error: path '$2' doesn't exist\n"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
DEST=$2
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
help
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if $_build; then
|
||||
JEKYLL_ENV=production bundle exec jekyll b
|
||||
fi
|
||||
|
||||
bundle exec htmlproofer $DEST \
|
||||
--disable-external \
|
||||
--check-html \
|
||||
|
||||
Reference in New Issue
Block a user