mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 21:53:26 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec522e5219 | ||
|
|
4ee8f20df2 | ||
|
|
7d7c0da31b | ||
|
|
4343f1a8f8 | ||
|
|
b85980e1e2 | ||
|
|
893db51ff0 | ||
|
|
cbb3bd4be5 | ||
|
|
7ed3bef1b1 | ||
|
|
da9f7b8218 | ||
|
|
0e9104a58f | ||
|
|
b7266aceac | ||
|
|
28f36bee23 | ||
|
|
994b3e32d3 | ||
|
|
75e9feb687 | ||
|
|
ab0e3f6ee4 | ||
|
|
0194bbced9 | ||
|
|
e92cc239c1 | ||
|
|
da976ce088 | ||
|
|
6490b0fcbd | ||
|
|
ef1d05d342 | ||
|
|
e8170f8379 | ||
|
|
93fcf50131 | ||
|
|
66a132c462 | ||
|
|
6e6633c2fc | ||
|
|
594eaf5100 | ||
|
|
940db20c5c | ||
|
|
493e1d934b | ||
|
|
b9104d0f4c | ||
|
|
3c72298563 | ||
|
|
ca2194770c | ||
|
|
08fbd06c63 | ||
|
|
a20fd5bf6f | ||
|
|
7a88347c63 | ||
|
|
813443b206 | ||
|
|
c381353f86 | ||
|
|
aa6c33526a | ||
|
|
081e77d462 | ||
|
|
bca7a2a634 | ||
|
|
505da84a26 | ||
|
|
dfba411d61 | ||
|
|
fa310d3190 | ||
|
|
ef0c9ce770 | ||
|
|
7429ef3539 | ||
|
|
6d4abcc437 |
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,7 +1,6 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
labels: suspect
|
||||
---
|
||||
|
||||
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
|
||||
|
||||
6
.github/workflows/issue-pr-interceptor.yml
vendored
6
.github/workflows/issue-pr-interceptor.yml
vendored
@@ -2,9 +2,9 @@ name: "Intercept bad issue/PRs"
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
types: [opened, reopened]
|
||||
pull_request:
|
||||
types: [opened]
|
||||
types: [opened, reopened]
|
||||
|
||||
jobs:
|
||||
autoclose:
|
||||
@@ -16,5 +16,5 @@ jobs:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-pattern: "\\[x\\] I have read"
|
||||
issue-close-message: ":wave: Hi @${issue.user.login},\n\nThis issue is being automatically closed because it does not follow the issue template."
|
||||
pr-pattern: "\\[x\\] Bug|\\[x\\] New feat|\\[x\\] Break|\\[x\\] Doc"
|
||||
pr-pattern: "\\[x\\] Bug|\\[x\\] New feat|\\[x\\] Break|\\[x\\] Doc|@dependabot"
|
||||
pr-close-message: ":wave: Hi @${pull_request.user.login},\n\nThis PR is being automatically closed because it does not follow the PR template."
|
||||
|
||||
21
.github/workflows/pages-deploy.yml.hook
vendored
21
.github/workflows/pages-deploy.yml.hook
vendored
@@ -44,28 +44,25 @@ jobs:
|
||||
run: |
|
||||
baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
|
||||
if [[ -n $baseurl ]]; then
|
||||
echo "SPEC_TEST=_site_no_baseurl" >> $GITHUB_ENV
|
||||
echo "BASE_URL=$baseurl" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Build Site
|
||||
env:
|
||||
JEKYLL_ENV: production
|
||||
run: |
|
||||
bundle exec jekyll b
|
||||
|
||||
if [[ -n $SPEC_TEST ]]; then
|
||||
# Bypass the defects of htmlproofer
|
||||
bundle exec jekyll b -b "" -d "$SPEC_TEST"
|
||||
fi
|
||||
bundle exec jekyll b -d "_site$BASE_URL"
|
||||
|
||||
- name: Test Site
|
||||
run: |
|
||||
if [[ -n $SPEC_TEST ]]; then
|
||||
bash tools/test.sh -d "$SPEC_TEST"
|
||||
else
|
||||
bash tools/test.sh
|
||||
fi
|
||||
bash tools/test.sh
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
if [[ -n $BASE_URL ]]; then
|
||||
mv _site$BASE_URL _site-rename
|
||||
rm -rf _site
|
||||
mv _site-rename _site
|
||||
fi
|
||||
|
||||
bash tools/deploy.sh
|
||||
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -5,3 +5,12 @@
|
||||
# jekyll cache
|
||||
_site
|
||||
vendor
|
||||
|
||||
# rubygem
|
||||
*.gem
|
||||
# yard docs
|
||||
doc
|
||||
|
||||
# npm dependencies
|
||||
node_modules
|
||||
package-lock.json
|
||||
|
||||
9
404.html
9
404.html
@@ -1,14 +1,9 @@
|
||||
---
|
||||
# The 404 page
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT License
|
||||
layout: page
|
||||
title: "404: Page not found"
|
||||
permalink: /404.html
|
||||
|
||||
redirect_from: # part of site.sitemap_exclude
|
||||
redirect_from:
|
||||
- /norobots/
|
||||
- /assets/
|
||||
- /tabs/
|
||||
@@ -22,4 +17,4 @@ dynamic_title: true
|
||||
<div class="lead">
|
||||
<p>Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. </p>
|
||||
<p><a href="{{ site.baseurl }}/">Head back Home</a> to try finding it again, or search for it on the <a href="{{ site.baseurl }}/tabs/archives">Archives page</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
14
Gemfile
14
Gemfile
@@ -1,18 +1,18 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "jekyll", ">= 4.0.0", "< 5.0"
|
||||
gem "jekyll", "~> 4.1"
|
||||
|
||||
# plugins
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-paginate"
|
||||
gem "jekyll-redirect-from"
|
||||
gem "jekyll-seo-tag"
|
||||
gem "jekyll-archives"
|
||||
gem "jekyll-sitemap"
|
||||
gem "jekyll-paginate", "~> 1.1"
|
||||
gem "jekyll-redirect-from", "~> 0.16"
|
||||
gem "jekyll-seo-tag", "~> 2.7"
|
||||
gem "jekyll-archives", "~> 2.2"
|
||||
gem "jekyll-sitemap", "~> 1.4"
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem "html-proofer"
|
||||
gem "html-proofer", "~> 3.18"
|
||||
end
|
||||
|
||||
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
|
||||
42
Gemfile.lock
42
Gemfile.lock
@@ -11,9 +11,9 @@ GEM
|
||||
ethon (0.12.0)
|
||||
ffi (>= 1.3.0)
|
||||
eventmachine (1.2.7)
|
||||
ffi (1.13.1)
|
||||
ffi (1.14.2)
|
||||
forwardable-extended (2.6.0)
|
||||
html-proofer (3.17.4)
|
||||
html-proofer (3.18.5)
|
||||
addressable (~> 2.3)
|
||||
mercenary (~> 0.3)
|
||||
nokogumbo (~> 2.0)
|
||||
@@ -24,21 +24,21 @@ GEM
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (1.8.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (4.1.1)
|
||||
jekyll (4.2.0)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
i18n (~> 1.0)
|
||||
jekyll-sass-converter (~> 2.0)
|
||||
jekyll-watch (~> 2.0)
|
||||
kramdown (~> 2.1)
|
||||
kramdown (~> 2.3)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
liquid (~> 4.0)
|
||||
mercenary (~> 0.4.0)
|
||||
pathutil (~> 0.9)
|
||||
rouge (~> 3.0)
|
||||
safe_yaml (~> 1.0)
|
||||
terminal-table (~> 1.8)
|
||||
terminal-table (~> 2.0)
|
||||
jekyll-archives (2.2.1)
|
||||
jekyll (>= 3.6, < 5.0)
|
||||
jekyll-paginate (1.1.0)
|
||||
@@ -61,32 +61,34 @@ GEM
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.4.0)
|
||||
mini_portile2 (2.4.0)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
mini_portile2 (2.5.0)
|
||||
nokogiri (1.11.1)
|
||||
mini_portile2 (~> 2.5.0)
|
||||
racc (~> 1.4)
|
||||
nokogumbo (2.0.4)
|
||||
nokogiri (~> 1.8, >= 1.8.4)
|
||||
parallel (1.20.1)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (4.0.6)
|
||||
racc (1.5.2)
|
||||
rainbow (3.0.0)
|
||||
rb-fsevent (0.10.4)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.4)
|
||||
rouge (3.25.0)
|
||||
rouge (3.26.0)
|
||||
safe_yaml (1.0.5)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
terminal-table (1.8.0)
|
||||
terminal-table (2.0.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thread_safe (0.3.6)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.8)
|
||||
tzinfo (1.2.9)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo-data (1.2020.4)
|
||||
tzinfo-data (1.2020.6)
|
||||
tzinfo (>= 1.0.0)
|
||||
unicode-display_width (1.7.0)
|
||||
wdm (0.1.1)
|
||||
@@ -96,16 +98,16 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
html-proofer
|
||||
jekyll (>= 4.0.0, < 5.0)
|
||||
jekyll-archives
|
||||
jekyll-paginate
|
||||
jekyll-redirect-from
|
||||
jekyll-seo-tag
|
||||
jekyll-sitemap
|
||||
html-proofer (~> 3.18)
|
||||
jekyll (~> 4.1)
|
||||
jekyll-archives (~> 2.2)
|
||||
jekyll-paginate (~> 1.1)
|
||||
jekyll-redirect-from (~> 0.16)
|
||||
jekyll-seo-tag (~> 2.7)
|
||||
jekyll-sitemap (~> 1.4)
|
||||
tzinfo (~> 1.2)
|
||||
tzinfo-data
|
||||
wdm (~> 0.1.1)
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
2.2.4
|
||||
|
||||
138
README.md
138
README.md
@@ -1,6 +1,6 @@
|
||||
# Chirpy
|
||||
|
||||
Language: English | [简体中文](docs/README.zh-CN.md)
|
||||
Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/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)
|
||||
@@ -9,12 +9,13 @@ Language: English | [简体中文](docs/README.zh-CN.md)
|
||||
|
||||
A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation. Designed to help you record and share your knowledge easily. [Live Demo »](https://chirpy.cotes.info)
|
||||
|
||||
[](https://chirpy.cotes.info)
|
||||
[](https://chirpy.cotes.info)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Features](#features)
|
||||
- [Installation](#installation)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Usage](#usage)
|
||||
- [Contributing](#contributing)
|
||||
- [Credits](#credits)
|
||||
@@ -39,80 +40,101 @@ A minimal, sidebar, responsive web design Jekyll theme that focuses on text pres
|
||||
- GA Pageviews reporting (Advanced)
|
||||
- SEO and Performance Optimization
|
||||
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
|
||||
|
||||
## Installation
|
||||
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub, rename the repository to `USERNAME.github.io` (where `USERNAME` is your GitHub username), and then open terminal and clone the fork to local by:
|
||||
There are two ways to get the theme:
|
||||
|
||||
```terminal
|
||||
$ git clone https://github.com/USERNAME/USERNAME.github.io.git -b master --single-branch
|
||||
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy)
|
||||
- Fork from GitHub
|
||||
|
||||
### Install From Rubygems
|
||||
|
||||
Add this line to your Jekyll site's `Gemfile`:
|
||||
|
||||
```ruby
|
||||
gem "jekyll-theme-chirpy"
|
||||
```
|
||||
|
||||
### Setting up the local envrionment
|
||||
And add this line to your Jekyll site's `_config.yml`:
|
||||
|
||||
If you would like to run or build the project on your local machine, please follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
|
||||
|
||||
Before running or building for the first time, please complete the installation of the Jekyll plugins. Go to the root directory of project and run:
|
||||
|
||||
```terminal
|
||||
$ bundle install
|
||||
```yaml
|
||||
theme: jekyll-theme-chirpy
|
||||
```
|
||||
|
||||
`bundle` will automatically install all the dependencies specified by `Gemfile`.
|
||||
|
||||
### Setting up Docker environment (optional)
|
||||
|
||||
If you're a loyal fan of [**Docker**](https://www.docker.com/) or just too lazy to install the packages mentioned in [_Setting up the local envrionment_](#setting-up-the-local-envrionment), please make sure you have **Docker Engine** installed and running, and then get Docker image `jekyll/jekyll` from Docker Hub by the following command:
|
||||
And then execute:
|
||||
|
||||
```console
|
||||
$ docker pull jekyll/jekyll
|
||||
$ bundle
|
||||
```
|
||||
|
||||
## Usage
|
||||
Finally, copy the missing files (refer to the [starter project][starter] for the detailed file directory structure) from the theme's gem to your Jekyll site, and append all the variables of the theme's `_config.yml` to your Jekyll site.
|
||||
|
||||
### Initialization
|
||||
> **Hint**: To locate the theme’s gem, execute:
|
||||
>
|
||||
```console
|
||||
$ bundle info --path jekyll-theme-chirpy
|
||||
```
|
||||
|
||||
Go to the root directory of the project and start initialization:
|
||||
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem.
|
||||
|
||||
[starter]: https://github.com/cotes2020/chirpy-starter
|
||||
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
|
||||
|
||||
### Fork From GitHub
|
||||
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local.
|
||||
|
||||
Install gem dependencies by:
|
||||
|
||||
```console
|
||||
$ bundle
|
||||
```
|
||||
|
||||
And then execute:
|
||||
|
||||
```console
|
||||
$ bash tools/init.sh
|
||||
```
|
||||
|
||||
> **Note**: If you not intend to deploy it on GitHub Pages, append parameter option `--no-gh` at the end of the above command.
|
||||
> **Note**: If you don't plan to deploy your site on GitHub Pages, append parameter option `--no-gh` at the end of the above command.
|
||||
|
||||
What it does is:
|
||||
|
||||
1. Remove some files or directories from your repository:
|
||||
1. Remove some files or directories from your repository:
|
||||
|
||||
- `.travis.yml`
|
||||
- files under `_posts`
|
||||
- folder `docs`
|
||||
- `.travis.yml`
|
||||
- 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.
|
||||
3. Automatically create a commit to save the changes.
|
||||
|
||||
## Usage
|
||||
|
||||
### Configuration
|
||||
|
||||
Generally, go to `_config.yml` and configure the variables as needed. Some of them are typical options:
|
||||
Update the variables of `_config.yml` as needed. Some of them are typical options:
|
||||
|
||||
- `url`
|
||||
- `avatar`
|
||||
- `timezone`
|
||||
- `theme_mode`
|
||||
- `url`
|
||||
- `avatar`
|
||||
- `timezone`
|
||||
- `theme_mode`
|
||||
|
||||
### Run Locally
|
||||
### Running Local Server
|
||||
|
||||
You may want to preview the site contents before publishing, so just run it by:
|
||||
|
||||
```terminal
|
||||
```console
|
||||
$ bundle exec jekyll s
|
||||
```
|
||||
|
||||
Then open a browser and visit to <http://localhost:4000>.
|
||||
|
||||
### Run on Docker
|
||||
|
||||
Run the site on Docker with the following command:
|
||||
Or run the site on Docker with the following command:
|
||||
|
||||
```terminal
|
||||
$ docker run -it --rm \
|
||||
@@ -121,22 +143,34 @@ $ docker run -it --rm \
|
||||
jekyll serve
|
||||
```
|
||||
|
||||
Open a browser and visit to _<http://localhost:4000>_.
|
||||
|
||||
### Deployment
|
||||
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [_project site_](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash. For example, `/project`.
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
|
||||
|
||||
Assuming you have already gone through the [initialization](#initialization), you can now choose ONE of the following methods to deploy your website.
|
||||
Now you can now choose ONE of the following methods to deploy your website.
|
||||
|
||||
#### Deploy on GitHub Pages
|
||||
|
||||
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the Pages service.
|
||||
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the GH Pages service.
|
||||
|
||||
1. Push any commit to `origin/master` to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
|
||||
Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`.
|
||||
Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
|
||||
|
||||
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_:
|
||||

|
||||
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
|
||||
|
||||
3. Visit your website at the address indicated by GitHub.
|
||||
Rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
|
||||
|
||||
And then publish your site by:
|
||||
|
||||
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
|
||||
|
||||
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_:
|
||||
|
||||

|
||||
|
||||
3. Visit your website at the address indicated by GitHub.
|
||||
|
||||
#### Deploy on Other Platforms
|
||||
|
||||
@@ -148,7 +182,7 @@ Go to the root of the source project, build your site by:
|
||||
$ JEKYLL_ENV=production bundle exec jekyll b
|
||||
```
|
||||
|
||||
Or, build the site with Docker by:
|
||||
Or build the site with Docker by:
|
||||
|
||||
```terminal
|
||||
$ docker run -it --rm \
|
||||
@@ -160,7 +194,7 @@ $ docker run -it --rm \
|
||||
|
||||
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
|
||||
|
||||
### Documentation
|
||||
## Documentation
|
||||
|
||||
For more details and the better reading experience, please check out the [tutorials on demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki).
|
||||
|
||||
@@ -174,6 +208,12 @@ 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.
|
||||
|
||||
Also, thank [JetBrains][JB] for providing the open source license.
|
||||
|
||||
[][JB]
|
||||
|
||||
[JB]:https://www.jetbrains.com/?from=jekyll-theme-chirpy
|
||||
|
||||
## 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.
|
||||
|
||||
32
_config.yml
32
_config.yml
@@ -1,28 +1,21 @@
|
||||
# The Site Settings
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT licensed
|
||||
|
||||
# The Site Configuration
|
||||
|
||||
# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
|
||||
# --------------------------
|
||||
title: Chirpy # the main title
|
||||
|
||||
tagline: A text-focused Jekyll theme. # it will display as the sub-title
|
||||
tagline: A text-focused Jekyll theme # it will display as the sub-title
|
||||
|
||||
description: >- # used by seo meta and the atom feed
|
||||
A minimal, portfolio, sidebar,
|
||||
bootstrap Jekyll theme with responsive web design
|
||||
and focuses on text presentation.
|
||||
|
||||
# fill in the base hostname & protocol for your site, e.g., 'https://username.github.io'
|
||||
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
|
||||
url: ''
|
||||
|
||||
author: your_full_name # change to your full name
|
||||
|
||||
avatar: /assets/img/sample/avatar.jpg # support internet resources
|
||||
|
||||
github:
|
||||
username: github_username # change to your github username
|
||||
|
||||
@@ -79,7 +72,17 @@ disqus:
|
||||
#
|
||||
# dark - Use the dark color scheme
|
||||
#
|
||||
theme_mode: # <light|dark>
|
||||
theme_mode: # [light|dark]
|
||||
|
||||
# The CDN endpoint for images.
|
||||
# Notice that once it is assigned, the CDN url
|
||||
# will be added to all image (site avatar & posts' images) paths starting with '/'
|
||||
#
|
||||
# e.g. 'https://cdn.com'
|
||||
img_cdn: ''
|
||||
|
||||
# the avatar on sidebar, support local or CORS resources
|
||||
avatar: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/avatar.jpg
|
||||
|
||||
# boolean type, the global switch for ToC in posts.
|
||||
toc: true
|
||||
@@ -167,7 +170,6 @@ defaults:
|
||||
url: /
|
||||
|
||||
sass:
|
||||
sass_dir: /assets/css
|
||||
style: compressed
|
||||
|
||||
compress_html:
|
||||
@@ -177,7 +179,7 @@ compress_html:
|
||||
profile: false
|
||||
blanklines: false
|
||||
ignore:
|
||||
envs: []
|
||||
envs: [development]
|
||||
|
||||
exclude:
|
||||
- vendor
|
||||
@@ -187,6 +189,10 @@ exclude:
|
||||
- docs
|
||||
- README.md
|
||||
- LICENSE
|
||||
- gulpfile.js
|
||||
- node_modules
|
||||
- package.json
|
||||
- package-lock.json
|
||||
|
||||
jekyll-archives:
|
||||
enabled: [categories, tags]
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
# The contact options.
|
||||
# v2.3
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# MIT Licensed
|
||||
|
||||
-
|
||||
type: github
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
# The date format
|
||||
# v2.1
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# MIT Licensed
|
||||
|
||||
|
||||
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
|
||||
|
||||
post:
|
||||
long: "%b %e, %Y"
|
||||
short: "%b %e"
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
# The label text of site.
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT Licensed
|
||||
|
||||
panel:
|
||||
lastmod: Recent Update
|
||||
@@ -11,10 +7,13 @@ panel:
|
||||
|
||||
post:
|
||||
relate_posts: Further Reading
|
||||
share: Share
|
||||
button:
|
||||
next: Newer
|
||||
previous: Older
|
||||
|
||||
search_hint: Search # text show on search bar
|
||||
|
||||
pin_prompt: Pinned # pinned prompt
|
||||
pin_prompt: Pinned # pinned prompt
|
||||
|
||||
read_time_unit: min # see posts' time to read
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
name: Chirpy
|
||||
version: 2.7.0
|
||||
homepage: https://github.com/cotes2020/jekyll-theme-chirpy/
|
||||
@@ -1,7 +0,0 @@
|
||||
# words per minute
|
||||
wpm: 180
|
||||
|
||||
# minimum value
|
||||
min_time: 1
|
||||
|
||||
prompt: min
|
||||
@@ -1,10 +1,4 @@
|
||||
# License data.
|
||||
#
|
||||
# v2.1
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# MIT Licensed
|
||||
|
||||
# License data
|
||||
|
||||
license:
|
||||
name: CC BY 4.0
|
||||
@@ -14,4 +8,4 @@ brief: Some rights reserved.
|
||||
|
||||
verbose: >-
|
||||
Except where otherwise noted, the blog posts on this site are licensed
|
||||
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
|
||||
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
# Sharing options at the bottom of the post.
|
||||
# Icons from <https://fontawesome.com/>
|
||||
#
|
||||
# v2.1
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# MIT Licensed
|
||||
|
||||
label: "Share"
|
||||
|
||||
platforms:
|
||||
-
|
||||
|
||||
@@ -1,26 +1,10 @@
|
||||
<!--
|
||||
CSS selector for site.
|
||||
Chirpy v2.3
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT Licensed
|
||||
-->
|
||||
|
||||
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
|
||||
|
||||
{% if page.layout == 'category' or page.layout == 'tag' %}
|
||||
{% assign style = 'category-tag' %}
|
||||
{% else %}
|
||||
{% assign style = page.layout %}
|
||||
{% endif %}
|
||||
|
||||
{% assign src = style | prepend: '/assets/css/' | append: '.css' | relative_url %}
|
||||
|
||||
<link rel="preload" href="{{ src }}" as="style">
|
||||
<link rel="stylesheet" href="{{ src }}">
|
||||
|
||||
{% if page.layout == 'post' %}
|
||||
{% if site.toc and page.toc %}
|
||||
<link rel="preload" as="style" href="{{ '/assets/css/lib/bootstrap-toc.min.css' | relative_url }}">
|
||||
<link rel="stylesheet" href="{{ '/assets/css/lib/bootstrap-toc.min.css' | relative_url }}" />
|
||||
{% endif %}
|
||||
{% if site.toc and page.toc %}
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css">
|
||||
{% endif %}
|
||||
|
||||
@@ -1,28 +1,25 @@
|
||||
<!--
|
||||
The Disqus lazy loading.
|
||||
Powered by: https://osvaldas.info/lazy-loading-disqus-comments
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2019 Cotes Chung
|
||||
MIT License
|
||||
Powered by: <https://github.com/osvaldasvalutis/disqusLoader.js>
|
||||
-->
|
||||
|
||||
<div id="disqus" class="pt-2 pb-2">
|
||||
<p class="font-italic text-center text-muted small">
|
||||
Comments powered by <a href="https://disqus.com/">Disqus</a>.
|
||||
<p class="text-center text-muted pb-5">
|
||||
Loading comments from <a href="https://disqus.com/">Disqus</a> ...
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script src="{{ site.baseurl }}/assets/js/lib/jquery.disqusloader.min.js"></script>
|
||||
<script src="{{ '/assets/js/lib/jquery.disqusloader.min.js' | relative_url }}"></script>
|
||||
<script>
|
||||
var options = {
|
||||
const options = {
|
||||
scriptUrl: '//{{ site.disqus.shortname }}.disqus.com/embed.js',
|
||||
|
||||
disqusConfig: function() {
|
||||
this.page.url = '{{ site.url | append: site.baseurl | append: page.url }}';
|
||||
this.page.title = '{{ page.title }}';
|
||||
this.page.url = '{{ page.url | absolute_url }}';
|
||||
this.page.identifier = '{{ page.url }}';
|
||||
}
|
||||
};
|
||||
|
||||
$.disqusLoader('#disqus', options);
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<!--
|
||||
The Favicons for Web, Android, Microsoft, and iOS (iPhone and iPad) Apps
|
||||
Generated by: https://www.favicon-generator.org/
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2019 Cotes Chung
|
||||
Published under the MIT license
|
||||
-->
|
||||
|
||||
{% capture icon_url %}{{ site.baseurl }}/assets/img/favicons{% endcapture %}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<!--
|
||||
The Footer
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2017-2019 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
<footer class="d-flex w-100 justify-content-center">
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<!--
|
||||
The GA snippet
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2017-2019 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
<!--
|
||||
The Head
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2017-2019 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme" content="{{ site.data.meta.name }} v{{ site.data.meta.version }}">
|
||||
|
||||
{% if page.layout == 'home' or page.layout == 'post' %}
|
||||
<meta name="pv-cache-enabled" content="{{ site.google_analytics.pv.enabled }}">
|
||||
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
{% if site.google_analytics.pv.proxy_endpoint != ''
|
||||
and site.google_analytics.pv.proxy_endpoint %}
|
||||
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
|
||||
{% endif %}
|
||||
|
||||
{% if site.google_analytics.pv.cache %}
|
||||
<meta name="pv-cache-data" content="{{ '/assets/js/data/pageviews.json' | relative_url }}">
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% seo title=false %}
|
||||
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
<!--
|
||||
JS selector for site.
|
||||
Chirpy v2.3
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT Licensed
|
||||
-->
|
||||
|
||||
{% if page.layout == 'home' or page.layout == 'post' or page.layout == 'categories' %}
|
||||
{% assign js = page.layout %}
|
||||
{% else %}
|
||||
{% assign js = "page" %}
|
||||
{% if page.layout == 'home' or page.layout == 'post' %}
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
<!-- pv-report needs countup.js -->
|
||||
<script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>
|
||||
<script async src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% assign js_src = js | prepend: '/assets/js/' | append: '.min.js' | relative_url %}
|
||||
{% if page.layout == 'home'
|
||||
or page.layout == 'post'
|
||||
or page.layout == 'categories' %}
|
||||
{% assign type = page.layout %}
|
||||
{% else %}
|
||||
{% assign type = "page" %}
|
||||
{% endif %}
|
||||
|
||||
<script async src="{{ js_src }}"></script>
|
||||
{% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %}
|
||||
<script defer src="{{ js | relative_url }}"></script>
|
||||
|
||||
{% if page.math %}
|
||||
<!-- MathJax -->
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<!-- image lazy load: https://github.com/ApoorvSaxena/lozad.js -->
|
||||
<!--
|
||||
image lazy load: https://github.com/ApoorvSaxena/lozad.js
|
||||
-->
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
const imgs = document.querySelectorAll('#post-wrapper img');
|
||||
const imgs = document.querySelectorAll('.post-content img');
|
||||
const observer = lozad(imgs);
|
||||
observer.observe();
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<!--
|
||||
mermaid-js loader
|
||||
-->
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
let initTheme = "default";
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<!--
|
||||
Switch the mode between dark and light.
|
||||
|
||||
v2.1
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
<i class="mode-toggle fas fa-adjust"></i>
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{% comment %}
|
||||
Remove the line number of the code snippet.
|
||||
v2.2
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
Published under the MIT License
|
||||
{% endcomment %}
|
||||
|
||||
{% assign content = include.content %}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<!--
|
||||
The Pannel on right side (Desktop views)
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2017-2019 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
<div id="panel-wrapper" class="col-xl-3 pl-2 text-muted topbar-down">
|
||||
@@ -15,7 +11,7 @@
|
||||
{% if update_list.size > 0 %}
|
||||
|
||||
<div id="access-lastmod" class="post">
|
||||
<span>{{- site.data.label.panel.lastmod -}}</span>
|
||||
<span>{{- site.data.label.panel.lastmod | default: 'Recent Update' -}}</span>
|
||||
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
|
||||
|
||||
{% for item in update_list %}
|
||||
@@ -34,7 +30,7 @@
|
||||
|
||||
{% if trending_tags.size > 0 %}
|
||||
<div id="access-tags">
|
||||
<span>{{- site.data.label.panel.trending_tags -}}</span>
|
||||
<span>{{- site.data.label.panel.trending_tags | default: 'Trending Tags' -}}</span>
|
||||
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
|
||||
|
||||
{% for tag_name in trending_tags %}
|
||||
@@ -47,13 +43,15 @@
|
||||
{% endif %}
|
||||
</div> <!-- .access -->
|
||||
|
||||
{% if page.layout == 'post' and site.toc and page.toc %}
|
||||
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
||||
<span class="pl-3 pt-2 mb-2">
|
||||
{{- site.data.label.panel.toc -}}
|
||||
</span>
|
||||
<nav id="toc" data-toggle="toc"></nav>
|
||||
</div>
|
||||
{% if include.toc %}
|
||||
<!-- BS-toc.js will be loaded at medium priority -->
|
||||
<script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script>
|
||||
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
||||
<span class="pl-3 pt-2 mb-2">
|
||||
{{- site.data.label.panel.toc | default: 'Contents' -}}
|
||||
</span>
|
||||
<nav id="toc" data-toggle="toc"></nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- #panel-wrapper -->
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
<!--
|
||||
Navigation buttons at the bottom of the post.
|
||||
|
||||
v2.1
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
<div class="post-navigation d-flex justify-content-between">
|
||||
{% if page.previous.url %}
|
||||
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary">
|
||||
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
|
||||
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}">
|
||||
<p>{{ page.previous.title }}</p>
|
||||
</a>
|
||||
{% else %}
|
||||
@@ -19,7 +15,8 @@
|
||||
{% endif %}
|
||||
|
||||
{% if page.next.url %}
|
||||
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary">
|
||||
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
|
||||
prompt="{{ site.data.label.post.button.next | default: 'next' }}">
|
||||
<p>{{ page.next.title }}</p>
|
||||
</a>
|
||||
{% else %}
|
||||
@@ -28,4 +25,4 @@
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<!--
|
||||
The paginator for post list on HomgPage.
|
||||
|
||||
v2.1
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
<ul class="pagination mt-4 mb-0 pl-lg-2">
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
<!--
|
||||
Post sharing snippet
|
||||
|
||||
v2.1
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2019 Cotes Chung
|
||||
Published under the MIT License
|
||||
-->
|
||||
|
||||
<div class="share-wrapper">
|
||||
<span class="share-label text-muted mr-1">{{ site.data.share.label }}</span>
|
||||
<span class="share-label text-muted mr-1">{{ site.data.label.post.share | default: 'Share' }}</span>
|
||||
<span class="share-icons">
|
||||
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
|
||||
{% assign url = page.url | relative_url | prepend: site.url %}
|
||||
{% assign url = page.url | absolute_url %}
|
||||
|
||||
{% for share in site.data.share.platforms %}
|
||||
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
|
||||
|
||||
@@ -3,13 +3,17 @@
|
||||
-->
|
||||
{% assign words = include.content | strip_html | number_of_words: "auto" %}
|
||||
|
||||
{% assign read_time = words | divided_by: site.data.read_time.wpm %}
|
||||
<!-- words per minute -->
|
||||
{% assign wpm = 180 %}
|
||||
{% assign min_time = 1 %}
|
||||
|
||||
{% assign read_time = words | divided_by: wpm %}
|
||||
|
||||
{% unless read_time > 0 %}
|
||||
{% assign read_time = site.data.read_time.min_time %}
|
||||
{% assign read_time = min_time %}
|
||||
{% endunless %}
|
||||
|
||||
<!-- return element -->
|
||||
<span class="readtime" data-toggle="tooltip" data-placement="bottom" title="{{ words }} words">
|
||||
{{- read_time -}}{{" "}}{{- site.data.read_time.prompt -}}
|
||||
{{- read_time -}}{{" "}}{{- site.data.label.read_time_unit | default: "min" -}}
|
||||
</span>
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
|
||||
{% assign _content = include.content %}
|
||||
|
||||
<!-- Suroundding the markdown table with '<div class="table-wrapper">. and '</div>' -->
|
||||
<!--
|
||||
In order to allow a wide table to scroll horizontally,
|
||||
we suround the markdown table with `<div class="table-wrapper">` and `</div>`
|
||||
-->
|
||||
{% if _content contains '<table>' %}
|
||||
{% assign _content = _content
|
||||
| replace: '<table>', '<div class="table-wrapper"><table>'
|
||||
@@ -32,5 +35,32 @@
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
{% if _content contains '<img src="' %}
|
||||
|
||||
{% if site.img_cdn != '' %}
|
||||
{% assign img_path_replacement = '<img src="' | append: site.img_cdn | append: '/' %}
|
||||
{% else %}
|
||||
{% assign img_path_replacement = '<img src="' | append: site.baseurl | append: '/' %}
|
||||
{% endif %}
|
||||
|
||||
{% assign _content = _content | replace: '<img src="/', img_path_replacement %}
|
||||
|
||||
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
||||
{% assign lozad = true %}
|
||||
{% assign img_placehodler
|
||||
= 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' %}
|
||||
|
||||
{% assign lozad_replacement = '<img src="'
|
||||
| append: img_placehodler
|
||||
| append: '" data-src="' %}
|
||||
|
||||
{% assign _content = _content | replace: '<img src="', lozad_replacement %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
<!-- return -->
|
||||
{{ _content }}
|
||||
|
||||
{% if lozad %}
|
||||
{% include lozad.html %}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
<!--
|
||||
Recommend the other 3 posts according to the tags and categories of the current post,
|
||||
if the number is not enough, use the other latest posts to supplement.
|
||||
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2019 Cotes Chung
|
||||
Published under the MIT License
|
||||
-->
|
||||
|
||||
<!-- The total size of related posts -->
|
||||
@@ -85,7 +80,8 @@
|
||||
|
||||
{% if index_list.size > 0 %}
|
||||
<div id="related-posts" class="mt-5 mb-2 mb-sm-4">
|
||||
<h3 class="pt-2 mt-1 mb-4 ml-1" data-toc-skip>{{ site.data.label.post.relate_posts }}</h3>
|
||||
<h3 class="pt-2 mt-1 mb-4 ml-1"
|
||||
data-toc-skip>{{ site.data.label.post.relate_posts | default: 'Further Reading' }}</h3>
|
||||
<div class="card-deck mb-4">
|
||||
{% for entry in index_list %}
|
||||
{% assign index = entry | plus: 0 %}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<!--
|
||||
Jekyll Simple Search loader
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2017-2019 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
{% capture result_elem %}
|
||||
@@ -25,8 +21,8 @@
|
||||
SimpleJekyllSearch({
|
||||
searchInput: document.getElementById('search-input'),
|
||||
resultsContainer: document.getElementById('search-results'),
|
||||
json: '{{ site.baseurl }}/assets/js/data/search.json',
|
||||
json: '{{ '/assets/js/data/search.json' | relative_url }}',
|
||||
searchResultTemplate: '{{ result_elem | strip_newlines }}',
|
||||
noResultsText: '{{ not_found }}'
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
<!--
|
||||
The Search results
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2017-2019 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
|
||||
<div class="col-12 col-xl-11 post-content">
|
||||
<div id="search-hints">
|
||||
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags }}</h4>
|
||||
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags | default: 'Trending Tags' }}</h4>
|
||||
|
||||
{% include trending-tags.html %}
|
||||
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
<!--
|
||||
The Side Bar
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2017-2019 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
<div id="nav-wrapper">
|
||||
<div id="sidebar" class="d-flex flex-column align-items-end">
|
||||
|
||||
<div id="profile-wrapper" class="d-flex flex-column">
|
||||
<div id="avatar" class="d-flex justify-content-center">
|
||||
<a href="{{ site.baseurl }}/" alt="avatar">
|
||||
{% assign avatar_url = site.avatar %}
|
||||
{% capture start %}{{ site.avatar | slice: 0 }}{% endcapture %}
|
||||
{% if start == '/' %}
|
||||
{% assign avatar_url = avatar_url | prepend: site.baseurl %}
|
||||
{% endif %}
|
||||
<div class="profile-wrapper text-center">
|
||||
<div id="avatar">
|
||||
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto">
|
||||
{% capture avatar_url %}
|
||||
{%- if site.avatar contains '://' -%}
|
||||
{{ site.avatar }}
|
||||
{%- elsif site.img_cdn != '' and site.img_cdn -%}
|
||||
{{ site.avatar | prepend: site.img_cdn }}
|
||||
{%- else -%}
|
||||
{{ site.avatar | relative_url }}
|
||||
{%- endif -%}
|
||||
{% endcapture %}
|
||||
<img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="profile-text mt-3">
|
||||
<div class="site-title">
|
||||
<a href="{{ '/' | relative_url }}">{{- site.title -}}</a>
|
||||
</div>
|
||||
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
|
||||
<div class="site-title mt-3">
|
||||
<a href="{{ '/' | relative_url }}">{{- site.title -}}</a>
|
||||
</div>
|
||||
</div><!-- #profile-wrapper -->
|
||||
|
||||
<ul class="nav flex-column">
|
||||
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
|
||||
|
||||
</div><!-- .profile-wrapper -->
|
||||
|
||||
<ul class="w-100">
|
||||
<!-- home -->
|
||||
<li class="nav-item d-flex justify-content-center {% if page.layout == 'home' %}active{% endif %}">
|
||||
<a href="{{ '/' | relative_url }}" class="nav-link d-flex justify-content-center align-items-center w-100">
|
||||
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
|
||||
<a href="{{ '/' | relative_url }}" class="nav-link">
|
||||
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
|
||||
<span>{{ "HOME" }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- the real tabs -->
|
||||
{% for tab in site.tabs %}
|
||||
<li class="nav-item d-flex justify-content-center {% if tab.url == page.url %}active{% endif %}">
|
||||
<a href="{{ tab.url | relative_url }}" class="nav-link d-flex justify-content-center align-items-center w-100">
|
||||
<li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
|
||||
<a href="{{ tab.url | relative_url }}" class="nav-link">
|
||||
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
|
||||
<span>{{ tab.title | upcase }}</span>
|
||||
</a>
|
||||
@@ -48,38 +48,44 @@
|
||||
|
||||
</ul> <!-- ul.nav.flex-column -->
|
||||
|
||||
</div><!-- #nav-wrapper -->
|
||||
<div class="sidebar-bottom mt-auto d-flex flex-wrap justify-content-center">
|
||||
|
||||
<div class="sidebar-bottom d-flex flex-wrap justify-content-around mt-4">
|
||||
{% for entry in site.data.contact %}
|
||||
{% capture url %}
|
||||
{%- if entry.type == 'github' -%}
|
||||
https://github.com/{{ site.github.username }}
|
||||
{%- elsif entry.type == 'twitter' -%}
|
||||
https://twitter.com/{{ site.twitter.username }}
|
||||
{%- elsif entry.type == 'email' -%}
|
||||
{% assign email = site.social.email | split: '@' %}
|
||||
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
|
||||
{%- elsif entry.type == 'rss' -%}
|
||||
{{ "/feed.xml" | relative_url }}
|
||||
{%- else -%}
|
||||
{{ entry.url }}
|
||||
{%- endif -%}
|
||||
{% endcapture %}
|
||||
|
||||
{% unless site.theme_mode %}
|
||||
<span id="mode-toggle-wrapper">
|
||||
{% include mode-toggle.html %}
|
||||
</span>
|
||||
<span class="icon-border"></span>
|
||||
{% endunless %}
|
||||
{% if url %}
|
||||
<a href="{{ url }}" aria-label="{{ entry.type }}"
|
||||
{% unless site.theme_mode %}class="order-{{ forloop.index | plus: 2 }}"{% endunless %}
|
||||
{% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
|
||||
<i class="{{ entry.icon }}"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% for entry in site.data.contact %}
|
||||
{% capture url %}
|
||||
{%- if entry.type == 'github' -%}
|
||||
https://github.com/{{ site.github.username }}
|
||||
{%- elsif entry.type == 'twitter' -%}
|
||||
https://twitter.com/{{ site.twitter.username }}
|
||||
{%- elsif entry.type == 'email' -%}
|
||||
{% assign email = site.social.email | split: '@' %}
|
||||
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
|
||||
{%- elsif entry.type == 'rss' -%}
|
||||
{{ "/feed.xml" | relative_url }}
|
||||
{%- else -%}
|
||||
{{ entry.url }}
|
||||
{%- endif -%}
|
||||
{% endcapture %}
|
||||
{% endfor %}
|
||||
|
||||
{% if url %}
|
||||
<a href="{{ url }}" aria-label="{{ entry.type }}" {% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
|
||||
<i class="{{ entry.icon }}"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% unless site.theme_mode %}
|
||||
{% if site.data.contact.size > 0 %}
|
||||
<span class="icon-border order-2"></span>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
<span id="mode-toggle-wrapper" class="order-1">
|
||||
{% include mode-toggle.html %}
|
||||
</span>
|
||||
{% endunless %}
|
||||
|
||||
</div> <!-- .sidebar-bottom -->
|
||||
|
||||
</div><!-- #sidebar -->
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<!--
|
||||
Date format snippet
|
||||
|
||||
v2.4.1
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
{% assign tooltip_df = site.data.date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
|
||||
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
|
||||
{% assign post_short_df = site.data.date_format.post.short | default: '%b %e' %}
|
||||
|
||||
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
|
||||
{% if include.tooltip %}
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
title="{{ include.date | date: site.data.date_format.tooltip }}"
|
||||
title="{{ include.date | date: tooltip_df }}"
|
||||
{% endif %}>
|
||||
|
||||
{% assign this_year = site.time | date: "%Y" %}
|
||||
{% assign post_year = include.date | date: "%Y" %}
|
||||
|
||||
{% if post_year == this_year %}
|
||||
{{ include.date | date: site.data.date_format.post.short }}
|
||||
{{ include.date | date: post_short_df }}
|
||||
{% else %}
|
||||
{{ include.date | date: site.data.date_format.post.long }}
|
||||
{{ include.date | date: post_long_df }}
|
||||
{% endif %}
|
||||
|
||||
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
|
||||
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<!--
|
||||
The Top Bar
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2017-2019 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
|
||||
<div id="topbar-wrapper" class="row justify-content-center topbar-down">
|
||||
<div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between">
|
||||
<span id="breadcrumb">
|
||||
@@ -42,7 +39,7 @@
|
||||
<span id="search-wrapper" class="align-items-center">
|
||||
<i class="fas fa-search fa-fw"></i>
|
||||
<input class="form-control" id="search-input" type="search"
|
||||
aria-label="search" placeholder="{{ site.data.label.search_hint }}...">
|
||||
aria-label="search" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
|
||||
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
|
||||
</span>
|
||||
<span id="search-cancel" >Cancel</span>
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{% comment %}
|
||||
The trending tags list
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2019 Cotes Chung
|
||||
MIT Licensed
|
||||
{% endcomment %}
|
||||
|
||||
{% assign MAX = 10 %}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{% comment %}
|
||||
Get the last 5 posts from lastmod list.
|
||||
v2.2
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT License
|
||||
{% endcomment %}
|
||||
|
||||
{% assign MAX_SIZE = 5 %}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
layout: page
|
||||
|
||||
# The Archives of posts.
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
layout: page
|
||||
|
||||
# All the Categories of posts
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
---
|
||||
layout: page
|
||||
# The Category layout
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# MIT Licensed
|
||||
---
|
||||
|
||||
<div id="page-category">
|
||||
@@ -14,11 +11,13 @@ layout: page
|
||||
</h1>
|
||||
|
||||
<ul class="post-content pl-0">
|
||||
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
|
||||
|
||||
{% for post in page.posts %}
|
||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
|
||||
<span class="text-muted small">{{ post.date | date: post_long_df }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
---
|
||||
layout: compress
|
||||
# Default layout
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT Licensed
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -21,9 +17,7 @@ layout: compress
|
||||
|
||||
<body data-spy="scroll" data-target="#toc">
|
||||
|
||||
<div id="sidebar" class="d-flex flex-column">
|
||||
{% include sidebar.html %}
|
||||
</div>
|
||||
{% include sidebar.html %}
|
||||
|
||||
{% include topbar.html %}
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
---
|
||||
layout: page
|
||||
# The Home page layout
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT Licensed
|
||||
---
|
||||
|
||||
|
||||
@@ -49,9 +45,9 @@ layout: page
|
||||
{% for post in posts %}
|
||||
|
||||
<div class="post-preview">
|
||||
<a href="{{ post.url | relative_url }}">
|
||||
<h1>{{ post.title }}</h1>
|
||||
</a>
|
||||
<h1>
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
</h1>
|
||||
|
||||
<div class="post-content">
|
||||
<p>
|
||||
@@ -83,7 +79,7 @@ layout: page
|
||||
{% if post.pin %}
|
||||
<div class="pin">
|
||||
<i class="fas fa-thumbtack fa-fw"></i>
|
||||
<span>{{ site.data.label.pin_prompt }}</span>
|
||||
<span>{{ site.data.label.pin_prompt | default: 'Pinned' }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
---
|
||||
layout: default
|
||||
# The page layout
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
<div class="row">
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
---
|
||||
layout: default
|
||||
# The posts' layout
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT Licensed
|
||||
---
|
||||
|
||||
<div class="row">
|
||||
@@ -47,21 +43,13 @@ layout: default
|
||||
</div> <!-- .post-meta -->
|
||||
|
||||
<div class="post-content">
|
||||
{%- capture img_placehodler -%}
|
||||
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
{%- endcapture -%}
|
||||
|
||||
{% if page.image %}
|
||||
<img src="{{ img_placehodler }}" data-src="{{ page.image }}" class="preview-img">
|
||||
<img src="{{ page.image }}" class="preview-img" alt="Preview Image">
|
||||
{% endif %}
|
||||
|
||||
<!-- Using lozad. See: <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
||||
{% if content contains '<img src=' %}
|
||||
{% assign replacement = '<img src="' | append: img_placehodler | append: '" data-src=' %}
|
||||
{{ content | replace: '<img src=', replacement }}
|
||||
{% else %}
|
||||
{{ content }}
|
||||
{% endif %}
|
||||
{{ content }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="post-tail-wrapper text-muted">
|
||||
@@ -111,7 +99,15 @@ layout: default
|
||||
|
||||
</div> <!-- #post-wrapper -->
|
||||
|
||||
{% include panel.html %}
|
||||
{% assign enable_toc = false %}
|
||||
|
||||
{% if site.toc and page.toc %}
|
||||
{% if content contains '<h2' or content contains '<h3' %}
|
||||
{% assign enable_toc = true %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% include panel.html toc=enable_toc %}
|
||||
|
||||
</div> <!-- .row -->
|
||||
|
||||
@@ -132,5 +128,3 @@ layout: default
|
||||
</div> <!-- .col-* -->
|
||||
|
||||
</div> <!-- .row -->
|
||||
|
||||
{% include lozad.html %}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
---
|
||||
layout: page
|
||||
# The layout for Tag page
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT Licensed
|
||||
---
|
||||
|
||||
|
||||
<div id="page-tag">
|
||||
<h1 class="pl-lg-2">
|
||||
<i class="fa fa-tag fa-fw text-muted"></i>
|
||||
@@ -14,11 +11,13 @@ layout: page
|
||||
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
|
||||
</h1>
|
||||
<ul class="post-content pl-0">
|
||||
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
|
||||
|
||||
{% for post in page.posts %}
|
||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
|
||||
<span class="text-muted small">{{ post.date | date: post_long_df }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
layout: page
|
||||
|
||||
# All the Tags of posts.
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
<div id="tags" class="d-flex flex-wrap ml-xl-2 mr-xl-2">
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
#
|
||||
# Check for changed posts
|
||||
|
||||
Jekyll::Hooks.register :posts, :post_init do |post|
|
||||
|
||||
commit_num = `git rev-list --count HEAD "#{ post.path }"`
|
||||
|
||||
@@ -6,7 +6,7 @@ categories: [Blogging, Demo]
|
||||
tags: [typography]
|
||||
math: true
|
||||
mermaid: true
|
||||
image: /assets/img/sample/devices-mockup.png
|
||||
image: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
|
||||
---
|
||||
|
||||
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
|
||||
@@ -38,7 +38,7 @@ Beside the lake, beneath the trees,
|
||||
|
||||
Fluttering and dancing in the breeze.
|
||||
|
||||
## List
|
||||
## Lists
|
||||
|
||||
### Ordered list
|
||||
|
||||
@@ -52,7 +52,7 @@ Fluttering and dancing in the breeze.
|
||||
- Setcion
|
||||
- Paragraph
|
||||
|
||||
### Checkbox list
|
||||
### Task list
|
||||
|
||||
- [ ] TODO
|
||||
- [x] Completed
|
||||
@@ -62,60 +62,69 @@ Fluttering and dancing in the breeze.
|
||||
- [ ] Economic recovery
|
||||
- [ ] People smile again
|
||||
|
||||
### Description list
|
||||
|
||||
Sun
|
||||
: the star around which the earth orbits
|
||||
|
||||
Moon
|
||||
: the natural satellite of the earth, visible by reflected light from the sun
|
||||
|
||||
|
||||
## Block Quote
|
||||
|
||||
> This line to shows the Block Quote.
|
||||
|
||||
## Tables
|
||||
|
||||
| Company | contact | Country |
|
||||
| Company | Contact | Country |
|
||||
|:-----------------------------|:-----------------|--------:|
|
||||
| Alfreds Futterkiste | Maria Anders | Germany |
|
||||
| Island Trading | Helen Bennett | UK |
|
||||
| Magazzini Alimentari Riuniti | Giovanni Rovelli | Italy |
|
||||
|
||||
## Link
|
||||
## Links
|
||||
|
||||
<http://127.0.0.1:4000>
|
||||
|
||||
|
||||
## Footnote
|
||||
|
||||
Click the hook will locate the footnote[^footnote].
|
||||
Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2].
|
||||
|
||||
|
||||
## Images
|
||||
|
||||
- Default (with caption)
|
||||
|
||||

|
||||

|
||||
_Full screen width and center alignment_
|
||||
|
||||
<br>
|
||||
|
||||
- Specify width
|
||||
|
||||
{: width="400"}
|
||||
{: width="400"}
|
||||
_400px image width_
|
||||
|
||||
<br>
|
||||
|
||||
- Left aligned
|
||||
|
||||
{: width="350" .normal}
|
||||
{: width="350" .normal}
|
||||
|
||||
<br>
|
||||
|
||||
- Float to left
|
||||
|
||||
{: width="240" .left}
|
||||
{: width="240" .left}
|
||||
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
|
||||
|
||||
<br>
|
||||
|
||||
- Float to right
|
||||
|
||||
{: width="240" .right}
|
||||
{: width="240" .right}
|
||||
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
|
||||
|
||||
<br>
|
||||
@@ -130,9 +139,6 @@ _400px image width_
|
||||
cherry :active, c, after b a, 1d
|
||||
```
|
||||
|
||||
## Inline code
|
||||
|
||||
This is an example of `Inline Code`.
|
||||
|
||||
## Mathematics
|
||||
|
||||
@@ -144,7 +150,13 @@ When \\(a \ne 0\\), there are two solutions to \\(ax^2 + bx + c = 0\\) and they
|
||||
|
||||
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
|
||||
|
||||
## Code Snippet
|
||||
|
||||
## Inline code
|
||||
|
||||
This is an example of `Inline Code`.
|
||||
|
||||
|
||||
## Code block
|
||||
|
||||
### Common
|
||||
|
||||
@@ -157,14 +169,6 @@ This is a common code snippet, without syntax highlight and line number.
|
||||
#### Console
|
||||
|
||||
```console
|
||||
$ date
|
||||
Sun Nov 3 15:11:12 CST 2019
|
||||
```
|
||||
|
||||
|
||||
#### Terminal
|
||||
|
||||
```terminal
|
||||
$ env |grep SHELL
|
||||
SHELL=/usr/local/bin/bash
|
||||
PYENV_SHELL=bash
|
||||
@@ -198,23 +202,6 @@ fi;
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
#### Html
|
||||
|
||||
```html
|
||||
<div class="sidenav">
|
||||
<a href="#contact">Contact</a>
|
||||
<button class="dropdown-btn">Dropdown
|
||||
<i class="fa fa-caret-down"></i>
|
||||
</button>
|
||||
<div class="dropdown-container">
|
||||
<a href="#">Link 1</a>
|
||||
<a href="#">Link 2</a>
|
||||
<a href="#">Link 3</a>
|
||||
</div>
|
||||
<a href="#contact">Search</a>
|
||||
</div>
|
||||
```
|
||||
|
||||
#### Java
|
||||
|
||||
```java
|
||||
@@ -222,20 +209,11 @@ private void writeObject(java.io.ObjectOutputStream s)
|
||||
throws java.io.IOException {
|
||||
// Write out any hidden serialization magic
|
||||
s.defaultWriteObject();
|
||||
|
||||
// Write out HashMap capacity and load factor
|
||||
s.writeInt(map.capacity());
|
||||
s.writeFloat(map.loadFactor());
|
||||
|
||||
// Write out size
|
||||
s.writeInt(map.size());
|
||||
|
||||
// Write out all elements in the proper order.
|
||||
for (E e: map.keySet())
|
||||
s.writeObject(e);
|
||||
for (E e: map.keySet()) s.writeObject(e);
|
||||
}
|
||||
```
|
||||
|
||||
## Reverse Footnote
|
||||
|
||||
[^footnote]: The footnote source.
|
||||
[^footnote]: The footnote source
|
||||
[^fn-nth-2]: The 2nd footnote source
|
||||
|
||||
@@ -8,7 +8,7 @@ tags: [writing]
|
||||
|
||||
## Naming and Path
|
||||
|
||||
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION` and put it in the `_post/` of the root directory. Please note that the `EXTENSION` must be one of `md` and `markdown`.
|
||||
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION` and put it in the `_posts/` of the root directory. Please note that the `EXTENSION` must be one of `md` and `markdown`.
|
||||
|
||||
## Front Matter
|
||||
|
||||
@@ -78,7 +78,7 @@ mermaid: true
|
||||
---
|
||||
```
|
||||
|
||||
Then you can use it like other markdown language: surround the graph code with <code class="highlighter-rouge">```mermaid</code>.
|
||||
Then you can use it like other markdown language: surround the graph code with ```` ```mermaid ```` and ```` ``` ````.
|
||||
|
||||
## Images
|
||||
|
||||
@@ -118,22 +118,44 @@ By default, the image is centered, but you can specify the position by using one
|
||||
Image will be left aligned in below sample:
|
||||
|
||||
```markdown
|
||||
{: width="350" .normal}
|
||||
{: .normal}
|
||||
```
|
||||
|
||||
- **Float to the left**
|
||||
|
||||
```markdown
|
||||
{: width="240" .left}
|
||||
{: .left}
|
||||
```
|
||||
|
||||
- **Float to the right**
|
||||
|
||||
```markdown
|
||||
{: width="240" .right}
|
||||
{: .right}
|
||||
```
|
||||
|
||||
> **Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
|
||||
**Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
|
||||
|
||||
### CDN URL
|
||||
|
||||
If you host the images on the CDN, you can save the time of repeatedly writing the CDN url by assigning the variable `img_cdn` of `_config.yml` file:
|
||||
|
||||
```yaml
|
||||
img_cdn: https://cdn.com
|
||||
```
|
||||
|
||||
Once `img_cdn` is assigned, the CDN url will be added to the path of all images (images of site avatar and posts) starting with `/`.
|
||||
|
||||
For instance, when using images:
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||
The parsing result will automatically add the CDN prefix `https://cdn.com` before the image path:
|
||||
|
||||
```html
|
||||
<img src="https://cdn.com/path/to/flower.png" alt="The flower">
|
||||
```
|
||||
|
||||
## Pinned Posts
|
||||
|
||||
@@ -147,7 +169,7 @@ pin: true
|
||||
|
||||
## Code Block
|
||||
|
||||
Markdown symbols <code class="highlighter-rouge">```</code> can easily create a code block as following examples.
|
||||
Markdown symbols ```` ``` ```` can easily create a code block as following examples.
|
||||
|
||||
```
|
||||
This is a common code snippet, without syntax highlight and line number.
|
||||
@@ -155,7 +177,7 @@ This is a common code snippet, without syntax highlight and line number.
|
||||
|
||||
## Specific Language
|
||||
|
||||
Using <code class="highlighter-rouge">```language</code> you will get code snippets with line numbers and syntax highlight.
|
||||
Using ```` ```language ```` you will get code snippets with line numbers and syntax highlight.
|
||||
|
||||
> **Note**: The Jekyll style `{% raw %}{%{% endraw %} highlight LANGUAGE {% raw %}%}{% endraw %}` or `{% raw %}{%{% endraw %} highlight LANGUAGE linenos {% raw %}%}{% endraw %}` are not allowed to be used in this theme !
|
||||
|
||||
|
||||
@@ -7,106 +7,137 @@ tags: [getting started]
|
||||
pin: true
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
|
||||
|
||||
## Installation
|
||||
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub, rename the repository to `USERNAME.github.io` (where `USERNAME` is your GitHub username), and then open terminal and clone the fork to local by:
|
||||
There are two ways to get the theme:
|
||||
|
||||
```terminal
|
||||
$ git clone https://github.com/USERNAME/USERNAME.github.io.git -b master --single-branch
|
||||
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy)
|
||||
- Fork from GitHub
|
||||
|
||||
### Install From Rubygems
|
||||
|
||||
Add this line to your Jekyll site's `Gemfile`:
|
||||
|
||||
```ruby
|
||||
gem "jekyll-theme-chirpy"
|
||||
```
|
||||
|
||||
### Setting up the local envrionment
|
||||
And add this line to your Jekyll site's `_config.yml`:
|
||||
|
||||
If you would like to run or build the project on your local machine, please follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
|
||||
|
||||
Before running or building for the first time, please complete the installation of the Jekyll plugins. Go to the root directory of project and run:
|
||||
|
||||
```terminal
|
||||
$ bundle install
|
||||
```yaml
|
||||
theme: jekyll-theme-chirpy
|
||||
```
|
||||
|
||||
`bundle` will automatically install all the dependencies specified by `Gemfile`.
|
||||
|
||||
### Setting up Docker environment (optional)
|
||||
|
||||
If you're a loyal fan of [**Docker**](https://www.docker.com/) or just too lazy to install the packages mentioned in [_Setting up the local envrionment_](#setting-up-the-local-envrionment), please make sure you have **Docker Engine** installed and running, and then get Docker image `jekyll/jekyll` from Docker Hub by the following command:
|
||||
And then execute:
|
||||
|
||||
```console
|
||||
$ docker pull jekyll/jekyll
|
||||
$ bundle
|
||||
```
|
||||
|
||||
## Usage
|
||||
Finally, copy the missing files (refer to the [starter project][starter] for the detailed file directory structure) from the theme's gem to your Jekyll site, and append all the variables of the theme's `_config.yml` to your Jekyll site.
|
||||
|
||||
### Initialization
|
||||
> **Hint**: To locate the theme’s gem, execute:
|
||||
>
|
||||
```console
|
||||
$ bundle info --path jekyll-theme-chirpy
|
||||
```
|
||||
|
||||
Go to the root directory of the project and start initialization:
|
||||
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem.
|
||||
|
||||
[starter]: https://github.com/cotes2020/chirpy-starter
|
||||
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
|
||||
|
||||
### Fork From GitHub
|
||||
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local.
|
||||
|
||||
Install gem dependencies by:
|
||||
|
||||
```console
|
||||
$ bundle
|
||||
```
|
||||
|
||||
And then execute:
|
||||
|
||||
```console
|
||||
$ bash tools/init.sh
|
||||
```
|
||||
|
||||
> **Note**: If you not intend to deploy it on GitHub Pages, append parameter option `--no-gh` at the end of the above command.
|
||||
> **Note**: If you don't plan to deploy your site on GitHub Pages, append parameter option `--no-gh` at the end of the above command.
|
||||
|
||||
What it does is:
|
||||
|
||||
1. Remove some files or directories from your repository:
|
||||
1. Remove some files or directories from your repository:
|
||||
|
||||
- `.travis.yml`
|
||||
- files under `_posts`
|
||||
- folder `docs`
|
||||
- `.travis.yml`
|
||||
- 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.
|
||||
3. Automatically create a commit to save the changes.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Configuration
|
||||
|
||||
Generally, go to `_config.yml` and configure the variables as needed. Some of them are typical options:
|
||||
Update the variables of `_config.yml` as needed. Some of them are typical options:
|
||||
|
||||
- `url`
|
||||
- `avatar`
|
||||
- `timezone`
|
||||
- `theme_mode`
|
||||
- `url`
|
||||
- `avatar`
|
||||
- `timezone`
|
||||
- `theme_mode`
|
||||
|
||||
### Run Locally
|
||||
### Running Local Server
|
||||
|
||||
You may want to preview the site contents before publishing, so just run it by:
|
||||
|
||||
```terminal
|
||||
```console
|
||||
$ bundle exec jekyll s
|
||||
```
|
||||
|
||||
Then open a browser and visit to <http://localhost:4000>.
|
||||
|
||||
### Run on Docker
|
||||
|
||||
Run the site on Docker with the following command:
|
||||
Or run the site on Docker with the following command:
|
||||
|
||||
```terminal
|
||||
$ docker run --rm -it \
|
||||
$ docker run -it --rm \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
-p 4000:4000 jekyll/jekyll \
|
||||
jekyll serve
|
||||
```
|
||||
|
||||
Open a browser and visit to _<http://localhost:4000>_.
|
||||
|
||||
### Deployment
|
||||
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [_project site_](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash. For example, `/project`.
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
|
||||
|
||||
Assuming you have already gone through the [initialization](#initialization), you can now choose ONE of the following methods to deploy your website.
|
||||
Now you can now choose ONE of the following methods to deploy your website.
|
||||
|
||||
#### Deploy on GitHub Pages
|
||||
|
||||
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the Pages service.
|
||||
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the GH Pages service.
|
||||
|
||||
1. Push any commit to `origin/master` to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
|
||||
Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`.
|
||||
Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
|
||||
|
||||
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"}
|
||||
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
|
||||
|
||||
3. Visit your website at the address indicated by GitHub.
|
||||
Rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
|
||||
|
||||
And then publish your site by:
|
||||
|
||||
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
|
||||
|
||||
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_:
|
||||
|
||||

|
||||
|
||||
3. Visit your website at the address indicated by GitHub.
|
||||
|
||||
#### Deploy on Other Platforms
|
||||
|
||||
@@ -118,7 +149,7 @@ Go to the root of the source project, build your site by:
|
||||
$ JEKYLL_ENV=production bundle exec jekyll b
|
||||
```
|
||||
|
||||
Or, build the site with Docker by:
|
||||
Or build the site with Docker by:
|
||||
|
||||
```terminal
|
||||
$ docker run -it --rm \
|
||||
|
||||
@@ -11,17 +11,17 @@ In [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/), the image fi
|
||||
|
||||
With a square image (PNG, JPG or GIF) in hand, open the site [*Favicon & App Icon Generator*](https://www.favicon-generator.org/) and upload your original image.
|
||||
|
||||

|
||||

|
||||
|
||||
Click button <kbd>Create Favicon</kbd> and wait a moment for the website to generate the icons of various sizes automatically.
|
||||
|
||||
{: width="600"}
|
||||
{: width="600"}
|
||||
|
||||
Download the generated package, unzip and delete the following two from the extracted files:
|
||||
|
||||
- browserconfig.xml
|
||||
- manifest.json
|
||||
|
||||
|
||||
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/`.
|
||||
|
||||
The following table helps you understand the changes to the icon file:
|
||||
|
||||
245
_posts/2021-01-03-enable-google-pv.md
Normal file
245
_posts/2021-01-03-enable-google-pv.md
Normal file
@@ -0,0 +1,245 @@
|
||||
---
|
||||
title: Enable Google Page Views
|
||||
author: Dinesh Prasanth Moluguwan Krishnamoorthy
|
||||
date: 2021-01-03 18:32:00 -0500
|
||||
categories: [Blogging, Tutorial]
|
||||
tags: [google analytics, pageviews]
|
||||
---
|
||||
|
||||
|
||||
This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme based blog that you just built. This requires technical knowledge and it's recommended to keep the `google_analytics.pv` disabled unless you have a good reason. If your website has low traffic, the page views count would discourage you to write more blogs. With that said, let's start with the setup.
|
||||
|
||||
## Set up Google Analytics
|
||||
|
||||
### Create GA account and property
|
||||
|
||||
First, you need to setup your account on Google analytics. While your create your account, you must create your first **Property** as well.
|
||||
|
||||
1. Head to <https://analytics.google.com/> and click on **Start Measuring**
|
||||
2. Enter your desired *Account Name* and choose the desired checkboxes
|
||||
3. Enter your desired *Property Name*. This is the name of the tracker project that appears on your Google Analytics dashboard
|
||||
4. Enter the required information *About your business*
|
||||
5. Hit *Create* and accept any license popup to setup your Google Analytics account and create your property
|
||||
|
||||
### Create Data Stream
|
||||
|
||||
With your property created, you now need to set up Data Stream to track your blog traffic. After you signup, the prompt should automatically take you to creating your first **Data Stream**. If not, follow these steps:
|
||||
|
||||
1. Go to **Admin** on the left column
|
||||
2. Select the desired property from the drop down on the second column
|
||||
3. Click on **Data Streams**
|
||||
4. Add a stream and click on **Web**
|
||||
5. Enter your blog's URL
|
||||
|
||||
It should look like this:
|
||||
|
||||

|
||||
|
||||
Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml` file
|
||||
|
||||
```yaml
|
||||
google_analytics:
|
||||
id: 'G-V6XXXXXXX' # Fill with your Google Analytics ID
|
||||
pv:
|
||||
# The Google Analytics pageviews switch.
|
||||
enabled: false
|
||||
# the next options only valid when `google_analytics.pv` is enabled.
|
||||
proxy_url: ''
|
||||
proxy_endpoint: ''
|
||||
cache: false # pv data local cache, good for the users from GFW area.
|
||||
```
|
||||
|
||||
When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pickup your changes. You should now be able to monitor your traffic in realtime.
|
||||
|
||||

|
||||
|
||||
## Setup Page Views
|
||||
|
||||
There is a detailed [tutorial](https://developers.google.com/analytics/solutions/google-analytics-super-proxy) available to set up Google Analytics superProxy. But, if you are interested to just quickly get your Chirpy-based blog display page views, follow along. These steps were tested on a Linux machine. If you are running Windows, you can use Git bash terminal to run Unix-like commands.
|
||||
|
||||
### Setup Google App Engine
|
||||
|
||||
1. Visit <https://console.cloud.google.com/appengine>
|
||||
|
||||
2. Click on **Create Application**
|
||||
|
||||
3. Click on **Create Project**
|
||||
|
||||
4. Enter the name and choose the data center close to you
|
||||
|
||||
5. Select **Python** language and **Standard** environment
|
||||
|
||||
6. Enable billing account. Yeah, you have to link your credit card. But, you won't be billed unless you exceed your free quota. For a simple blog, free quota is more than sufficient.
|
||||
|
||||
7. Go to your App Engine dashboard on your browser and select **API & Services** from the left navigation menu
|
||||
|
||||
8. Click on **Enable APIs and Services** button on the top
|
||||
|
||||
9. Enable the following APIs: *Google Analytics API*
|
||||
|
||||
10. On the left, Click on *OAuth Consent Screen* and accept **Configure Consent Screen**. Select **External** since your blog is probably hosted for the public. Click on **Publish** under *Publishing Status*
|
||||
|
||||
11. Click on **Credentials** on the left and create a new **OAuth Client IDs** credential. Make sure to add a entry under `Authorized redirect URIs` that matches: `https://<project-id>.<region>.r.appspot.com/admin/auth`
|
||||
|
||||
12. Note down the **Your Client ID** and **Your Client Secret**. You'll need this in the next section.
|
||||
|
||||
13. Download and install the cloud SDK for your platform: <https://cloud.google.com/sdk/docs/quickstart>
|
||||
|
||||
14. Run the following commands:
|
||||
|
||||
```console
|
||||
[root@bc96abf71ef8 /]# gcloud init
|
||||
|
||||
~snip~
|
||||
|
||||
Go to the following link in your browser:
|
||||
|
||||
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=XYZ.apps.googleusercontent.com&redirect_uri=ABCDEFG
|
||||
|
||||
Enter verification code: <VERIFICATION CODE THAT YOU GET AFTER YOU VISIT AND AUTHENTICATE FROM THE ABOVE LINK>
|
||||
|
||||
You are logged in as: [blah_blah@gmail.com].
|
||||
|
||||
Pick cloud project to use:
|
||||
[1] chirpy-test-300716
|
||||
[2] Create a new project
|
||||
Please enter numeric choice or text value (must exactly match list
|
||||
item): 1
|
||||
|
||||
|
||||
[root@bc96abf71ef8 /]# gcloud info
|
||||
# Your selected project info should be displayed here
|
||||
```
|
||||
|
||||
### Setup Google Analytics superProxy
|
||||
|
||||
1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local.
|
||||
|
||||
2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file:
|
||||
```diff
|
||||
- application: your-project-id
|
||||
- version: 1
|
||||
```
|
||||
|
||||
3. In `src/config.py`, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from you App Engine Dashboard.
|
||||
|
||||
4. Enter any random key for `XSRF_KEY`, your `config.py` should look similar to this
|
||||
|
||||
```python
|
||||
#!/usr/bin/python2.7
|
||||
|
||||
__author__ = 'pete.frisella@gmail.com (Pete Frisella)'
|
||||
|
||||
# OAuth 2.0 Client Settings
|
||||
AUTH_CONFIG = {
|
||||
'OAUTH_CLIENT_ID': 'YOUR_CLIENT_ID',
|
||||
'OAUTH_CLIENT_SECRET': 'YOUR_CLIENT_SECRET',
|
||||
'OAUTH_REDIRECT_URI': '%s%s' % (
|
||||
'https://chirpy-test-XXXXXX.ue.r.appspot.com',
|
||||
'/admin/auth'
|
||||
)
|
||||
}
|
||||
|
||||
# XSRF Settings
|
||||
XSRF_KEY = 'OnceUponATimeThereLivedALegend'
|
||||
```
|
||||
**Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL.
|
||||
|
||||
5. From inside the src/ directory, deploy the app
|
||||
|
||||
```console
|
||||
[root@bc96abf71ef8 src]# gcloud app deploy
|
||||
Services to deploy:
|
||||
|
||||
descriptor: [/tmp/google-analytics-super-proxy/src/app.yaml]
|
||||
source: [/tmp/google-analytics-super-proxy/src]
|
||||
target project: [chirpy-test-XXXX]
|
||||
target service: [default]
|
||||
target version: [VESRION_NUM]
|
||||
target url: [https://chirpy-test-XXXX.ue.r.appspot.com]
|
||||
|
||||
|
||||
Do you want to continue (Y/n)? Y
|
||||
|
||||
Beginning deployment of service [default]...
|
||||
╔════════════════════════════════════════════════════════════╗
|
||||
╠═ Uploading 1 file to Google Cloud Storage ═╣
|
||||
╚════════════════════════════════════════════════════════════╝
|
||||
File upload done.
|
||||
Updating service [default]...done.
|
||||
Setting traffic split for service [default]...done.
|
||||
Deployed service [default] to [https://chirpy-test-XXXX.ue.r.appspot.com]
|
||||
|
||||
You can stream logs from the command line by running:
|
||||
$ gcloud app logs tail -s default
|
||||
|
||||
To view your application in the web browser run:
|
||||
$ gcloud app browse
|
||||
```
|
||||
|
||||
6. Visit the deployed service. Add a `/admin` to the end of the URL.
|
||||
|
||||
7. Click on **Authorize Users** and make sure to add yourself as a managed user.
|
||||
|
||||
8. If you get any errors, please Google it. The errors are self-explanatory and should be easy to fix.
|
||||
|
||||
If everything went good, you'll get this screen:
|
||||
|
||||

|
||||
|
||||
### Create Google Analytics Query
|
||||
|
||||
Head to `https://PROJECT_ID.REGION_ID.r.appspot.com/admin` and create a query after verifying the account. **GA Core Reporting API** query request can be created in [Query Explorer](https://ga-dev-tools.appspot.com/query-explorer/).
|
||||
|
||||
The query parameters are as follows:
|
||||
|
||||
- **start-date**: fill in the first day of blog posting
|
||||
|
||||
- **end-date**: fill in `today` (this is a parameter supported by GA Report, which means that it will always end according to the current query date)
|
||||
|
||||
- **metrics**: select `ga:pageviews`
|
||||
|
||||
- **dimensions**: select `ga:pagePath`
|
||||
|
||||
In order to reduce the returned results and reduce the network bandwidth, we add custom filtering rules [^ga-filters]:
|
||||
|
||||
- **filters**: fill in `ga:pagePath=~^/posts/.*/$;ga:pagePath!@=`
|
||||
|
||||
Among them, `;` means using _logical AND_ to concatenate two rules.
|
||||
|
||||
If the `site.baseurl` is specified, change the first filtering rule to `ga:pagePath=~^/BASE_URL/posts/.*/$`, where `BASE_URL` is the value of `site.baseurl`.
|
||||
|
||||
After <kbd>Run Query</kbd>, copy the generated contents of **API Query URI** at the bottom of the page, and fill in the **Encoded URI for the query** of SuperProxy on GAE.
|
||||
|
||||
After the query is saved on GAE, a **Public Endpoint** (public access address) will be generated, and we will get the query result in JSON format when accessing it. Finally, click <kbd>Enable Endpoint</kbd> in **Public Request Endpoint** to make the query effective, and click <kbd>Start Scheduling</kbd> in **Scheduling** to start the scheduled task.
|
||||
|
||||

|
||||
|
||||
|
||||
## Configure Chirpy to Display Page View
|
||||
|
||||
Once all the hard part is done, it is very easy to enable the Page View on Chirpy theme. Your superProxy dashboard should look something like below and you can grab the required values.
|
||||
|
||||

|
||||
|
||||
Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
|
||||
|
||||
```yaml
|
||||
google_analytics:
|
||||
id: 'G-XXXXXXXXXX' # Fill with your Google Analytics ID
|
||||
pv:
|
||||
# The Google Analytics pageviews switch.
|
||||
enabled: true
|
||||
# the next options only valid when `google_analytics.pv` is enabled.
|
||||
proxy_url: 'https://PROJECT_ID.REGION_ID.r.appspot.com'
|
||||
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
|
||||
cache: false # pv data local cache, good for the users from GFW area.
|
||||
```
|
||||
|
||||
Now, you should see the Page View enabled on your blog.
|
||||
|
||||
## Reference
|
||||
|
||||
[^ga-filters]: [Google Analytics Core Reporting API: Filters](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters)
|
||||
|
||||
[chirpy-homepage]: https://github.com/cotes2020/jekyll-theme-chirpy/
|
||||
@@ -1,17 +1,7 @@
|
||||
/*
|
||||
* The main styles.
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
The common styles
|
||||
*/
|
||||
|
||||
@import "_addon/fonts";
|
||||
@import "_addon/module";
|
||||
@import "_addon/variables";
|
||||
@import "_colors/light-typography";
|
||||
@import "_colors/dark-typography";
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;900&display=swap');
|
||||
|
||||
@mixin mode-toggle($dark-mode: false) {
|
||||
@if $dark-mode {
|
||||
@@ -45,7 +35,7 @@ html[mode=dark] {
|
||||
}
|
||||
}
|
||||
|
||||
html, body {
|
||||
:root {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
@@ -59,7 +49,7 @@ body {
|
||||
|
||||
/*--- sidebar layout ---*/
|
||||
|
||||
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
|
||||
$tab-count: 5 !default;
|
||||
|
||||
$sidebar-display: "sidebar-display";
|
||||
|
||||
@@ -73,44 +63,45 @@ $sidebar-display: "sidebar-display";
|
||||
width: $sidebar-width-medium;
|
||||
z-index: 99;
|
||||
background: var(--sidebar-bg);
|
||||
|
||||
a {
|
||||
@include sidebar-links;
|
||||
&:hover {
|
||||
color: #fff;
|
||||
@include no-text-decoration;
|
||||
}
|
||||
}
|
||||
|
||||
.site-title {
|
||||
text-align: center;
|
||||
a {
|
||||
font-weight: 900;
|
||||
font-size: 1.5rem;
|
||||
letter-spacing: 0.5px;
|
||||
&:hover {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.site-subtitle {
|
||||
font-size: 95%;
|
||||
text-align: center;
|
||||
color: #828282;
|
||||
line-height: 1.2rem;
|
||||
word-spacing: 1px;
|
||||
margin: 0.5rem 1.5rem 2rem 1.5rem;
|
||||
margin: 0.5rem 1.5rem 0.5rem 1.5rem;
|
||||
min-height: 3rem; // avoid vertical shifting in multi-line words
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.sidebar-bottom {
|
||||
.icon-border + a { // the icon behide mode-toggle
|
||||
margin-left: 0.1rem;
|
||||
}
|
||||
}
|
||||
.nav-link {
|
||||
border-radius: 0;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 1px;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
text-align: center;
|
||||
display: table;
|
||||
height: $tab-height;
|
||||
&:hover {
|
||||
.nav-link {
|
||||
@@ -123,27 +114,38 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
height: $tab-height * $tab-count;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
margin-bottom: 2rem;
|
||||
padding-left: 0;
|
||||
|
||||
> li:last-child {
|
||||
> a {
|
||||
margin-right: -3px;
|
||||
max-width: calc(100% - 3px);
|
||||
> li {
|
||||
width: 100%;
|
||||
|
||||
&:last-child {
|
||||
$cursor-width: 3px;
|
||||
|
||||
> a {
|
||||
position: relative;
|
||||
left: $cursor-width / 2;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&::after { // the cursor
|
||||
display: table;
|
||||
visibility: hidden;
|
||||
content: "";
|
||||
position: relative;
|
||||
right: 1px;
|
||||
width: $cursor-width;
|
||||
height: $tab-cursor-height;
|
||||
border-radius: 1px;
|
||||
background-color: var(--nav-cursor-color);
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
&::after { // the cursor
|
||||
visibility: hidden;
|
||||
content: "";
|
||||
position: relative;
|
||||
right: 1px;
|
||||
width: 3px;
|
||||
height: $tab-cursor-height;
|
||||
background-color: var(--nav-cursor-color);
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
} // li
|
||||
|
||||
@mixin fix-cursor($top) {
|
||||
top: $top;
|
||||
@@ -174,9 +176,18 @@ $sidebar-display: "sidebar-display";
|
||||
|
||||
.sidebar-bottom {
|
||||
font-size: 1.2rem;
|
||||
margin: 2rem 2.5rem 1.6rem;
|
||||
margin-bottom: 2.1rem;
|
||||
|
||||
@include ml-mr(auto);
|
||||
@include pl-pr(1rem);
|
||||
|
||||
%icon {
|
||||
width: 2.4rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a {
|
||||
margin-bottom: 0.5rem; // icons may have multi lines
|
||||
@extend %icon;
|
||||
}
|
||||
|
||||
a:hover, #mode-toggle-wrapper > i:hover {
|
||||
@@ -184,6 +195,8 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
#mode-toggle-wrapper {
|
||||
@extend %icon;
|
||||
|
||||
i {
|
||||
@include sidebar-links;
|
||||
margin: 0;
|
||||
@@ -192,16 +205,21 @@ $sidebar-display: "sidebar-display";
|
||||
position: relative;
|
||||
bottom: 1px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.icon-border {
|
||||
background: #525354;
|
||||
background-color: #525354;
|
||||
content: "";
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
border-radius: 50%;
|
||||
margin-top: 0.75rem;
|
||||
position: relative;
|
||||
top: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
} // .sidebar-bottom
|
||||
|
||||
} // #sidebar
|
||||
|
||||
@media (hover: hover) {
|
||||
@@ -213,13 +231,9 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
}
|
||||
|
||||
#nav-wrapper {
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
#profile-wrapper {
|
||||
.profile-wrapper {
|
||||
margin-top: 2rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#avatar {
|
||||
@@ -338,6 +352,7 @@ $sidebar-display: "sidebar-display";
|
||||
border-radius: 0;
|
||||
padding: 0.18rem 0.3rem;
|
||||
color: var(--text-color);
|
||||
font-size: 95%;
|
||||
}
|
||||
|
||||
#search-input {
|
||||
@@ -630,6 +645,12 @@ h5 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
ol, ul {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: 5px solid var(--blockquote-border-color);
|
||||
padding-left: 1rem;
|
||||
@@ -645,26 +666,19 @@ kbd {
|
||||
margin: 0 0.3rem;
|
||||
}
|
||||
|
||||
sup {
|
||||
z-index: 1;
|
||||
&:target {
|
||||
@extend %anchor;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.footnotes ol {
|
||||
.footnotes > ol {
|
||||
padding-left: 2rem;
|
||||
margin-top: 0.5rem;
|
||||
> li {
|
||||
padding-top: 0.2rem;
|
||||
margin-top: -0.2rem;
|
||||
> p {
|
||||
padding-left: 0.2em;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
margin-bottom: -.8rem;
|
||||
margin-bottom: 0.3rem;
|
||||
}
|
||||
&:target > p {
|
||||
> p {
|
||||
margin-left: 0.25em;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
&:target:not([scroll-focus]), &[scroll-focus=true] > p { // [scroll-focus] added by `smooth-scroll.js`
|
||||
background-color: var(--footnote-target-bg);
|
||||
width: fit-content;
|
||||
-webkit-transition: background-color 1.5s ease-in-out;
|
||||
@@ -676,14 +690,14 @@ sup {
|
||||
|
||||
.footnote {
|
||||
@at-root a#{&} {
|
||||
margin: 0 0.2em;
|
||||
@include ml-mr(1px);
|
||||
@include pl-pr(2px);
|
||||
border-bottom-style: none !important;
|
||||
-webkit-transition: background-color 1.5s ease-in-out; /* Safari prior 6.1 */
|
||||
transition: background-color 1.5s ease-in-out;
|
||||
}
|
||||
@at-root sup:target > a#{&} {
|
||||
@at-root sup:target:not([scroll-focus]), sup[scroll-focus=true] > a#{&} { // [scroll-focus] added by `smooth-scroll.js`
|
||||
background-color: var(--footnote-target-bg);
|
||||
padding: 0 2px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -699,10 +713,10 @@ sup {
|
||||
}
|
||||
|
||||
a {
|
||||
@at-root p>#{&} {
|
||||
p > & {
|
||||
@extend %link-color;
|
||||
}
|
||||
@at-root span>#{&} {
|
||||
span > & {
|
||||
@extend %link-color;
|
||||
}
|
||||
.post-preview & {
|
||||
@@ -743,14 +757,15 @@ img {
|
||||
|
||||
|
||||
/*--- Begin of Markdown table style ---*/
|
||||
div.post-content .table-wrapper {
|
||||
|
||||
.table-wrapper { // it will be created by Liquid
|
||||
overflow-x: auto;
|
||||
margin-bottom: 1.5rem;
|
||||
|
||||
> table {
|
||||
min-width: 60%;
|
||||
min-width: 100%;
|
||||
overflow-x: auto;
|
||||
border-spacing: 0;
|
||||
margin-bottom: 1.5rem;
|
||||
|
||||
thead {
|
||||
border-bottom: solid 2px rgba(210, 215, 217, 0.75);
|
||||
@@ -806,16 +821,27 @@ div.post-content .table-wrapper {
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
|
||||
img[data-src] {
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
@mixin img-caption {
|
||||
+ em {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
font-size: 80%;
|
||||
padding: 0;
|
||||
color: #6d6c6c;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin img($caption: false) {
|
||||
|
||||
> img[data-src] {
|
||||
margin: 0.5rem 0;
|
||||
|
||||
&:not(.normal):not(.left):not(.right) {
|
||||
@include align-center;
|
||||
|
||||
@if $caption {
|
||||
@include img-caption;
|
||||
}
|
||||
@if $caption {
|
||||
@include img-caption;
|
||||
}
|
||||
|
||||
&.left {
|
||||
@@ -831,17 +857,6 @@ div.post-content .table-wrapper {
|
||||
}
|
||||
}
|
||||
|
||||
@mixin img-caption {
|
||||
+ em {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
font-size: 80%;
|
||||
padding: 0;
|
||||
color: #6d6c6c;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
&:not(.img-hyperlink) {
|
||||
@extend %link-color;
|
||||
@@ -856,16 +871,18 @@ div.post-content .table-wrapper {
|
||||
}
|
||||
}
|
||||
|
||||
> p {
|
||||
> img[data-src]:not(.normal):not(.left):not(.right) {
|
||||
@include align-center;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1.08rem;
|
||||
@include img(true);
|
||||
}// p
|
||||
}
|
||||
|
||||
ul {
|
||||
&.task-list, &:not([class]) {
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
// attribute 'hide-bullet' was added by liquid
|
||||
.task-list-item[hide-bullet] {
|
||||
list-style-type: none;
|
||||
@@ -888,6 +905,32 @@ div.post-content .table-wrapper {
|
||||
|
||||
} // ul
|
||||
|
||||
> ol, > ul {
|
||||
padding-left: 2rem;
|
||||
|
||||
li {
|
||||
+ li {
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
|
||||
ol, ul { // sub list
|
||||
padding-left: 2rem;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
> ol {
|
||||
li {
|
||||
padding-left: 0.25em;
|
||||
}
|
||||
}
|
||||
|
||||
dl > dd {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
} // .post-content
|
||||
|
||||
.tag:hover {
|
||||
@@ -939,7 +982,7 @@ div.post-content .table-wrapper {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.visable {
|
||||
.visible {
|
||||
visibility: visible !important;
|
||||
}
|
||||
|
||||
@@ -1045,7 +1088,6 @@ div.post-content .table-wrapper {
|
||||
transition: transform 0.4s ease;
|
||||
}
|
||||
|
||||
|
||||
html, body {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
@@ -1149,13 +1191,9 @@ div.post-content .table-wrapper {
|
||||
justify-content: center!important;
|
||||
}
|
||||
|
||||
sup:target {
|
||||
padding-top: 3.4rem;
|
||||
}
|
||||
|
||||
.footnotes ol > li {
|
||||
padding-top: 3.5rem;
|
||||
margin-top: -4.3rem;
|
||||
margin-top: -3.2rem;
|
||||
&:first-child {
|
||||
margin-top: -3.5rem;
|
||||
}
|
||||
@@ -1182,7 +1220,7 @@ div.post-content .table-wrapper {
|
||||
margin-left: $sidebar-width-medium;
|
||||
}
|
||||
|
||||
#profile-wrapper {
|
||||
.profile-wrapper {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
@@ -1191,6 +1229,10 @@ div.post-content .table-wrapper {
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
div.post-content .table-wrapper > table {
|
||||
min-width: 70%;
|
||||
}
|
||||
|
||||
/* button 'back-to-Top' position */
|
||||
#back-to-top {
|
||||
bottom: 5.5rem;
|
||||
@@ -1227,9 +1269,11 @@ div.post-content .table-wrapper {
|
||||
#sidebar {
|
||||
width: $sidebar-width-small;
|
||||
.sidebar-bottom {
|
||||
@include ml-mr(1.5rem);
|
||||
a, span {
|
||||
width: 2rem;
|
||||
}
|
||||
.icon-border {
|
||||
@include ml-mr(.25rem);
|
||||
left: -3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1409,112 +1453,123 @@ div.post-content .table-wrapper {
|
||||
margin-right: 3%;
|
||||
}
|
||||
|
||||
#profile-wrapper {
|
||||
margin: 4rem 2rem 3rem 4rem;
|
||||
-ms-flex-direction: column!important;
|
||||
|
||||
#avatar {
|
||||
-webkit-box-pack: normal !important;
|
||||
-ms-flex-pack: normal !important;
|
||||
justify-content: normal !important;
|
||||
> a {
|
||||
width: 6.2rem;
|
||||
height: 6.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.profile-text {
|
||||
margin-left: 0.5rem;
|
||||
/* .d-flex */
|
||||
display: -webkit-box!important;
|
||||
display: -ms-flexbox!important;
|
||||
display: flex!important;
|
||||
/* .flex-wrap */
|
||||
-ms-flex-wrap: wrap!important;
|
||||
flex-wrap: wrap!important;
|
||||
/* .align-content-center */
|
||||
-ms-flex-line-pack: center!important;
|
||||
align-content: center!important;
|
||||
> div {
|
||||
text-align: left !important;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
width: $sidebar-width-large;
|
||||
|
||||
.site-title a {
|
||||
font-size: 1.7rem;
|
||||
letter-spacing: 1px;
|
||||
margin: 0;
|
||||
}
|
||||
.profile-wrapper {
|
||||
margin-top: 4rem;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
.site-subtitle {
|
||||
word-spacing: 0;
|
||||
margin: 0.3rem 0 0 0;
|
||||
}
|
||||
&.text-center {
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
%profile-ml {
|
||||
margin-left: 4.5rem;
|
||||
}
|
||||
|
||||
#avatar {
|
||||
@extend %profile-ml;
|
||||
|
||||
> a {
|
||||
width: 6.2rem;
|
||||
height: 6.2rem;
|
||||
&.mx-auto {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.site-title {
|
||||
@extend %profile-ml;
|
||||
a {
|
||||
font-size: 1.7rem;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.site-subtitle {
|
||||
@extend %profile-ml;
|
||||
word-spacing: 0;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
|
||||
} // .profile-wrapper (min-width: 1650px)
|
||||
|
||||
ul {
|
||||
margin-left: 3%;
|
||||
> li > a {
|
||||
padding-left: 2.5rem;
|
||||
-webkit-box-pack: start!important;
|
||||
-ms-flex-pack: start!important;
|
||||
justify-content: flex-start!important;
|
||||
}
|
||||
}
|
||||
padding-left: 2.5rem;
|
||||
|
||||
.nav-link {
|
||||
> span {
|
||||
letter-spacing: 3px;
|
||||
> li:last-child {
|
||||
> a {
|
||||
position: static;
|
||||
}
|
||||
}
|
||||
> i {
|
||||
@include icon-round(1.65rem);
|
||||
line-height: 1rem;
|
||||
font-size: 0.6rem;
|
||||
padding: 0.5em 0 0 0.1em;
|
||||
display: inline-block!important;
|
||||
|
||||
.nav-item {
|
||||
text-align: left;
|
||||
|
||||
.nav-link {
|
||||
> span {
|
||||
letter-spacing: 3px;
|
||||
}
|
||||
|
||||
> i {
|
||||
@include icon-round(1.65rem);
|
||||
|
||||
line-height: 1.5rem;
|
||||
font-size: 0.6rem;
|
||||
padding-top: 1px;
|
||||
padding-left: 1px;
|
||||
position: relative;
|
||||
bottom: 1px;
|
||||
|
||||
&.unloaded {
|
||||
display: inline-block !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-bottom {
|
||||
margin-left: 3.5rem;
|
||||
margin-right: 3rem;
|
||||
font-size: 1.3rem;
|
||||
padding-left: 3.5rem;
|
||||
width: 100%;
|
||||
|
||||
&.justify-content-center {
|
||||
-webkit-box-pack: start!important;
|
||||
-ms-flex-pack: start!important;
|
||||
justify-content: flex-start!important;
|
||||
}
|
||||
|
||||
a {
|
||||
border: 1px solid;
|
||||
border-radius: 50%;
|
||||
font-size: 1rem;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
text-align: center;
|
||||
i {
|
||||
text-align: center;
|
||||
width: 1.25em;
|
||||
padding-top: 0.44rem;
|
||||
}
|
||||
width: 3rem;
|
||||
}
|
||||
|
||||
i {
|
||||
@include icon-round(2rem);
|
||||
padding-top: 0.44rem;
|
||||
margin-top: .7rem; // multi line space
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
#mode-toggle-wrapper {
|
||||
font-size: 0.9rem;
|
||||
width: 3rem;
|
||||
|
||||
i {
|
||||
@include icon-round(2rem);
|
||||
padding-top: 0.44rem;
|
||||
bottom: 0;
|
||||
top: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-border {
|
||||
@include ml-mr(.2rem);
|
||||
margin-top: 0.85rem;
|
||||
+a {
|
||||
margin-left: 0;
|
||||
}
|
||||
top: 26px;
|
||||
}
|
||||
|
||||
} // .sidebar-bottom
|
||||
|
||||
} // #sidebar
|
||||
|
||||
footer > div.d-flex {
|
||||
width: 87%;
|
||||
max-width: 1140px;
|
||||
@@ -65,7 +65,6 @@
|
||||
color: $color;
|
||||
transition: color 0.35s ease-in-out;
|
||||
user-select: none;
|
||||
margin: 0 0.25rem;
|
||||
}
|
||||
|
||||
@mixin icon-round($diameter) {
|
||||
@@ -97,7 +96,6 @@
|
||||
color: $color;
|
||||
font-size: $font-size;
|
||||
font-weight: $font-weight;
|
||||
font-family: 'Roboto Condensed', 'Microsoft Yahei', sans-serif;
|
||||
}
|
||||
|
||||
@mixin panel-label {
|
||||
@@ -6,8 +6,8 @@
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@import "_colors/light-syntax";
|
||||
@import "_colors/dark-syntax";
|
||||
@import "colors/light-syntax";
|
||||
@import "colors/dark-syntax";
|
||||
|
||||
html:not([mode]),
|
||||
html[mode=light] {
|
||||
@@ -56,6 +56,7 @@ div > pre {
|
||||
@extend %code-snippet-radius;
|
||||
|
||||
color: var(--highlighter-rouge-color);
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 1.2em; /* Override BS Inline-code style */
|
||||
}
|
||||
|
||||
@@ -111,7 +112,6 @@ code {
|
||||
&.highlighter-rouge {
|
||||
font-size: $code-font-size;
|
||||
padding: 3px 5px;
|
||||
margin: 0 0.15rem;
|
||||
border-radius: 4px;
|
||||
background-color: var(--inline-code-bg);
|
||||
}
|
||||
@@ -132,6 +132,15 @@ code {
|
||||
|
||||
td.rouge-code {
|
||||
padding: 1.5rem 1.5rem 1.5rem 1rem;
|
||||
|
||||
// Prevent some browser extends from
|
||||
// changing the URL string of code block.
|
||||
a {
|
||||
color: inherit !important;
|
||||
border-bottom: none !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Hide line numbers for default, console, and terminal code snippets */
|
||||
@@ -149,7 +158,7 @@ div {
|
||||
}
|
||||
}
|
||||
|
||||
[class^='language-']::before {
|
||||
div[class^='language-']::before {
|
||||
content: attr(lang);
|
||||
position: absolute;
|
||||
right: 1.8rem;
|
||||
@@ -161,7 +170,7 @@ div {
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
[class^='language-']::before {
|
||||
div[class^='language-']::before {
|
||||
right: 3.1rem;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
/* --- ↓ width and height ---- */
|
||||
|
||||
$tab-height: 3.3rem;
|
||||
$tab-height: 3.2rem;
|
||||
$tab-cursor-height: 1.6rem;
|
||||
|
||||
$sidebar-width-small: 210px;
|
||||
@@ -1,10 +1,6 @@
|
||||
/*!
|
||||
* The syntax dark mode styles.
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
/*
|
||||
* The syntax dark mode styles.
|
||||
*/
|
||||
|
||||
@mixin dark-syntax {
|
||||
/* ----- My styles ------ */
|
||||
@@ -1,10 +1,6 @@
|
||||
/*!
|
||||
* The main dark mode styles
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
/*
|
||||
* The main dark mode styles
|
||||
*/
|
||||
|
||||
@mixin dark-scheme {
|
||||
/* framework */
|
||||
@@ -52,7 +48,7 @@
|
||||
--btn-paginator-border-color: var(--btn-border-color);
|
||||
--btn-paginator-shadow: var(--main-wrapper-bg);
|
||||
--pin-bg: rgb(34 35 37);
|
||||
--pin-color: iherit;
|
||||
--pin-color: inherit;
|
||||
|
||||
/* Posts */
|
||||
--toc-highlight: rgb(116, 178, 243);
|
||||
@@ -1,10 +1,6 @@
|
||||
/*!
|
||||
* The syntax light mode code snippet colors.
|
||||
* v2.1
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2020 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
/*
|
||||
* The syntax light mode code snippet colors.
|
||||
*/
|
||||
|
||||
@mixin light-syntax {
|
||||
/* see: <https://raw.githubusercontent.com/jwarby/pygments-css/master/github.css> */
|
||||
@@ -1,10 +1,6 @@
|
||||
/*!
|
||||
* The syntax light mode typography colors
|
||||
* v2.1
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2020 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
/*
|
||||
* The syntax light mode typography colors
|
||||
*/
|
||||
|
||||
@mixin light-scheme {
|
||||
/* Common */
|
||||
@@ -25,7 +21,7 @@
|
||||
--btn-backtotop-color: #686868;
|
||||
--btn-backtotop-border-color: #f1f1f1;
|
||||
--btn-box-shadow: #eaeaea;
|
||||
--checkbox-color: darkgrey;
|
||||
--checkbox-color: #c5c5c5;
|
||||
--checkbox-checked-color: #07a8f7;
|
||||
|
||||
/* Sidebar */
|
||||
@@ -59,7 +55,7 @@
|
||||
--btn-share-hover-color: var(--link-color);
|
||||
--card-border-color: #f1f1f1;
|
||||
--card-box-shadow: rgba(234, 234, 234, 0.7686274509803922);
|
||||
--label-color: #808080;
|
||||
--label-color: #616161;
|
||||
--relate-post-date: rgba(30, 55, 70, 0.4);
|
||||
--tag-bg: rgba(0, 0, 0, 0.075);
|
||||
--tag-border: #dee2e6;
|
||||
22
_sass/jekyll-theme-chirpy.scss
Normal file
22
_sass/jekyll-theme-chirpy.scss
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* The styles for Jekyll theme Chirpy
|
||||
*
|
||||
* Chirpy v3.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy)
|
||||
* © 2021 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@import "colors/light-typography";
|
||||
@import "colors/dark-typography";
|
||||
|
||||
@import "addon/module";
|
||||
@import "addon/variables";
|
||||
@import 'addon/syntax';
|
||||
@import "addon/commons";
|
||||
|
||||
@import "layout/home";
|
||||
@import "layout/post";
|
||||
@import "layout/tags";
|
||||
@import "layout/archives";
|
||||
@import "layout/categories";
|
||||
@import "layout/category-tag";
|
||||
@@ -1,13 +1,6 @@
|
||||
---
|
||||
# Style for Archives
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
|
||||
{% include_relative _addon/main.scss %}
|
||||
/*
|
||||
Style for Archives
|
||||
*/
|
||||
|
||||
%date-timeline {
|
||||
content: "";
|
||||
@@ -19,10 +12,6 @@
|
||||
background-color: var(--timeline-color);
|
||||
}
|
||||
|
||||
%date-font {
|
||||
font-family: 'Roboto Condensed', sans-serif;
|
||||
}
|
||||
|
||||
#archives {
|
||||
letter-spacing: 0.03rem;
|
||||
li {
|
||||
@@ -42,7 +31,6 @@
|
||||
|
||||
span.lead {
|
||||
font-size: 1.5rem;
|
||||
@extend %date-font;
|
||||
position: relative;
|
||||
left: 8px;
|
||||
|
||||
@@ -54,8 +42,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
&::after {
|
||||
/* Year dot */
|
||||
&::after { /* Year dot */
|
||||
content: "";
|
||||
display: block;
|
||||
position: relative;
|
||||
@@ -80,8 +67,8 @@
|
||||
&.month {
|
||||
width: 1.4rem;
|
||||
text-align: center;
|
||||
@extend %date-font;
|
||||
~a::before {
|
||||
|
||||
~ a::before {
|
||||
/* A dot for Month and Day */
|
||||
content: "";
|
||||
display: inline-block;
|
||||
@@ -1,13 +1,6 @@
|
||||
---
|
||||
# Style for Tab Categories
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
|
||||
{% include_relative _addon/main.scss %}
|
||||
/*
|
||||
Style for Tab Categories
|
||||
*/
|
||||
|
||||
%category-icon-color {
|
||||
color: gray;
|
||||
@@ -1,13 +1,6 @@
|
||||
---
|
||||
# Style for page Category and Tag
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
|
||||
{% include_relative _addon/main.scss %}
|
||||
/*
|
||||
Style for page Category and Tag
|
||||
*/
|
||||
|
||||
#page-category, #page-tag {
|
||||
ul > li {
|
||||
@@ -1,12 +1,6 @@
|
||||
---
|
||||
# Style for Homepage
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
{% include_relative _addon/main.scss %}
|
||||
/*
|
||||
Style for Homepage
|
||||
*/
|
||||
|
||||
#post-list {
|
||||
margin-top: 1rem;
|
||||
@@ -1,17 +1,6 @@
|
||||
---
|
||||
# Post-specific style
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
|
||||
{% include_relative _addon/main.scss %}
|
||||
{% include_relative _addon/syntax.scss %}
|
||||
|
||||
$prompt-older: "{{ site.data.label.post.button.previous }}";
|
||||
$prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
/*
|
||||
Post-specific style
|
||||
*/
|
||||
|
||||
@mixin btn-sharing-color($light-color, $important: false) {
|
||||
@if $important {
|
||||
@@ -34,36 +23,23 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
padding-right: $pr;
|
||||
}
|
||||
|
||||
.post .post-meta {
|
||||
#post-wrapper .post-meta {
|
||||
> div:nth-child(2) {
|
||||
> span:not(:first-child)::before {
|
||||
@include dot;
|
||||
}
|
||||
}
|
||||
|
||||
#pv::after {
|
||||
content: " views";
|
||||
}
|
||||
|
||||
.readtime::after {
|
||||
content: " read";
|
||||
}
|
||||
}
|
||||
|
||||
.post-content {
|
||||
> ol, > ul, > dl {
|
||||
padding-left: 2rem;
|
||||
li + li {
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
}
|
||||
li {
|
||||
> ol, > ul, > dl { // sub list
|
||||
padding-left: 2rem;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
> p {
|
||||
margin: 1rem 0 0.8rem;
|
||||
}
|
||||
}
|
||||
.preview-img {
|
||||
margin-top: 0;
|
||||
margin-bottom: 2.5rem;
|
||||
@@ -115,27 +91,22 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
a, span {
|
||||
a {
|
||||
&::before {
|
||||
color: var(--text-muted-color);
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
content: attr(prompt);
|
||||
}
|
||||
&:first-child {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
left: 0.5px;
|
||||
&::before {
|
||||
content: $prompt-older
|
||||
}
|
||||
}
|
||||
&:last-child {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
right: 0.5px;
|
||||
&::before {
|
||||
content: $prompt-newer
|
||||
}
|
||||
}
|
||||
}
|
||||
} // .post-navigation
|
||||
@@ -182,7 +153,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
@include label(1.1rem, 600);
|
||||
}
|
||||
.card {
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-color: var(--card-border-color);
|
||||
background-color: var(--card-bg);
|
||||
box-shadow: 0 0 5px 0 var(--card-box-shadow);
|
||||
-webkit-transition: all 0.3s ease-in-out;
|
||||
@@ -194,7 +165,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
&:hover {
|
||||
-webkit-transform: translate3d(0, -3px, 0);
|
||||
transform: translate3d(0, -3px, 0);
|
||||
box-shadow: 0 20px 35px -4px rgba(0, 0, 0, 0.15);
|
||||
box-shadow: 0 10px 15px -4px rgba(0,0,0,0.15);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,16 +298,26 @@ $prompt-newer: "{{ site.data.label.post.button.next }}";
|
||||
margin-top: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.post-content > div[class^='language-'] {
|
||||
@include ml-mr(-1.25rem);
|
||||
border-radius: 0;
|
||||
|
||||
&::before { // the lang badge
|
||||
right: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media all and (max-width: 768px) {
|
||||
.post img {
|
||||
.post-content > p > img {
|
||||
max-width: calc(100% + 1rem);
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width: 768px) {
|
||||
.post {
|
||||
#post-wrapper {
|
||||
.post-meta {
|
||||
>div:not(:first-child)::before {
|
||||
@include dot(0.5rem, 0.2rem);
|
||||
@@ -1,13 +1,6 @@
|
||||
---
|
||||
# Styles for Tab Tags
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
|
||||
{% include_relative _addon/main.scss %}
|
||||
/*
|
||||
Styles for Tab Tags
|
||||
*/
|
||||
|
||||
.tag {
|
||||
border-radius: 0.7em;
|
||||
@@ -2,12 +2,6 @@
|
||||
title: About
|
||||
icon: fas fa-info
|
||||
order: 4
|
||||
|
||||
# The About page
|
||||
# v2.0
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2017-2019 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
|
||||
|
||||
6
app.js
6
app.js
@@ -1,12 +1,8 @@
|
||||
---
|
||||
layout: compress
|
||||
# Chirpy v2.2
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# MIT Licensed
|
||||
---
|
||||
|
||||
/* Registering Service Worker */
|
||||
if('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}');
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
/*
|
||||
* The field 'font-display' is added for Google-fonts.
|
||||
*
|
||||
* See: <https://fonts.google.com/>
|
||||
*/
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Lato&family=Roboto+Condensed:wght@400;700&family=Source+Sans+Pro:wght@400;600;700;900&display=swap');
|
||||
4
assets/css/lib/bootstrap-toc.min.css
vendored
4
assets/css/lib/bootstrap-toc.min.css
vendored
@@ -1,4 +0,0 @@
|
||||
/*!
|
||||
* Bootstrap Table of Contents v1.0.1 (http://afeld.github.io/bootstrap-toc/)
|
||||
* Copyright 2015 Aidan Feldman
|
||||
* Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */nav[data-toggle=toc] .nav>li>a{display:block;padding:4px 20px;font-size:13px;font-weight:500;color:#767676}nav[data-toggle=toc] .nav>li>a:focus,nav[data-toggle=toc] .nav>li>a:hover{padding-left:19px;color:#563d7c;text-decoration:none;background-color:transparent;border-left:1px solid #563d7c}nav[data-toggle=toc] .nav-link.active,nav[data-toggle=toc] .nav-link.active:focus,nav[data-toggle=toc] .nav-link.active:hover{padding-left:18px;font-weight:700;color:#563d7c;background-color:transparent;border-left:2px solid #563d7c}nav[data-toggle=toc] .nav-link+ul{display:none;padding-bottom:10px}nav[data-toggle=toc] .nav .nav>li>a{padding-top:1px;padding-bottom:1px;padding-left:30px;font-size:12px;font-weight:400}nav[data-toggle=toc] .nav .nav>li>a:focus,nav[data-toggle=toc] .nav .nav>li>a:hover{padding-left:29px}nav[data-toggle=toc] .nav .nav>li>.active,nav[data-toggle=toc] .nav .nav>li>.active:focus,nav[data-toggle=toc] .nav .nav>li>.active:hover{padding-left:28px;font-weight:500}nav[data-toggle=toc] .nav-link.active+ul{display:block}
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
# The default style for layout Page
|
||||
# v2.2
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# MIT License
|
||||
---
|
||||
|
||||
{% include_relative _addon/main.scss %}
|
||||
{% include_relative _addon/syntax.scss %}
|
||||
7
assets/css/style.scss
Normal file
7
assets/css/style.scss
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
---
|
||||
|
||||
// see: /_sass/addon/commons.scss
|
||||
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
|
||||
|
||||
@import "jekyll-theme-chirpy";
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 52 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB |
5
assets/js/.copyright
Normal file
5
assets/js/.copyright
Normal file
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Chirpy v3.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2021 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
@@ -1,23 +0,0 @@
|
||||
/*!
|
||||
Aggregation of common JS.
|
||||
Chirpy@2.3
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT License
|
||||
*/
|
||||
|
||||
{% include_relative _commons/back-to-top.js %}
|
||||
|
||||
{% include_relative _commons/search-display.js %}
|
||||
|
||||
{% include_relative _commons/sidebar.js %}
|
||||
|
||||
{% include_relative _commons/topbar-switch.js %}
|
||||
|
||||
{% include_relative _commons/topbar-title.js %}
|
||||
|
||||
{% include_relative _commons/copy-link.js %}
|
||||
|
||||
{% include_relative _commons/checkbox.js %}
|
||||
|
||||
{% include_relative _utils/tooltip-loader.js %}
|
||||
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
$(window).scroll(function() {
|
||||
$(window).scroll(() => {
|
||||
if ($(this).scrollTop() > 50 &&
|
||||
$("#sidebar-trigger").css("display") === "none") {
|
||||
$("#back-to-top").fadeIn();
|
||||
@@ -12,7 +11,7 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$("#back-to-top").click(function() {
|
||||
$("#back-to-top").click(() => {
|
||||
$("body,html").animate({
|
||||
scrollTop: 0
|
||||
}, 800);
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
/*
|
||||
* Copy current page url to clipboard.
|
||||
* v2.1
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2020 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
function copyLink(url) {
|
||||
if (!url || 0 === url.length) {
|
||||
url = window.location.href;
|
||||
}
|
||||
|
||||
var $temp = $("<input>");
|
||||
|
||||
const $temp = $("<input>");
|
||||
$("body").append($temp);
|
||||
$temp.val(url).select();
|
||||
document.execCommand("copy");
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
/*
|
||||
* This script make #search-result-wrapper switch to unloaded or shown automatically.
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
|
||||
var btnSbTrigger = $("#sidebar-trigger");
|
||||
var btnSearchTrigger = $("#search-trigger");
|
||||
var btnCancel = $("#search-cancel");
|
||||
var btnClear = $("#search-cleaner");
|
||||
const btnSbTrigger = $("#sidebar-trigger");
|
||||
const btnSearchTrigger = $("#search-trigger");
|
||||
const btnCancel = $("#search-cancel");
|
||||
const btnClear = $("#search-cleaner");
|
||||
|
||||
var main = $("#main");
|
||||
var topbarTitle = $("#topbar-title");
|
||||
var searchWrapper = $("#search-wrapper");
|
||||
var resultWrapper = $("#search-result-wrapper");
|
||||
var results = $("#search-results");
|
||||
var input = $("#search-input");
|
||||
var hints = $("#search-hints");
|
||||
const main = $("#main");
|
||||
const topbarTitle = $("#topbar-title");
|
||||
const searchWrapper = $("#search-wrapper");
|
||||
const resultWrapper = $("#search-result-wrapper");
|
||||
const results = $("#search-results");
|
||||
const input = $("#search-input");
|
||||
const hints = $("#search-hints");
|
||||
|
||||
|
||||
/*--- Actions in small screens (Sidebar unloaded) ---*/
|
||||
|
||||
var scrollBlocker = (function() {
|
||||
var offset = 0;
|
||||
const scrollBlocker = (function () {
|
||||
let offset = 0;
|
||||
return {
|
||||
block() {
|
||||
offset = $(window).scrollTop();
|
||||
@@ -39,7 +35,7 @@ $(function() {
|
||||
};
|
||||
}());
|
||||
|
||||
var mobileSearchBar = (function() {
|
||||
const mobileSearchBar = (function () {
|
||||
return {
|
||||
on() {
|
||||
btnSbTrigger.addClass("unloaded");
|
||||
@@ -58,37 +54,37 @@ $(function() {
|
||||
};
|
||||
}());
|
||||
|
||||
var resultSwitch = (function() {
|
||||
var visable = false;
|
||||
const resultSwitch = (function () {
|
||||
let visible = false;
|
||||
|
||||
return {
|
||||
on() {
|
||||
if (!visable) {
|
||||
if (!visible) {
|
||||
resultWrapper.removeClass("unloaded");
|
||||
main.addClass("hidden");
|
||||
|
||||
visable = true;
|
||||
visible = true;
|
||||
scrollBlocker.block();
|
||||
}
|
||||
},
|
||||
off() {
|
||||
if (visable) {
|
||||
if (visible) {
|
||||
results.empty();
|
||||
if (hints.hasClass("unloaded")) {
|
||||
hints.removeClass("unloaded");
|
||||
}
|
||||
resultWrapper.addClass("unloaded");
|
||||
btnClear.removeClass("visable");
|
||||
btnClear.removeClass("visible");
|
||||
main.removeClass("hidden");
|
||||
|
||||
input.val("");
|
||||
visable = false;
|
||||
visible = false;
|
||||
|
||||
scrollBlocker.release();
|
||||
}
|
||||
},
|
||||
isVisable() {
|
||||
return visable;
|
||||
isVisible() {
|
||||
return visible;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -130,7 +126,7 @@ $(function() {
|
||||
resultSwitch.on();
|
||||
|
||||
if (!btnClear.hasClass("visible")) {
|
||||
btnClear.addClass("visable");
|
||||
btnClear.addClass("visible");
|
||||
}
|
||||
|
||||
if (isMobileView()) {
|
||||
@@ -149,7 +145,7 @@ $(function() {
|
||||
resultSwitch.off();
|
||||
}
|
||||
input.focus();
|
||||
btnClear.removeClass("visable");
|
||||
btnClear.removeClass("visible");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
/**
|
||||
* Expand or close the sidebar in mobile screens.
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
|
||||
var sidebarUtil = (function() {
|
||||
const sidebarUtil = (function () {
|
||||
const ATTR_DISPLAY = "sidebar-display";
|
||||
var isExpanded = false;
|
||||
var body = $("body");
|
||||
let isExpanded = false;
|
||||
const body = $("body");
|
||||
|
||||
return {
|
||||
toggle() {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
/**
|
||||
* Initial Bootstrap Tooltip.
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2019 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
$(function () {
|
||||
$("[data-toggle=\"tooltip\"]").tooltip();
|
||||
@@ -1,17 +1,19 @@
|
||||
/*
|
||||
* Hide Header on scroll down
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
|
||||
var didScroll;
|
||||
var lastScrollTop = 0;
|
||||
var delta = 5;
|
||||
var topbarHeight = $("#topbar-wrapper").outerHeight();
|
||||
const topbarWrapper = $("#topbar-wrapper");
|
||||
const toc = $("#toc-wrapper");
|
||||
const access = $(".access");
|
||||
const searchInput = $("#search-input");
|
||||
|
||||
let didScroll;
|
||||
let lastScrollTop = 0;
|
||||
|
||||
const delta = 5;
|
||||
const topbarHeight = topbarWrapper.outerHeight();
|
||||
|
||||
function hasScrolled() {
|
||||
var st = $(this).scrollTop();
|
||||
@@ -23,30 +25,28 @@ $(function() {
|
||||
|
||||
if (st > lastScrollTop && st > topbarHeight) {
|
||||
/* Scroll Down */
|
||||
$("#topbar-wrapper").removeClass("topbar-down").addClass("topbar-up");
|
||||
topbarWrapper.removeClass("topbar-down").addClass("topbar-up");
|
||||
|
||||
if ($("#toc-wrapper").length > 0) {
|
||||
$("#toc-wrapper").removeClass("topbar-down");
|
||||
if (toc.length > 0) {
|
||||
toc.removeClass("topbar-down");
|
||||
}
|
||||
|
||||
if ($(".access").length > 0) {
|
||||
$(".access").removeClass("topbar-down");
|
||||
if (access.length > 0) {
|
||||
access.removeClass("topbar-down");
|
||||
}
|
||||
|
||||
if ($("#search-input").is(":focus")) {
|
||||
$("#search-input").blur(); /* remove focus */
|
||||
if (searchInput.is(":focus")) {
|
||||
searchInput.blur(); /* remove focus */
|
||||
}
|
||||
|
||||
} else {
|
||||
} else if (st + $(window).height() < $(document).height()) {
|
||||
/* Scroll Up */
|
||||
if (st + $(window).height() < $(document).height()) {
|
||||
$("#topbar-wrapper").removeClass("topbar-up").addClass("topbar-down");
|
||||
if ($("#toc-wrapper").length > 0) {
|
||||
$("#toc-wrapper").addClass("topbar-down");
|
||||
}
|
||||
if ($(".access").length > 0) {
|
||||
$(".access").addClass("topbar-down");
|
||||
}
|
||||
topbarWrapper.removeClass("topbar-up").addClass("topbar-down");
|
||||
if (toc.length > 0) {
|
||||
toc.addClass("topbar-down");
|
||||
}
|
||||
if (access.length > 0) {
|
||||
access.addClass("topbar-down");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,4 +66,4 @@ $(function() {
|
||||
}
|
||||
}, 250);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Topbar title auto change while scrolling in mobile screens.
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT License
|
||||
* Top bar title auto change while scrolling in mobile screens.
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
|
||||
var DEFAULT = $("#topbar-title").text().trim();
|
||||
var title = ($("div.post>h1").length > 0) ?
|
||||
$("div.post>h1").text().trim() : $("h1").text().trim();
|
||||
const topbarTitle = $("#topbar-title");
|
||||
const postTitle = $("div.post>h1");
|
||||
|
||||
const DEFAULT = topbarTitle.text().trim();
|
||||
|
||||
let title = (postTitle.length > 0) ?
|
||||
postTitle.text().trim() : $("h1").text().trim();
|
||||
|
||||
if ($("#page-category").length || $("#page-tag").length) {
|
||||
/* The title in Category or Tag page will be "<title> <count_of_posts>" */
|
||||
@@ -22,26 +22,26 @@ $(function() {
|
||||
/* Replace topbar title while scroll screens. */
|
||||
$(window).scroll(function () {
|
||||
if ($("#post-list").length /* in Home page */
|
||||
|| $("div.post>h1").is(":hidden") /* is tab pages */
|
||||
|| $("#topbar-title").is(":hidden") /* not mobile screens */
|
||||
|| postTitle.is(":hidden") /* is tab pages */
|
||||
|| topbarTitle.is(":hidden") /* not mobile screens */
|
||||
|| $("#sidebar.sidebar-expand").length) { /* when the sidebar trigger is clicked */
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($(this).scrollTop() >= 95) {
|
||||
if ($("#topbar-title").text() !== title) {
|
||||
$("#topbar-title").text(title);
|
||||
if (topbarTitle.text() !== title) {
|
||||
topbarTitle.text(title);
|
||||
}
|
||||
} else {
|
||||
if ($("#topbar-title").text() !== DEFAULT) {
|
||||
$("#topbar-title").text(DEFAULT);
|
||||
if (topbarTitle.text() !== DEFAULT) {
|
||||
topbarTitle.text(DEFAULT);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Click title remove hover effect. */
|
||||
$("#topbar-title").click(function() {
|
||||
topbarTitle.click(function() {
|
||||
$("body,html").animate({scrollTop: 0}, 800);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/*!
|
||||
JS group for layout Home or Post
|
||||
Chirpy v2.3
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT License
|
||||
*/
|
||||
|
||||
{% include_relative _commons.js %}
|
||||
|
||||
{% include_relative _utils/timeago.js %}
|
||||
|
||||
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
|
||||
{% include_relative _pv-config.js %}
|
||||
|
||||
{% include_relative _utils/pageviews.js %}
|
||||
|
||||
{% include_relative lib/_countUp.min.js %}
|
||||
|
||||
{% endif %}
|
||||
@@ -1,14 +0,0 @@
|
||||
/*!
|
||||
PV configuration and Javascript conversion.
|
||||
*/
|
||||
|
||||
const proxyEndpoint = "{{ site.google_analytics.pv.proxy_endpoint }}";
|
||||
|
||||
|
||||
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
|
||||
{% assign enabled = true %}
|
||||
{% else %}
|
||||
{% assign enabled = false %}
|
||||
{% endif %}
|
||||
|
||||
const pvCacheEnabled = {{ enabled }};
|
||||
@@ -1,33 +1,30 @@
|
||||
/*
|
||||
* Tab 'Categories' expand/close effect.
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
var childPrefix = "l_";
|
||||
var parentPrefix = "h_";
|
||||
const childPrefix = "l_";
|
||||
const parentPrefix = "h_";
|
||||
const collapse = $(".collapse");
|
||||
|
||||
/* close up top-category */
|
||||
$(".collapse").on("hide.bs.collapse", function() { /* Bootstrap collapse events. */
|
||||
var parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
|
||||
collapse.on("hide.bs.collapse", function () { /* Bootstrap collapse events. */
|
||||
const parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
|
||||
if (parentId) {
|
||||
$("#" + parentId + " .far.fa-folder-open").attr("class", "far fa-folder fa-fw");
|
||||
$("#" + parentId + " i.fas").addClass("rotate");
|
||||
$("#" + parentId).removeClass("hide-border-bottom");
|
||||
$(`#${parentId} .far.fa-folder-open`).attr("class", "far fa-folder fa-fw");
|
||||
$(`#${parentId} i.fas`).addClass("rotate");
|
||||
$(`#${parentId}`).removeClass("hide-border-bottom");
|
||||
}
|
||||
});
|
||||
|
||||
/* expand the top category */
|
||||
$(".collapse").on("show.bs.collapse", function() {
|
||||
var parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
|
||||
collapse.on("show.bs.collapse", function() {
|
||||
const parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
|
||||
if (parentId) {
|
||||
$("#" + parentId + " .far.fa-folder").attr("class", "far fa-folder-open fa-fw");
|
||||
$("#" + parentId + " i.fas").removeClass("rotate");
|
||||
$("#" + parentId).addClass("hide-border-bottom");
|
||||
$(`#${parentId} .far.fa-folder`).attr("class", "far fa-folder-open fa-fw");
|
||||
$(`#${parentId} i.fas`).removeClass("rotate");
|
||||
$(`#${parentId}`).addClass("hide-border-bottom");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
/*
|
||||
* Find out the <a> tag contains an image and mark it.
|
||||
*
|
||||
* v2.5.1
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2020 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
|
||||
var MARK="img-hyperlink";
|
||||
|
||||
const MARK = "img-hyperlink";
|
||||
$("a:has(img)").addClass(MARK);
|
||||
|
||||
});
|
||||
|
||||
@@ -7,11 +7,11 @@ $(function() {
|
||||
const regex = new RegExp(`^${prefix}([a-z])+$`);
|
||||
|
||||
$(`div[class^=${prefix}`).each(function() {
|
||||
let clzsses = $(this).attr("class").split(" ");
|
||||
let classes = $(this).attr("class").split(" ");
|
||||
|
||||
clzsses.forEach((clzss) => {
|
||||
if (regex.test(clzss)) {
|
||||
let lang = clzss.substring(prefix.length);
|
||||
classes.forEach((_class) => {
|
||||
if (regex.test(_class)) {
|
||||
let lang = _class.substring(prefix.length);
|
||||
$(this).attr("lang", `${lang}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
/**
|
||||
* Count pageviews form GA or local cache file.
|
||||
/*
|
||||
* Count page views form GA or local cache file.
|
||||
*
|
||||
* Dependences:
|
||||
* Dependencies:
|
||||
* - jQuery
|
||||
* - countUp.js <https://github.com/inorganik/countUp.js>
|
||||
*
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2018-2019 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
var getInitStatus = (function () {
|
||||
var hasInit = false;
|
||||
const getInitStatus = (function () {
|
||||
let hasInit = false;
|
||||
return () => {
|
||||
let ret = hasInit;
|
||||
if (!hasInit) {
|
||||
@@ -22,13 +17,26 @@ var getInitStatus = (function () {
|
||||
};
|
||||
}());
|
||||
|
||||
const PvOpts = (function () {
|
||||
return {
|
||||
isEnabled() {
|
||||
return "true" === $("meta[name=pv-cache-enabled]").attr("content");
|
||||
},
|
||||
getProxyEndpoint() {
|
||||
return $("meta[name=pv-proxy-endpoint]").attr("content");
|
||||
},
|
||||
getLocalData() {
|
||||
return $("meta[name=pv-cache-data]").attr("content");
|
||||
}
|
||||
}
|
||||
}());
|
||||
|
||||
var PvCache = (function () {
|
||||
const PvCache = (function () {
|
||||
const KEY_PV = "pv";
|
||||
const KEY_CREATION = "pv_created_date";
|
||||
const KEY_PV_SRC = "pv_source";
|
||||
|
||||
var Source = {
|
||||
const Source = {
|
||||
ORIGIN: "origin",
|
||||
PROXY: "proxy"
|
||||
};
|
||||
@@ -43,17 +51,18 @@ var PvCache = (function () {
|
||||
|
||||
return {
|
||||
getData() {
|
||||
return JSON.parse(localStorage.getItem(KEY_PV) );
|
||||
// get data from browser cache
|
||||
return JSON.parse(localStorage.getItem(KEY_PV));
|
||||
},
|
||||
saveOriginCache(pv) {
|
||||
set(KEY_PV, pv);
|
||||
set(KEY_PV_SRC, Source.ORIGIN );
|
||||
set(KEY_CREATION, new Date().toJSON() );
|
||||
set(KEY_PV_SRC, Source.ORIGIN);
|
||||
set(KEY_CREATION, new Date().toJSON());
|
||||
},
|
||||
saveProxyCache(pv) {
|
||||
set(KEY_PV, pv);
|
||||
set(KEY_PV_SRC, Source.PROXY );
|
||||
set(KEY_CREATION, new Date().toJSON() );
|
||||
set(KEY_PV_SRC, Source.PROXY);
|
||||
set(KEY_CREATION, new Date().toJSON());
|
||||
},
|
||||
isFromOrigin() {
|
||||
return get(KEY_PV_SRC) === Source.ORIGIN;
|
||||
@@ -62,23 +71,23 @@ var PvCache = (function () {
|
||||
return get(KEY_PV_SRC) === Source.PROXY;
|
||||
},
|
||||
isExpired() {
|
||||
if (PvCache.isFromOrigin() ) {
|
||||
if (PvCache.isFromOrigin()) {
|
||||
let date = new Date(get(KEY_CREATION));
|
||||
date.setDate(date.getDate() + 1); /* update origin records every day */
|
||||
return Date.now() >= date.getTime();
|
||||
|
||||
} else if (PvCache.isFromProxy() ) {
|
||||
let date = new Date(get(KEY_CREATION) );
|
||||
} else if (PvCache.isFromProxy()) {
|
||||
let date = new Date(get(KEY_CREATION));
|
||||
date.setHours(date.getHours() + 1); /* update proxy records per hour */
|
||||
return Date.now() >= date.getTime();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getAllPagevies() {
|
||||
getAllPageviews() {
|
||||
return PvCache.getData().totalsForAllResults["ga:pageviews"];
|
||||
},
|
||||
newerThan(pv) {
|
||||
return PvCache.getAllPagevies() > pv.totalsForAllResults["ga:pageviews"];
|
||||
return PvCache.getAllPageviews() > pv.totalsForAllResults["ga:pageviews"];
|
||||
},
|
||||
inspectKeys() {
|
||||
if (localStorage.getItem(KEY_PV) === null
|
||||
@@ -91,9 +100,10 @@ var PvCache = (function () {
|
||||
|
||||
}()); /* PvCache */
|
||||
|
||||
|
||||
function countUp(min, max, destId) {
|
||||
if (min < max) {
|
||||
var numAnim = new CountUp(destId, min, max);
|
||||
let numAnim = new CountUp(destId, min, max);
|
||||
if (!numAnim.error) {
|
||||
numAnim.start();
|
||||
} else {
|
||||
@@ -104,11 +114,11 @@ function countUp(min, max, destId) {
|
||||
|
||||
|
||||
function countPV(path, rows) {
|
||||
var count = 0;
|
||||
let count = 0;
|
||||
|
||||
if (typeof rows !== "undefined" ) {
|
||||
for (var i = 0; i < rows.length; ++i) {
|
||||
var gaPath = rows[parseInt(i, 10)][0];
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
const gaPath = rows[parseInt(i, 10)][0];
|
||||
if (gaPath === path) { /* path format see: site.permalink */
|
||||
count += parseInt(rows[parseInt(i, 10)][1], 10);
|
||||
break;
|
||||
@@ -121,13 +131,13 @@ function countPV(path, rows) {
|
||||
|
||||
|
||||
function tacklePV(rows, path, elem, hasInit) {
|
||||
var count = countPV(path, rows);
|
||||
let count = countPV(path, rows);
|
||||
count = (count === 0 ? 1 : count);
|
||||
|
||||
if (!hasInit) {
|
||||
elem.text(new Intl.NumberFormat().format(count));
|
||||
} else {
|
||||
var initCount = parseInt(elem.text().replace(/,/g, ""), 10);
|
||||
const initCount = parseInt(elem.text().replace(/,/g, ""), 10);
|
||||
if (count > initCount) {
|
||||
countUp(initCount, count, elem.attr("id"));
|
||||
}
|
||||
@@ -140,17 +150,17 @@ function displayPageviews(data) {
|
||||
return;
|
||||
}
|
||||
|
||||
var hasInit = getInitStatus();
|
||||
var rows = data.rows; /* could be undefined */
|
||||
let hasInit = getInitStatus();
|
||||
const rows = data.rows; /* could be undefined */
|
||||
|
||||
if ($("#post-list").length > 0) { /* the Home page */
|
||||
$(".post-preview").each(function() {
|
||||
var path = $(this).find("a").attr("href");
|
||||
const path = $(this).find("a").attr("href");
|
||||
tacklePV(rows, path, $(this).find(".pageviews"), hasInit);
|
||||
});
|
||||
|
||||
} else if ($(".post").length > 0) { /* the post */
|
||||
var path = window.location.pathname;
|
||||
const path = window.location.pathname;
|
||||
tacklePV(rows, path, $("#pv"), hasInit);
|
||||
}
|
||||
}
|
||||
@@ -159,7 +169,7 @@ function displayPageviews(data) {
|
||||
function fetchProxyPageviews() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: proxyEndpoint, /* see: /assets/js/_pv-config.js */
|
||||
url: PvOpts.getProxyEndpoint(),
|
||||
dataType: "jsonp",
|
||||
jsonpCallback: "displayPageviews",
|
||||
success: (data, textStatus, jqXHR) => {
|
||||
@@ -173,9 +183,8 @@ function fetchProxyPageviews() {
|
||||
|
||||
|
||||
function fetchPageviews(fetchOrigin = true, filterOrigin = false) {
|
||||
/* pvCacheEnabled › see: /assets/js/_pv-config.js */
|
||||
if (pvCacheEnabled && fetchOrigin) {
|
||||
fetch("/assets/js/data/pageviews.json")
|
||||
if (PvOpts.isEnabled() && fetchOrigin) {
|
||||
fetch(PvOpts.getLocalData())
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (filterOrigin) {
|
||||
@@ -196,9 +205,7 @@ function fetchPageviews(fetchOrigin = true, filterOrigin = false) {
|
||||
|
||||
|
||||
$(function() {
|
||||
|
||||
if ($(".pageviews").length > 0) {
|
||||
|
||||
PvCache.inspectKeys();
|
||||
let cache = PvCache.getData();
|
||||
|
||||
|
||||
81
assets/js/_utils/smooth-scroll.js
Normal file
81
assets/js/_utils/smooth-scroll.js
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
Safari doesn't support CSS `scroll-behavior: smooth`,
|
||||
so here is a compatible solution for all browser to smooth scrolling
|
||||
|
||||
See: <https://css-tricks.com/snippets/jquery/smooth-scrolling/>
|
||||
|
||||
Warning: It must be called after all `<a>` tags (e.g., the dynamic TOC) are ready.
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
$("a[href*='#']")
|
||||
.not("[href='#']")
|
||||
.not("[href='#0']")
|
||||
.click(function(event) {
|
||||
|
||||
if (this.pathname.replace(/^\//, "") === location.pathname.replace(/^\//, "")) {
|
||||
if (location.hostname === this.hostname) {
|
||||
|
||||
const REM = 16; /* 16px */
|
||||
|
||||
const hash = decodeURI(this.hash);
|
||||
let isFnRef = RegExp(/^#fnref:/).test(hash);
|
||||
let isFn = RegExp(/^#fn:/).test(hash);
|
||||
let selector = hash.includes(":") ? hash.replace(/\:/, "\\:") : hash;
|
||||
let target = $(selector);
|
||||
|
||||
if (target.length) {
|
||||
event.preventDefault();
|
||||
|
||||
if (history.pushState) { /* add hash to URL */
|
||||
history.pushState(null, null, hash);
|
||||
}
|
||||
|
||||
let curOffset = $(this).offset().top;
|
||||
let destOffset = target.offset().top;
|
||||
const scrollUp = (destOffset < curOffset);
|
||||
const topbarHeight = $("#topbar-wrapper").outerHeight();
|
||||
|
||||
if (scrollUp && isFnRef) {
|
||||
/* Avoid the top-bar covering `fnref` when scrolling up
|
||||
because `fnref` has no `%anchor`(see: module.scss) style. */
|
||||
destOffset -= (topbarHeight + REM / 2);
|
||||
}
|
||||
|
||||
$("html,body").animate({
|
||||
scrollTop: destOffset
|
||||
}, 800, () => {
|
||||
|
||||
const $target = $(target);
|
||||
$target.focus();
|
||||
|
||||
const SCROLL_MARK = "scroll-focus";
|
||||
|
||||
/* clean up old scroll mark */
|
||||
if ($(`[${SCROLL_MARK}=true]`).length) {
|
||||
$(`[${SCROLL_MARK}=true]`).attr(SCROLL_MARK, false);
|
||||
}
|
||||
|
||||
/* Clean :target links */
|
||||
if ($(":target").length) { /* element that visited by the URL with hash */
|
||||
$(":target").attr(SCROLL_MARK, false);
|
||||
}
|
||||
|
||||
/* set scroll mark to footnotes */
|
||||
if (isFn || isFnRef) {
|
||||
$target.attr(SCROLL_MARK, true);
|
||||
}
|
||||
|
||||
if ($target.is(":focus")) { /* Checking if the target was focused */
|
||||
return false;
|
||||
} else {
|
||||
$target.attr("tabindex", "-1"); /* Adding tabindex for elements not focusable */
|
||||
$target.focus(); /* Set focus again */
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}); /* click() */
|
||||
});
|
||||
@@ -1,16 +1,14 @@
|
||||
/*
|
||||
* Caculate the Timeago
|
||||
* v2.0
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
* Calculate the Timeago
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
|
||||
var toRefresh = $(".timeago").length;
|
||||
const timeagoElem = $(".timeago");
|
||||
|
||||
var intervalId = void 0;
|
||||
let toRefresh = timeagoElem.length;
|
||||
|
||||
let intervalId = void 0;
|
||||
|
||||
function timeago(iso, isLastmod) {
|
||||
let now = new Date();
|
||||
@@ -57,10 +55,10 @@ $(function() {
|
||||
function updateTimeago() {
|
||||
$(".timeago").each(function() {
|
||||
if ($(this).children("i").length > 0) {
|
||||
var basic = $(this).text();
|
||||
var isLastmod = $(this).hasClass("lastmod");
|
||||
var node = $(this).children("i");
|
||||
var date = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */
|
||||
$(this).text();
|
||||
let isLastmod = $(this).hasClass("lastmod");
|
||||
let node = $(this).children("i");
|
||||
let date = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */
|
||||
$(this).text(timeago(date, isLastmod));
|
||||
$(this).append(node);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user