1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-19 06:06:54 +00:00

Compare commits

..

27 Commits

Author SHA1 Message Date
Cotes Chung
d7443aad5d Bump version to 3.1.0 2021-02-03 01:42:10 +08:00
Cotes Chung
b2beaa0f4c Update travis settings for release-branches
- drop the deprecated flag `--deployment` of bundle (so we have to specify the bundler caching path)
2021-02-03 00:46:36 +08:00
Cotes Chung
83a7878043 Improved bump tool to fit the release branches 2021-02-02 21:56:17 +08:00
Cotes Chung
94b99350fc Restore the prompt in the page nav button in the latest/oldest articles 2021-02-02 21:56:17 +08:00
Cotes Chung
6dc9cdfa25 Reduce the font size of the Disqus prompt 2021-02-02 21:56:17 +08:00
Cotes Chung
fa56ea48c3 Improve docs 2021-02-02 21:56:17 +08:00
dependabot-preview[bot]
7d3e25c90d Bump tzinfo-data from 1.2020.6 to 1.2021.1 (#272)
Bumps [tzinfo-data](https://github.com/tzinfo/tzinfo-data) from 1.2020.6 to 1.2021.1.
- [Release notes](https://github.com/tzinfo/tzinfo-data/releases)
- [Commits](https://github.com/tzinfo/tzinfo-data/compare/v1.2020.6...v1.2021.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-02-01 19:33:45 +08:00
Cotes Chung
6c9ab6e5f8 Fix gemfile 2021-02-01 18:03:27 +08:00
Cotes Chung
91da99282d Add lang option to the site config sample 2021-02-01 17:38:50 +08:00
Cotes Chung
413a86277b Generate the breadcrumb by Liquid
also subtracted '/tabs/' from the tabs path
2021-01-31 22:06:10 +08:00
Cotes Chung
1879b94f3d Exclude gem-spec from output 2021-01-30 05:28:33 +08:00
Cotes Chung
7b5f7086b7 Fix post feature image style 2021-01-30 03:12:43 +08:00
Cotes Chung
a8b8a379f6 Improve the docs
- Add missing url references in the tutorial
- Add gem version badge in README
2021-01-30 02:00:34 +08:00
Bogdan Stoica
eacad65cbb Add alt attribute to the post's preview image (#271) 2021-01-30 01:14:03 +08:00
Cotes Chung
7a87ab4d05 Bump version to 3.0.3 2021-01-28 23:44:53 +08:00
Cotes Chung
c4be7c0cd6 Add more spec meta to gem 2021-01-28 23:39:03 +08:00
Cotes Chung
c9765e6923 Merge gem-build & bump tool
Drop the yard doc
2021-01-28 23:17:16 +08:00
Cotes Chung
5c04d4e45b Bypass the jekyll build on source branch 2021-01-28 20:56:23 +08:00
Cotes Chung
4d969ca0c5 Fix toc of readme 2021-01-28 20:56:23 +08:00
Cotes Chung
4a084eb681 Add new tool to build gem 2021-01-28 04:57:11 +08:00
Cotes Chung
adc117972a Fix the year of copyright 2021-01-28 03:37:08 +08:00
Cotes Chung
8e84c6b9d6 Improve code style
- js/css
- markdown
- shell
2021-01-28 03:21:58 +08:00
Cotes Chung
d8a42d9bb4 Bump version to 3.0.2 2021-01-27 03:41:12 +08:00
Cotes Chung
c1b20d8f71 Fix bump tool 2021-01-27 03:40:17 +08:00
Cotes Chung
08ce9f6c7c Fix typo of docs 2021-01-27 03:13:26 +08:00
Cotes Chung
0b4e40bcdf Fix footer links 2021-01-27 02:51:50 +08:00
Cotes Chung
9ae2aee222 Improve the gh-actions CD script 2021-01-26 23:26:03 +08:00
42 changed files with 1239 additions and 1136 deletions

View File

@@ -4,19 +4,29 @@ dist: bionic
language: ruby language: ruby
rvm: 2.7.0 rvm: 2.7.0
cache: bundler cache:
directories:
- $TRAVIS_BUILD_DIR/vendor/bundle
before_install:
- gem install bundler:2.2.4 # match the Gemfile.lock, travis' bundle is 2.1.2
- bundle config path 'vendor/bundle'
install:
# overriding to drop the travis `--development` flag
- bundle install --jobs=3 --retry=3
addons: addons:
apt: apt:
packages: packages:
- libcurl4-openssl-dev # required to avoid SSL error (for htmlproofer) - libcurl4-openssl-dev # required to avoid SSL error (for htmlproofer)
script: script:
- git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q - git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
- eval "$BUILD_CMD" - eval "$BUILD_CMD"
branches: branches:
only: production only: /.*-stable$/
git: git:
depth: false # for posts lastmod depth: false # for posts lastmod

View File

@@ -6,9 +6,6 @@ permalink: /404.html
redirect_from: redirect_from:
- /norobots/ - /norobots/
- /assets/ - /assets/
- /tabs/
- /categories/
- /tags/
- /posts/ - /posts/
dynamic_title: true dynamic_title: true
@@ -16,5 +13,9 @@ dynamic_title: true
<div class="lead"> <div class="lead">
<p>Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. </p> <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> <p>
<a href="{{ '/' | relative_url }}">Head back Home</a>
to try finding it again, or search for it on the
<a href="{{ 'archives' | relative_url }}">Archives page</a>.
</p>
</div> </div>

13
Gemfile
View File

@@ -1,15 +1,8 @@
# frozen_string_literal: true
source "https://rubygems.org" source "https://rubygems.org"
gem "jekyll", "~> 4.1" gemspec
# plugins
group :jekyll_plugins do
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 group :test do
gem "html-proofer", "~> 3.18" gem "html-proofer", "~> 3.18"

View File

@@ -1,10 +1,21 @@
PATH
remote: .
specs:
jekyll-theme-chirpy (3.0.3)
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)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
addressable (2.7.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0) colorator (1.1.0)
concurrent-ruby (1.1.7) concurrent-ruby (1.1.8)
em-websocket (0.5.2) em-websocket (0.5.2)
eventmachine (>= 0.12.9) eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0) http_parser.rb (~> 0.6.0)
@@ -22,7 +33,7 @@ GEM
typhoeus (~> 1.3) typhoeus (~> 1.3)
yell (~> 2.0) yell (~> 2.0)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
i18n (1.8.5) i18n (1.8.7)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jekyll (4.2.0) jekyll (4.2.0)
addressable (~> 2.4) addressable (~> 2.4)
@@ -57,13 +68,11 @@ GEM
kramdown-parser-gfm (1.1.0) kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0) kramdown (~> 2.0)
liquid (4.0.3) liquid (4.0.3)
listen (3.3.3) listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0) mercenary (0.4.0)
mini_portile2 (2.5.0) nokogiri (1.11.1-x86_64-darwin)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4) racc (~> 1.4)
nokogumbo (2.0.4) nokogumbo (2.0.4)
nokogiri (~> 1.8, >= 1.8.4) nokogiri (~> 1.8, >= 1.8.4)
@@ -88,23 +97,18 @@ GEM
ethon (>= 0.9.0) ethon (>= 0.9.0)
tzinfo (1.2.9) tzinfo (1.2.9)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo-data (1.2020.6) tzinfo-data (1.2021.1)
tzinfo (>= 1.0.0) tzinfo (>= 1.0.0)
unicode-display_width (1.7.0) unicode-display_width (1.7.0)
wdm (0.1.1) wdm (0.1.1)
yell (2.2.2) yell (2.2.2)
PLATFORMS PLATFORMS
ruby x86_64-darwin-20
DEPENDENCIES DEPENDENCIES
html-proofer (~> 3.18) html-proofer (~> 3.18)
jekyll (~> 4.1) jekyll-theme-chirpy!
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 (~> 1.2)
tzinfo-data tzinfo-data
wdm (~> 0.1.1) wdm (~> 0.1.1)

View File

@@ -2,9 +2,10 @@
Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md) Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md)
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy)
[![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush) [![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg?color=blue)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
A minimal, 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) 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)
@@ -14,9 +15,10 @@ A minimal, sidebar, responsive web design Jekyll theme that focuses on text pres
## Table of Contents ## Table of Contents
- [Features](#features) - [Features](#features)
- [Installation](#installation)
- [Prerequisites](#prerequisites) - [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage) - [Usage](#usage)
- [Documentation](#documentation)
- [Contributing](#contributing) - [Contributing](#contributing)
- [Credits](#credits) - [Credits](#credits)
- [Supporting](#supporting) - [Supporting](#supporting)
@@ -40,7 +42,6 @@ A minimal, sidebar, responsive web design Jekyll theme that focuses on text pres
- GA Pageviews reporting (Advanced) - GA Pageviews reporting (Advanced)
- SEO and Performance Optimization - SEO and Performance Optimization
## Prerequisites ## Prerequisites
Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`. Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll` and `Bundler`.
@@ -49,10 +50,10 @@ Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete th
There are two ways to get the theme: There are two ways to get the theme:
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy) - **Install from RubyGems** - Easy to upgrade, isolate irrelevant project files so you can focus on writing.
- Fork from GitHub - **Fork from GitHub** - Convenient for custom development, but difficult to upgrade, only suitable for web developers.
### Install From Rubygems ### Install From RubyGems
Add this line to your Jekyll site's `Gemfile`: Add this line to your Jekyll site's `Gemfile`:
@@ -72,18 +73,15 @@ And then execute:
$ bundle $ bundle
``` ```
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. Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
> **Hint**: To locate the themes gem, execute: > **Hint**: To locate the installed themes gem, execute:
> >
```console ```console
$ bundle info --path jekyll-theme-chirpy $ bundle info --path jekyll-theme-chirpy
``` ```
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem. Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from theme's gem. We have prepared everything for you there!
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
### Fork From GitHub ### Fork From GitHub
@@ -105,15 +103,14 @@ $ bash tools/init.sh
What it does is: 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` 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`.
- 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`. 3. Automatically create a commit to save the changes.
3. Automatically create a commit to save the changes.
## Usage ## Usage
@@ -121,10 +118,10 @@ What it does is:
Update the variables of `_config.yml` as needed. Some of them are typical options: Update the variables of `_config.yml` as needed. Some of them are typical options:
- `url` - `url`
- `avatar` - `avatar`
- `timezone` - `timezone`
- `theme_mode` - `lang`
### Running Local Server ### Running Local Server
@@ -149,28 +146,28 @@ Open a browser and visit to _<http://localhost:4000>_.
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`. Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
Now you can now choose ONE of the following methods to deploy your website. Now you can choose ONE of the following methods to deploy your Jekyll site.
#### Deploy on GitHub Pages #### 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 GH 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.
Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Quickly check the files needed for GitHub Actions build:
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.
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook - 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.
- Ensuer your Jekyll site has file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
Rename your repoistory to `<GH-USERNAME>.github.io` on GitHub. And then rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
And then publish your site by: Now publish your Jekyll site by:
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files. 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_: 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_:
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png) ![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png)
3. Visit your website at the address indicated by GitHub. 3. Visit your website at the address indicated by GitHub.
#### Deploy on Other Platforms #### Deploy on Other Platforms
@@ -208,11 +205,9 @@ 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. :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. Also, thank [JetBrains][jb] for providing the open source license.
[![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][JB] [![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][jb]
[JB]:https://www.jetbrains.com/?from=jekyll-theme-chirpy
## Supporting ## Supporting
@@ -221,3 +216,9 @@ If you enjoy this theme or find it helpful, please consider becoming my sponsor,
## License ## License
This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License. This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy

View File

@@ -1,5 +1,18 @@
# The Site Configuration # The Site Configuration
# Import the theme
theme: jekyll-theme-chirpy
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
# change below value to '/projectname'.
baseurl: ''
# the HTML language tag https://www.w3.org/International/questions/qa-choosing-language-tags
lang: en-US
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai
# jekyll-seo-tag settings https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md # jekyll-seo-tag settings https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# -------------------------- # --------------------------
title: Chirpy # the main title title: Chirpy # the main title
@@ -36,14 +49,6 @@ social:
google_site_verification: google_meta_tag_verification # change to your verification string google_site_verification: google_meta_tag_verification # change to your verification string
# -------------------------- # --------------------------
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
# change below value to '/projectname'.
baseurl: ''
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai
google_analytics: google_analytics:
id: '' # Fill with your Google Analytics ID id: '' # Fill with your Google Analytics ID
pv: pv:
@@ -55,11 +60,6 @@ google_analytics:
proxy_endpoint: '' proxy_endpoint: ''
cache: false # pv data local cache, good for the users from GFW area. cache: false # pv data local cache, good for the users from GFW area.
disqus:
comments: false # boolean type, the global switch for posts comments.
shortname: '' # Fill with your Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname
# Prefer color scheme setting. # Prefer color scheme setting.
# #
# Note: Keep empty will follow the system prefer color by default, # Note: Keep empty will follow the system prefer color by default,
@@ -69,7 +69,6 @@ disqus:
# Available options: # Available options:
# #
# light - Use the light color scheme # light - Use the light color scheme
#
# dark - Use the dark color scheme # dark - Use the dark color scheme
# #
theme_mode: # [light|dark] theme_mode: # [light|dark]
@@ -87,8 +86,14 @@ avatar: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/avatar.jpg
# boolean type, the global switch for ToC in posts. # boolean type, the global switch for ToC in posts.
toc: true toc: true
disqus:
comments: false # boolean type, the global switch for posts comments.
shortname: '' # Fill with your Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname
paginate: 10 paginate: 10
# ------------ The following options are not recommended to be modified ------------------
kramdown: kramdown:
syntax_highlighter: rouge syntax_highlighter: rouge
syntax_highlighter_opts: # Rouge Options https://github.com/jneen/rouge#full-options syntax_highlighter_opts: # Rouge Options https://github.com/jneen/rouge#full-options
@@ -101,7 +106,7 @@ kramdown:
start_line: 1 start_line: 1
# DO NOT change this unless you're a Pro user on Jekyll and Web development, # DO NOT change this unless you're a Pro user on Jekyll and Web development,
# or you think you're smart enough to change other relevant URLs within this template. # Or you think you're smart enough to change other relevant URLs within this template.
permalink: /posts/:title/ permalink: /posts/:title/
collections: collections:
@@ -119,55 +124,19 @@ defaults:
layout: post layout: post
comments: true # Enable comments in posts. comments: true # Enable comments in posts.
toc: true # Display TOC column in posts. toc: true # Display TOC column in posts.
breadcrumb:
-
label: Posts
url: /
- -
scope: scope:
path: _drafts path: _drafts
values: values:
comments: false comments: false
-
scope:
path: index.html
values:
breadcrumb:
-
label: Posts
-
scope:
path: tags
values:
breadcrumb:
-
label: Home
url: /
-
label: Tags
url: /tabs/tags/
-
scope:
path: categories
values:
breadcrumb:
-
label: Home
url: /
-
label: Categories
url: /tabs/categories/
- -
scope: scope:
path: '' path: ''
type: tabs # see `site.collections` type: tabs # see `site.collections`
values: values:
layout: page layout: page
permalink: /:title/
dynamic_title: true # Hide title in mobile screens. dynamic_title: true # Hide title in mobile screens.
breadcrumb:
-
label: Home
url: /
sass: sass:
style: compressed style: compressed
@@ -183,8 +152,9 @@ compress_html:
exclude: exclude:
- vendor - vendor
- Gemfile.lock
- Gemfile - Gemfile
- Gemfile.lock
- jekyll-theme-chirpy.gemspec
- tools - tools
- docs - docs
- README.md - README.md

View File

@@ -4,7 +4,7 @@
--> -->
<div id="disqus" class="pt-2 pb-2"> <div id="disqus" class="pt-2 pb-2">
<p class="text-center text-muted pb-5"> <p class="text-center text-muted small pb-5">
Loading comments from <a href="https://disqus.com/">Disqus</a> ... Loading comments from <a href="https://disqus.com/">Disqus</a> ...
</p> </p>
</div> </div>

View File

@@ -20,7 +20,8 @@
Powered by Powered by
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a> <a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
with with
<a href="{{ site.data.meta.homepage }}" target="_blank" rel="noopener">{{ site.data.meta.name }}</a> <a href="https://github.com/cotes2020/jekyll-theme-chirpy"
target="_blank" rel="noopener">Chirpy</a>
theme. theme.
</p> </p>
</div> </div>

View File

@@ -9,7 +9,8 @@
<p>{{ page.previous.title }}</p> <p>{{ page.previous.title }}</p>
</a> </a>
{% else %} {% else %}
<span class="btn btn-outline-primary disabled"> <span class="btn btn-outline-primary disabled"
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}">
<p>-</p> <p>-</p>
</span> </span>
{% endif %} {% endif %}
@@ -20,7 +21,8 @@
<p>{{ page.next.title }}</p> <p>{{ page.next.title }}</p>
</a> </a>
{% else %} {% else %}
<span class="btn btn-outline-primary disabled"> <span class="btn btn-outline-primary disabled"
prompt="{{ site.data.label.post.button.next | default: 'next' }}">
<p>-</p> <p>-</p>
</span> </span>
{% endif %} {% endif %}

View File

@@ -5,21 +5,42 @@
<div id="topbar-wrapper" class="row justify-content-center topbar-down"> <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"> <div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between">
<span id="breadcrumb"> <span id="breadcrumb">
{% for item in page.breadcrumb %}
{% if item.url %} {% assign paths = page.url | split: '/' %}
{% if paths.size == 0 %}
<!-- index page -->
<span>{{ 'Posts' }}</span>
{% else %}
{% for item in paths %}
{% if forloop.first %}
{% unless page.layout == 'post' %}
<span>
<a href="{{ '/' | relative_url }}">{{ 'Home' }}</a>
</span>
{% endunless %}
{% elsif forloop.last %}
<span>{{ page.title }}</span>
{% else %}
<span> <span>
<a href="{{ site.baseurl }}{{ item.url | remove: '.html'}}"> {% assign url = item %}
{{ item.label }} {% if item == 'posts' and page.layout == 'post' %}
{% assign url = '/' %}
{% endif %}
<a href="{{ url | relative_url }}">
{{ item | capitalize }}
</a> </a>
</span> </span>
{% else %}
<span>{{ item.label }}</span>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% unless page.layout == "home" %} {% endif %}
<span>{{ page.title }}</span>
{% endunless %}
</span><!-- endof #breadcrumb --> </span><!-- endof #breadcrumb -->

View File

@@ -11,7 +11,7 @@ layout: compress
{% endif %} {% endif %}
{% endcapture %} {% endcapture %}
<html lang="{{ site.lang | split: "_" | first | default: "en" }}" {{ prefer_mode }}> <html lang="{{ site.lang | default: "en-US" }}" {{ prefer_mode }}>
{% include head.html %} {% include head.html %}

View File

@@ -44,8 +44,8 @@ layout: default
<div class="post-content"> <div class="post-content">
{% if page.image %} {% if page.image.src %}
<img src="{{ page.image }}" class="preview-img" alt="Preview Image"> <img src="{{ page.image.src }}" class="preview-img" alt="{{ page.image.alt | default: "Preview Image" }}">
{% endif %} {% endif %}
{{ content }} {{ content }}

View File

@@ -6,7 +6,8 @@ categories: [Blogging, Demo]
tags: [typography] tags: [typography]
math: true math: true
mermaid: true mermaid: true
image: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png image:
src: 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. 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.

View File

@@ -84,11 +84,13 @@ Then you can use it like other markdown language: surround the graph code with `
### Preview image ### Preview image
If you want to add an image to the top of the post contents, specify the url for the image by: If you want to add an image to the top of the post contents, specify the url and alt attribute for the image:
```yaml ```yaml
--- ---
image: /path/to/image-file image:
src: /path/to/image/file
alt: image alternative text
--- ---
``` ```

View File

@@ -15,10 +15,10 @@ Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete th
There are two ways to get the theme: There are two ways to get the theme:
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy) - **Install from RubyGems** - Easy to upgrade, isolate irrelevant project files so you can focus on writing.
- Fork from GitHub - **Fork from GitHub** - Convenient for custom development, but difficult to upgrade, only suitable for web developers.
### Install From Rubygems ### Install From RubyGems
Add this line to your Jekyll site's `Gemfile`: Add this line to your Jekyll site's `Gemfile`:
@@ -38,18 +38,15 @@ And then execute:
$ bundle $ bundle
``` ```
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. Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
> **Hint**: To locate the themes gem, execute: > **Hint**: To locate the installed themes gem, execute:
> >
```console ```console
$ bundle info --path jekyll-theme-chirpy $ bundle info --path jekyll-theme-chirpy
``` ```
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem. Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from theme's gem. We have prepared everything for you there!
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
### Fork From GitHub ### Fork From GitHub
@@ -71,16 +68,14 @@ $ bash tools/init.sh
What it does is: 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` 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`.
- 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`.
3. Automatically create a commit to save the changes.
3. Automatically create a commit to save the changes.
## Usage ## Usage
@@ -88,10 +83,10 @@ What it does is:
Update the variables of `_config.yml` as needed. Some of them are typical options: Update the variables of `_config.yml` as needed. Some of them are typical options:
- `url` - `url`
- `avatar` - `avatar`
- `timezone` - `timezone`
- `theme_mode` - `lang`
### Running Local Server ### Running Local Server
@@ -116,28 +111,28 @@ Open a browser and visit to _<http://localhost:4000>_.
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`. Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
Now you can now choose ONE of the following methods to deploy your website. Now you can choose ONE of the following methods to deploy your Jekyll site.
#### Deploy on GitHub Pages #### 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 GH 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.
Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Quickly check the files needed for GitHub Actions build:
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.
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook - 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.
- Ensuer your Jekyll site has file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
Rename your repoistory to `<GH-USERNAME>.github.io` on GitHub. And then rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
And then publish your site by: Now publish your Jekyll site by:
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files. 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_: 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_:
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png) ![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png)
3. Visit your website at the address indicated by GitHub. 3. Visit your website at the address indicated by GitHub.
#### Deploy on Other Platforms #### Deploy on Other Platforms
@@ -160,3 +155,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. 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.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook

View File

@@ -16,10 +16,10 @@ This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme bas
First, you need to setup your account on Google analytics. While your create your account, you must create your first **Property** as well. First, you need to 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** 1. Head to <https://analytics.google.com/> and click on **Start Measuring**
2. Enter your desired *Account Name* and choose the desired checkboxes 2. Enter your desired _Account Name_ and choose the desired checkboxes
3. Enter your desired *Property Name*. This is the name of the tracker project that appears on your Google Analytics dashboard 3. Enter your desired _Property Name_. This is the name of the tracker project that appears on your Google Analytics dashboard
4. Enter the required information *About your business* 4. Enter the required information _About your business_
5. Hit *Create* and accept any license popup to setup your Google Analytics account and create your property 5. Hit _Create_ and accept any license popup to setup your Google Analytics account and create your property
### Create Data Stream ### Create Data Stream
@@ -75,9 +75,9 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
8. Click on **Enable APIs and Services** button on the top 8. Click on **Enable APIs and Services** button on the top
9. Enable the following APIs: *Google Analytics API* 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* 10. On the left, Click on _OAuth Consent Screen_ and accept **Configure Consent Screen**. Select **External** since your blog is probably hosted for the public. Click on **Publish** under _Publishing Status_
11. Click on **Credentials** on the left and create a new **OAuth Client IDs** credential. Make sure to add a entry under `Authorized redirect URIs` that matches: `https://<project-id>.<region>.r.appspot.com/admin/auth` 11. Click on **Credentials** on the left and create a new **OAuth Client IDs** credential. Make sure to add a entry under `Authorized redirect URIs` that matches: `https://<project-id>.<region>.r.appspot.com/admin/auth`
@@ -116,10 +116,11 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local. 1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local.
2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file: 2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file:
```diff
- application: your-project-id ```yaml
- version: 1 -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. 3. In `src/config.py`, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from you App Engine Dashboard.
@@ -143,7 +144,8 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
# XSRF Settings # XSRF Settings
XSRF_KEY = 'OnceUponATimeThereLivedALegend' 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.
**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 5. From inside the src/ directory, deploy the app
@@ -194,20 +196,17 @@ Head to `https://PROJECT_ID.REGION_ID.r.appspot.com/admin` and create a query af
The query parameters are as follows: The query parameters are as follows:
- **start-date**: fill in the first day of blog posting - **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) - **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` - **metrics**: select `ga:pageviews`
- **dimensions**: select `ga:pagePath` - **dimensions**: select `ga:pagePath`
In order to reduce the returned results and reduce the network bandwidth, we add custom filtering rules [^ga-filters]: 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!@=` - **filters**: fill in `ga:pagePath=~^/posts/.*/$;ga:pagePath!@=`.
Among them, `;` means using _logical AND_ to concatenate two rules. Among them, `;` means using _logical AND_ to concatenate two rules.
If the `site.baseurl` is specified, change the first filtering rule to `ga:pagePath=~^/BASE_URL/posts/.*/$`, where `BASE_URL` is the value of `site.baseurl`. If the `site.baseurl` is specified, change the first filtering rule to `ga:pagePath=~^/BASE_URL/posts/.*/$`, where `BASE_URL` is the value of `site.baseurl`.
After <kbd>Run Query</kbd>, copy the generated contents of **API Query URI** at the bottom of the page, and fill in the **Encoded URI for the query** of SuperProxy on GAE. After <kbd>Run Query</kbd>, copy the generated contents of **API Query URI** at the bottom of the page, and fill in the **Encoded URI for the query** of SuperProxy on GAE.
@@ -224,6 +223,7 @@ Once all the hard part is done, it is very easy to enable the Page View on Chirp
Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following: Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
```yaml ```yaml
google_analytics: google_analytics:
id: 'G-XXXXXXXXXX' # Fill with your Google Analytics ID id: 'G-XXXXXXXXXX' # Fill with your Google Analytics ID

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,5 @@
/* /*
* Mainly scss modules, only imported to `assets/css/main.scss` * Mainly scss modules, only imported to `assets/css/main.scss`
*
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/ */
/* ---------- scss placeholder --------- */ /* ---------- scss placeholder --------- */
@@ -100,6 +95,7 @@
@mixin panel-label { @mixin panel-label {
@include label(inherit); @include label(inherit);
display: block; display: block;
line-height: 1.2; line-height: 1.2;
padding-top: 0.5rem; padding-top: 0.5rem;

View File

@@ -1,9 +1,5 @@
/* /*
* The syntax highlight. * The syntax highlight.
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2018-2019 Cotes Chung
* MIT Licensed
*/ */
@import "colors/light-syntax"; @import "colors/light-syntax";

View File

@@ -1,10 +1,5 @@
/* /*
* Mainly scss variables * Mainly scss variables
*
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT Licensed
*/ */
/* --- ↓ width and height ---- */ /* --- ↓ width and height ---- */

View File

@@ -1,22 +1,23 @@
/*! /*!
* The styles for Jekyll theme Chirpy * The styles for Jekyll theme Chirpy
* *
* Chirpy v3.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy) * Chirpy v3.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2021 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */
@import "colors/light-typography"; @import
@import "colors/dark-typography"; "colors/light-typography",
"colors/dark-typography",
@import "addon/module"; "addon/module",
@import "addon/variables"; "addon/variables",
@import 'addon/syntax'; "addon/syntax",
@import "addon/commons"; "addon/commons",
@import "layout/home"; "layout/home",
@import "layout/post"; "layout/post",
@import "layout/tags"; "layout/tags",
@import "layout/archives"; "layout/archives",
@import "layout/categories"; "layout/categories",
@import "layout/category-tag"; "layout/category-tag";

View File

@@ -14,34 +14,12 @@
#archives { #archives {
letter-spacing: 0.03rem; letter-spacing: 0.03rem;
li {
font-size: 1.1rem;
line-height: 3rem;
&:nth-child(odd) {
background-color: var(--main-wrapper-bg, #fff);
background-image: linear-gradient(
to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
}
> div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
span.lead { span.lead {
font-size: 1.5rem; font-size: 1.5rem;
position: relative; position: relative;
left: 8px; left: 8px;
&:not(:first-child) {
position: relative;
left: 4px;
&::after {
left: 67px;
}
}
&::after { /* Year dot */ &::after { /* Year dot */
content: ""; content: "";
display: block; display: block;
@@ -59,8 +37,64 @@
box-shadow: 0 0 2px 0 #c2c6cc; box-shadow: 0 0 2px 0 #c2c6cc;
z-index: 1; z-index: 1;
} }
&:not(:first-child) {
position: relative;
left: 4px;
&::after {
left: 67px;
}
}
} // #archives span.lead } // #archives span.lead
ul {
li {
font-size: 1.1rem;
line-height: 3rem;
div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: 0.1rem;
}
}
&:nth-child(odd) {
background-color: var(--main-wrapper-bg, #fff);
background-image: linear-gradient(to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
}
&::after {
@extend %date-timeline;
height: 2.8rem;
top: -1.3rem;
}
&:first-child::before {
@extend %date-timeline;
height: 3.06rem;
top: -1.61rem;
}
}
&:not(:last-child) > li:last-child::after {
height: 3.4rem;
}
&:last-child > li:last-child::after {
display: none;
}
} // #archives ul
.date { .date {
white-space: nowrap; white-space: nowrap;
display: inline-block; display: inline-block;
@@ -97,36 +131,8 @@
} }
} // #archives .date } // #archives .date
ul {
> li {
> div > a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: 0.1rem;
}
&::after {
@extend %date-timeline;
height: 2.8rem;
top: -1.3rem;
}
&:first-child::before {
@extend %date-timeline;
height: 3.06rem;
top: -1.61rem;
}
}
&:not(:last-child) > li:last-child::after {
height: 3.4rem;
}
&:last-child > li:last-child::after {
display: none;
}
} // #archives ul
} // #archives } // #archives
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
#archives { #archives {
margin-top: -1rem; margin-top: -1rem;

View File

@@ -11,6 +11,14 @@
.card-header { .card-header {
padding-right: 12px; padding-right: 12px;
} }
i {
&.far,
&.fas {
font-size: 86%; // fontawesome icons
}
}
.list-group-item { .list-group-item {
border-left: none; border-left: none;
border-right: none; border-right: none;
@@ -29,12 +37,6 @@
@extend %category-icon-color; @extend %category-icon-color;
} }
i {
&.far, &.fas {
font-size: 86%; // fontawesome icons
}
}
} // .categories } // .categories
.category-trigger { .category-trigger {
@@ -42,7 +44,7 @@
height: 1.7rem; height: 1.7rem;
border-radius: 50%; border-radius: 50%;
text-align: center; text-align: center;
color: #6c757d!important; color: #6c757d !important;
> i.fas { > i.fas {
position: relative; position: relative;
height: 0.7rem; height: 0.7rem;

View File

@@ -2,10 +2,17 @@
Style for page Category and Tag Style for page Category and Tag
*/ */
#page-category, #page-tag { .dash {
margin: 0 .5rem .6rem .5rem;
border-bottom: 2px dotted var(--dash-color);
}
#page-category,
#page-tag {
ul > li { ul > li {
line-height: 1.5rem; line-height: 1.5rem;
padding: 0.6rem 0; padding: 0.6rem 0;
&::before { // dot &::before { // dot
background: #999; background: #999;
width: 5px; width: 5px;
@@ -17,14 +24,16 @@
top: 0.6rem; top: 0.6rem;
margin-right: 0.5rem; margin-right: 0.5rem;
} }
> a { /* post's title */ > a { /* post's title */
font-size: 1.1rem;
@extend %no-bottom-border; @extend %no-bottom-border;
font-size: 1.1rem;
} }
> span:last-child { > span:last-child {
white-space: nowrap; white-space: nowrap;
} } /* post's date */
/* post's date */
} }
} }
@@ -36,22 +45,19 @@
font-size: 1.25rem; font-size: 1.25rem;
} }
a:hover { #page-category,
#page-category &, #page-tag,
#page-tag &, #access-lastmod {
#access-lastmod & { a:hover {
@extend %link-hover; @extend %link-hover;
margin-bottom: -1px; // Avoid jumping margin-bottom: -1px; // Avoid jumping
} }
} }
.dash {
margin: 0 .5rem .6rem .5rem;
border-bottom: 2px dotted var(--dash-color);
}
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
#page-category, #page-tag { #page-category,
#page-tag {
ul > li { ul > li {
&::before { &::before {
margin: 0 .5rem; margin: 0 .5rem;

View File

@@ -2,6 +2,60 @@
Style for Homepage Style for Homepage
*/ */
.pagination {
font-size: 1rem;
a:hover {
text-decoration: none;
}
.page-item {
.page-link {
color: var(--btn-patinator-text-color);
width: 2.5rem;
height: 2.5rem;
padding: 0;
text-align: center;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
&:hover {
background-color: var(--btn-paginator-hover-color);
}
}
&.active {
.page-link {
background-color: var(--btn-active-bg);
border-color: var(--btn-active-border-color);
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
color: var(--btn-text-color);
}
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg);
}
}
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item
} // .pagination
#post-list { #post-list {
margin-top: 1rem; margin-top: 1rem;
padding-right: 0.5rem; padding-right: 0.5rem;
@@ -11,6 +65,10 @@
padding-bottom: 1rem; padding-bottom: 1rem;
border-bottom: 1px solid var(--main-border-color); border-bottom: 1px solid var(--main-border-color);
a:hover {
@extend %link-hover;
}
h1 { h1 {
font-size: 1.4rem; font-size: 1.4rem;
margin: 0; margin: 0;
@@ -55,60 +113,6 @@
} // #post-list } // #post-list
.pagination {
font-size: 1rem;
a:hover {
text-decoration: none;
}
.page-item {
.page-link {
color: var(--btn-patinator-text-color);
width: 2.5rem;
height: 2.5rem;
padding: 0;
text-align: center;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
&:hover {
background-color: var(--btn-paginator-hover-color)
}
}
&.active {
.page-link {
background-color: var(--btn-active-bg);
border-color: var(--btn-active-border-color);
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
color: var(--btn-text-color);
}
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg);
}
}
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item
} // .pagination
/* Hide SideBar and TOC */ /* Hide SideBar and TOC */
@media all and (max-width: 830px) { @media all and (max-width: 830px) {
.pagination { .pagination {

View File

@@ -4,7 +4,7 @@
@mixin btn-sharing-color($light-color, $important: false) { @mixin btn-sharing-color($light-color, $important: false) {
@if $important { @if $important {
color: var(--btn-share-color, $light-color)!important; color: var(--btn-share-color, $light-color) !important;
} @else { } @else {
color: var(--btn-share-color, $light-color); color: var(--btn-share-color, $light-color);
} }
@@ -41,9 +41,10 @@
.post-content { .post-content {
.preview-img { .preview-img {
margin-top: 0;
margin-bottom: 2.5rem;
@include align-center; @include align-center;
margin-top: 0;
margin-bottom: 2.5rem !important;
} }
} }
@@ -63,6 +64,7 @@
.btn { .btn {
@include btn-post-nav; @include btn-post-nav;
color: var(--link-color); color: var(--link-color);
&:hover { &:hover {
background: #2a408e; background: #2a408e;
@@ -71,6 +73,7 @@
} }
&.disabled { &.disabled {
@include btn-post-nav; @include btn-post-nav;
pointer-events: auto; pointer-events: auto;
cursor: not-allowed; cursor: not-allowed;
background: none; background: none;
@@ -82,6 +85,12 @@
&.btn-outline-primary.disabled:focus { &.btn-outline-primary.disabled:focus {
box-shadow: none; box-shadow: none;
} }
&::before {
color: var(--text-muted-color);
font-size: 0.65rem;
text-transform: uppercase;
content: attr(prompt);
}
} }
p { p {
@@ -92,12 +101,6 @@
} }
a { a {
&::before {
color: var(--text-muted-color);
font-size: 0.65rem;
text-transform: uppercase;
content: attr(prompt);
}
&:first-child { &:first-child {
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
@@ -109,6 +112,7 @@
right: 0.5px; right: 0.5px;
} }
} }
} // .post-navigation } // .post-navigation
@keyframes fade-up { @keyframes fade-up {
@@ -139,17 +143,16 @@
} }
} }
#toc li>a { #toc li > a {
line-height: 1rem; line-height: 1rem;
padding-top: 0.5rem; padding-top: 0.5rem;
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
} }
/* --- Related Posts --- */
/*--- Related Posts ---*/
#related-posts { #related-posts {
>h3 { > h3 {
@include label(1.1rem, 600); @include label(1.1rem, 600);
} }
.card { .card {
@@ -165,7 +168,7 @@
&:hover { &:hover {
-webkit-transform: translate3d(0, -3px, 0); -webkit-transform: translate3d(0, -3px, 0);
transform: translate3d(0, -3px, 0); transform: translate3d(0, -3px, 0);
box-shadow: 0 10px 15px -4px rgba(0,0,0,0.15); box-shadow: 0 10px 15px -4px rgba(0, 0, 0, 0.15);
} }
} }
@@ -190,7 +193,7 @@
ul { ul {
list-style-type: none; list-style-type: none;
padding-inline-start: 1.5rem; padding-inline-start: 1.5rem;
>li::before { > li::before {
background: #c2c9d4; background: #c2c9d4;
width: 5px; width: 5px;
height: 5px; height: 5px;
@@ -216,12 +219,17 @@
} }
%btn-share-hovor { %btn-share-hovor {
color: var(--btn-share-hover-color)!important; color: var(--btn-share-hover-color) !important;
} }
.share-wrapper { .share-wrapper {
vertical-align: middle; vertical-align: middle;
user-select: none; user-select: none;
i {
font-weight: 400;
}
.share-icons { .share-icons {
font-size: 1.2rem; font-size: 1.2rem;
a { a {
@@ -230,12 +238,12 @@
} }
&:hover { &:hover {
text-decoration: none; text-decoration: none;
>i { > i {
@extend %btn-share-hovor; @extend %btn-share-hovor;
} }
} }
} }
>i { > i {
padding-top: 0.35rem; padding-top: 0.35rem;
&:hover { &:hover {
@extend %btn-share-hovor; @extend %btn-share-hovor;
@@ -243,7 +251,7 @@
} }
.fab { .fab {
&.fa-twitter { &.fa-twitter {
@include btn-sharing-color(rgba(29, 161, 242, 1.00)); @include btn-sharing-color(rgba(29, 161, 242, 1));
} }
&.fa-facebook-square { &.fa-facebook-square {
@include btn-sharing-color(rgb(66, 95, 156)); @include btn-sharing-color(rgb(66, 95, 156));
@@ -264,9 +272,9 @@
} // .share-wrapper } // .share-wrapper
.share-label { .share-label {
@include label(inherit, 400, inherit); @include label(inherit, 400, inherit);
&::after { &::after {
content: ":"; content: ":";
} }
@@ -274,25 +282,22 @@
.license-wrapper { .license-wrapper {
line-height: 1.2rem; line-height: 1.2rem;
>a { > a {
font-weight: 600; font-weight: 600;
&:hover { &:hover {
@extend %link-hover; @extend %link-hover;
} }
} }
i {
font-weight: 400;
}
span:last-child { span:last-child {
font-size: 0.85rem; font-size: 0.85rem;
} }
} // .license-wrapper } // .license-wrapper
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
.post-tail-bottom { .post-tail-bottom {
-ms-flex-wrap: wrap-reverse!important; -ms-flex-wrap: wrap-reverse !important;
flex-wrap: wrap-reverse!important; flex-wrap: wrap-reverse !important;
>div:first-child { >div:first-child {
width: 100%; width: 100%;
margin-top: 1rem; margin-top: 1rem;
@@ -301,8 +306,8 @@
.post-content > div[class^='language-'] { .post-content > div[class^='language-'] {
@include ml-mr(-1.25rem); @include ml-mr(-1.25rem);
border-radius: 0;
border-radius: 0;
&::before { // the lang badge &::before { // the lang badge
right: 1rem; right: 1rem;
} }
@@ -323,10 +328,10 @@
@include dot(0.5rem, 0.2rem); @include dot(0.5rem, 0.2rem);
} }
&.flex-column { &.flex-column {
-webkit-box-orient: horizontal!important; -webkit-box-orient: horizontal !important;
-webkit-box-direction: normal!important; -webkit-box-direction: normal !important;
-ms-flex-direction: row!important; -ms-flex-direction: row !important;
flex-direction: row!important; flex-direction: row !important;
} }
} }
} // .post } // .post

View File

@@ -2,10 +2,6 @@
layout: compress layout: compress
# A part of the Favicons # A part of the Favicons
# v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
--- ---
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<browserconfig> <browserconfig>
@@ -17,4 +13,4 @@ layout: compress
<TileColor>#ffffff</TileColor> <TileColor>#ffffff</TileColor>
</tile> </tile>
</msapplication> </msapplication>
</browserconfig> </browserconfig>

View File

@@ -2,10 +2,6 @@
layout: compress layout: compress
# #
# A part of the Favicons # A part of the Favicons
# Chirpy v2.0
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2019 Cotes Chung
# MIT License
--- ---
{% assign icon_url = "/assets/img/favicons" | relative_url %} {% assign icon_url = "/assets/img/favicons" | relative_url %}

View File

@@ -1,5 +1,5 @@
/*! /*!
* Chirpy v3.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v3.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2021 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -2,10 +2,6 @@
layout: compress layout: compress
# The list to be cached by PWA # The list to be cached by PWA
# Chirpy v2.2
# https://github.com/cotes2020/jekyll-theme-chirpy
# © 2020 Cotes Chung
# MIT Licensed
--- ---
const include = [ const include = [

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v3.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v3.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2021 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */
function copyLink(e){e&&0!==e.length||(e=window.location.href);const o=$("<input>");$("body").append(o),o.val(e).select(),document.execCommand("copy"),o.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),s=$("#search-cancel"),t=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),d=$("#search-result-wrapper"),r=$("#search-results"),c=$("#search-input"),i=$("#search-hints"),f=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),u={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),s.addClass("loaded")},off(){s.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(d.removeClass("unloaded"),a.addClass("hidden"),e=!0,f.block())},off(){e&&(r.empty(),i.hasClass("unloaded")&&i.removeClass("unloaded"),d.addClass("unloaded"),t.removeClass("visible"),a.removeClass("hidden"),c.val(""),e=!1,f.release())},isVisible:()=>e}}();function h(){return s.hasClass("loaded")}o.click(function(){u.on(),p.on(),c.focus()}),s.click(function(){u.off(),p.off()}),c.focus(function(){n.addClass("input-focus")}),c.focusout(function(){n.removeClass("input-focus")}),c.on("keyup",function(e){8===e.keyCode&&""===c.val()?h()?i.removeClass("unloaded"):p.off():""!==c.val()&&(p.on(),t.hasClass("visible")||t.addClass("visible"),h()&&i.addClass("unloaded"))}),t.on("click",function(){c.val(""),h()?(i.removeClass("unloaded"),r.empty()):p.off(),c.focus(),t.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const o=$("body");return{toggle(){!1===e?o.attr("sidebar-display",""):o.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),o=$("#toc-wrapper"),s=$(".access"),t=$("#search-input");let a,l=0;const n=5,d=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>d?(e.removeClass("topbar-down").addClass("topbar-up"),o.length>0&&o.removeClass("topbar-down"),s.length>0&&s.removeClass("topbar-down"),t.is(":focus")&&t.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),o.length>0&&o.addClass("topbar-down"),s.length>0&&s.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),s=e.text().trim();let t=o.length>0?o.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==t&&e.text(t):e.text()!==s&&e.text(s)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){const e=$(".collapse");e.on("hide.bs.collapse",function(){const e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${e} i.fas`).addClass("rotate"),$(`#${e}`).removeClass("hide-border-bottom"))}),e.on("show.bs.collapse",function(){const e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${e} i.fas`).removeClass("rotate"),$(`#${e}`).addClass("hide-border-bottom"))})}); function copyLink(e){e&&0!==e.length||(e=window.location.href);const o=$("<input>");$("body").append(o),o.val(e).select(),document.execCommand("copy"),o.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),s=$("#search-cancel"),t=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),d=$("#search-result-wrapper"),r=$("#search-results"),c=$("#search-input"),i=$("#search-hints"),f=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),u={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),s.addClass("loaded")},off(){s.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(d.removeClass("unloaded"),a.addClass("hidden"),e=!0,f.block())},off(){e&&(r.empty(),i.hasClass("unloaded")&&i.removeClass("unloaded"),d.addClass("unloaded"),t.removeClass("visible"),a.removeClass("hidden"),c.val(""),e=!1,f.release())},isVisible:()=>e}}();function h(){return s.hasClass("loaded")}o.click(function(){u.on(),p.on(),c.focus()}),s.click(function(){u.off(),p.off()}),c.focus(function(){n.addClass("input-focus")}),c.focusout(function(){n.removeClass("input-focus")}),c.on("keyup",function(e){8===e.keyCode&&""===c.val()?h()?i.removeClass("unloaded"):p.off():""!==c.val()&&(p.on(),t.hasClass("visible")||t.addClass("visible"),h()&&i.addClass("unloaded"))}),t.on("click",function(){c.val(""),h()?(i.removeClass("unloaded"),r.empty()):p.off(),c.focus(),t.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const o=$("body");return{toggle(){!1===e?o.attr("sidebar-display",""):o.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),o=$("#toc-wrapper"),s=$(".access"),t=$("#search-input");let a,l=0;const n=5,d=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>d?(e.removeClass("topbar-down").addClass("topbar-up"),o.length>0&&o.removeClass("topbar-down"),s.length>0&&s.removeClass("topbar-down"),t.is(":focus")&&t.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),o.length>0&&o.addClass("topbar-down"),s.length>0&&s.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),s=e.text().trim();let t=o.length>0?o.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==t&&e.text(t):e.text()!==s&&e.text(s)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){const e=$(".collapse");e.on("hide.bs.collapse",function(){const e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${e} i.fas`).addClass("rotate"),$(`#${e}`).removeClass("hide-border-bottom"))}),e.on("show.bs.collapse",function(){const e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${e} i.fas`).removeClass("rotate"),$(`#${e}`).addClass("hide-border-bottom"))})});

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v3.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v3.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2021 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */
function copyLink(e){e&&0!==e.length||(e=window.location.href);const t=$("<input>");$("body").append(t),t.val(e).select(),document.execCommand("copy"),t.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),n=$("#topbar-title"),l=$("#search-wrapper"),i=$("#search-result-wrapper"),r=$("#search-results"),c=$("#search-input"),d=$("#search-hints"),u=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),h={on(){e.addClass("unloaded"),n.addClass("unloaded"),t.addClass("unloaded"),l.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),l.removeClass("d-flex"),e.removeClass("unloaded"),n.removeClass("unloaded"),t.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(i.removeClass("unloaded"),s.addClass("hidden"),e=!0,u.block())},off(){e&&(r.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),i.addClass("unloaded"),a.removeClass("visible"),s.removeClass("hidden"),c.val(""),e=!1,u.release())},isVisible:()=>e}}();function p(){return o.hasClass("loaded")}t.click(function(){h.on(),f.on(),c.focus()}),o.click(function(){h.off(),f.off()}),c.focus(function(){l.addClass("input-focus")}),c.focusout(function(){l.removeClass("input-focus")}),c.on("keyup",function(e){8===e.keyCode&&""===c.val()?p()?d.removeClass("unloaded"):f.off():""!==c.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),p()&&d.addClass("unloaded"))}),a.on("click",function(){c.val(""),p()?(d.removeClass("unloaded"),r.empty()):f.off(),c.focus(),a.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const t=$("body");return{toggle(){!1===e?t.attr("sidebar-display",""):t.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),t=$("#toc-wrapper"),o=$(".access"),a=$("#search-input");let s,n=0;const l=5,i=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(s=!0)}),setInterval(function(){s&&(!function(){var s=$(this).scrollTop();Math.abs(n-s)<=l||(s>n&&s>i?(e.removeClass("topbar-down").addClass("topbar-up"),t.length>0&&t.removeClass("topbar-down"),o.length>0&&o.removeClass("topbar-down"),a.is(":focus")&&a.blur()):s+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),t.length>0&&t.addClass("topbar-down"),o.length>0&&o.addClass("topbar-down")),n=s)}(),s=!1)},250)}),$(function(){const e=$("#topbar-title"),t=$("div.post>h1"),o=e.text().trim();let a=t.length>0?t.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||t.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==a&&e.text(a):e.text()!==o&&e.text(o)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){let e=$(".timeago").length,t=void 0;function o(){return $(".timeago").each(function(){if($(this).children("i").length>0){$(this).text();let t=$(this).hasClass("lastmod"),o=$(this).children("i"),a=o.text();$(this).text(function(t,o){let a=new Date,s=new Date(t);if(s.getFullYear()!==a.getFullYear())return e-=1,s.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric"});if(s.getMonth()!==a.getMonth())return e-=1,s.toLocaleString("en-US",{month:"short",day:"numeric"});let n=Math.floor((a-s)/1e3),l=Math.floor(n/86400);if(l>=1)return e-=1,l+" day"+(l>1?"s":"")+" ago";let i=Math.floor(n/3600);if(i>=1)return i+" hour"+(i>1?"s":"")+" ago";let r=Math.floor(n/60);return r>=1?r+" minute"+(r>1?"s":"")+" ago":(o?"just":"Just")+" now"}(a,t)),$(this).append(o)}}),0===e&&void 0!==t&&clearInterval(t),e}0!==e&&o()>0&&(t=setInterval(o,6e4))}); function copyLink(e){e&&0!==e.length||(e=window.location.href);const t=$("<input>");$("body").append(t),t.val(e).select(),document.execCommand("copy"),t.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),n=$("#topbar-title"),l=$("#search-wrapper"),i=$("#search-result-wrapper"),r=$("#search-results"),c=$("#search-input"),d=$("#search-hints"),u=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),h={on(){e.addClass("unloaded"),n.addClass("unloaded"),t.addClass("unloaded"),l.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),l.removeClass("d-flex"),e.removeClass("unloaded"),n.removeClass("unloaded"),t.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(i.removeClass("unloaded"),s.addClass("hidden"),e=!0,u.block())},off(){e&&(r.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),i.addClass("unloaded"),a.removeClass("visible"),s.removeClass("hidden"),c.val(""),e=!1,u.release())},isVisible:()=>e}}();function p(){return o.hasClass("loaded")}t.click(function(){h.on(),f.on(),c.focus()}),o.click(function(){h.off(),f.off()}),c.focus(function(){l.addClass("input-focus")}),c.focusout(function(){l.removeClass("input-focus")}),c.on("keyup",function(e){8===e.keyCode&&""===c.val()?p()?d.removeClass("unloaded"):f.off():""!==c.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),p()&&d.addClass("unloaded"))}),a.on("click",function(){c.val(""),p()?(d.removeClass("unloaded"),r.empty()):f.off(),c.focus(),a.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const t=$("body");return{toggle(){!1===e?t.attr("sidebar-display",""):t.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),t=$("#toc-wrapper"),o=$(".access"),a=$("#search-input");let s,n=0;const l=5,i=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(s=!0)}),setInterval(function(){s&&(!function(){var s=$(this).scrollTop();Math.abs(n-s)<=l||(s>n&&s>i?(e.removeClass("topbar-down").addClass("topbar-up"),t.length>0&&t.removeClass("topbar-down"),o.length>0&&o.removeClass("topbar-down"),a.is(":focus")&&a.blur()):s+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),t.length>0&&t.addClass("topbar-down"),o.length>0&&o.addClass("topbar-down")),n=s)}(),s=!1)},250)}),$(function(){const e=$("#topbar-title"),t=$("div.post>h1"),o=e.text().trim();let a=t.length>0?t.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||t.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==a&&e.text(a):e.text()!==o&&e.text(o)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){let e=$(".timeago").length,t=void 0;function o(){return $(".timeago").each(function(){if($(this).children("i").length>0){$(this).text();let t=$(this).hasClass("lastmod"),o=$(this).children("i"),a=o.text();$(this).text(function(t,o){let a=new Date,s=new Date(t);if(s.getFullYear()!==a.getFullYear())return e-=1,s.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric"});if(s.getMonth()!==a.getMonth())return e-=1,s.toLocaleString("en-US",{month:"short",day:"numeric"});let n=Math.floor((a-s)/1e3),l=Math.floor(n/86400);if(l>=1)return e-=1,l+" day"+(l>1?"s":"")+" ago";let i=Math.floor(n/3600);if(i>=1)return i+" hour"+(i>1?"s":"")+" ago";let r=Math.floor(n/60);return r>=1?r+" minute"+(r>1?"s":"")+" ago":(o?"just":"Just")+" now"}(a,t)),$(this).append(o)}}),0===e&&void 0!==t&&clearInterval(t),e}0!==e&&o()>0&&(t=setInterval(o,6e4))});

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v3.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v3.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2021 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */
function copyLink(e){e&&0!==e.length||(e=window.location.href);const t=$("<input>");$("body").append(t),t.val(e).select(),document.execCommand("copy"),t.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),c=$("#search-result-wrapper"),r=$("#search-results"),i=$("#search-input"),d=$("#search-hints"),u=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),f={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),n.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(c.removeClass("unloaded"),a.addClass("hidden"),e=!0,u.block())},off(){e&&(r.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),c.addClass("unloaded"),s.removeClass("visible"),a.removeClass("hidden"),i.val(""),e=!1,u.release())},isVisible:()=>e}}();function h(){return o.hasClass("loaded")}t.click(function(){f.on(),p.on(),i.focus()}),o.click(function(){f.off(),p.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?d.removeClass("unloaded"):p.off():""!==i.val()&&(p.on(),s.hasClass("visible")||s.addClass("visible"),h()&&d.addClass("unloaded"))}),s.on("click",function(){i.val(""),h()?(d.removeClass("unloaded"),r.empty()):p.off(),i.focus(),s.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const t=$("body");return{toggle(){!1===e?t.attr("sidebar-display",""):t.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),t=$("#toc-wrapper"),o=$(".access"),s=$("#search-input");let a,l=0;const n=5,c=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>c?(e.removeClass("topbar-down").addClass("topbar-up"),t.length>0&&t.removeClass("topbar-down"),o.length>0&&o.removeClass("topbar-down"),s.is(":focus")&&s.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),t.length>0&&t.addClass("topbar-down"),o.length>0&&o.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),t=$("div.post>h1"),o=e.text().trim();let s=t.length>0?t.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||t.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==s&&e.text(s):e.text()!==o&&e.text(o)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(e){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){const t=16,o=decodeURI(this.hash);let s=RegExp(/^#fnref:/).test(o),a=RegExp(/^#fn:/).test(o),l=o.includes(":")?o.replace(/\:/,"\\:"):o,n=$(l);if(n.length){e.preventDefault(),history.pushState&&history.pushState(null,null,o);let l=$(this).offset().top,c=n.offset().top;const r=c<l,i=$("#topbar-wrapper").outerHeight();r&&s&&(c-=i+t/2),$("html,body").animate({scrollTop:c},800,()=>{const e=$(n);e.focus();if($("[scroll-focus=true]").length&&$("[scroll-focus=true]").attr("scroll-focus",!1),$(":target").length&&$(":target").attr("scroll-focus",!1),(a||s)&&e.attr("scroll-focus",!0),e.is(":focus"))return!1;e.attr("tabindex","-1"),e.focus()})}}})}); function copyLink(e){e&&0!==e.length||(e=window.location.href);const t=$("<input>");$("body").append(t),t.val(e).select(),document.execCommand("copy"),t.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),c=$("#search-result-wrapper"),r=$("#search-results"),i=$("#search-input"),d=$("#search-hints"),u=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),f={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),n.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(c.removeClass("unloaded"),a.addClass("hidden"),e=!0,u.block())},off(){e&&(r.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),c.addClass("unloaded"),s.removeClass("visible"),a.removeClass("hidden"),i.val(""),e=!1,u.release())},isVisible:()=>e}}();function h(){return o.hasClass("loaded")}t.click(function(){f.on(),p.on(),i.focus()}),o.click(function(){f.off(),p.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?d.removeClass("unloaded"):p.off():""!==i.val()&&(p.on(),s.hasClass("visible")||s.addClass("visible"),h()&&d.addClass("unloaded"))}),s.on("click",function(){i.val(""),h()?(d.removeClass("unloaded"),r.empty()):p.off(),i.focus(),s.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const t=$("body");return{toggle(){!1===e?t.attr("sidebar-display",""):t.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),t=$("#toc-wrapper"),o=$(".access"),s=$("#search-input");let a,l=0;const n=5,c=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>c?(e.removeClass("topbar-down").addClass("topbar-up"),t.length>0&&t.removeClass("topbar-down"),o.length>0&&o.removeClass("topbar-down"),s.is(":focus")&&s.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),t.length>0&&t.addClass("topbar-down"),o.length>0&&o.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),t=$("div.post>h1"),o=e.text().trim();let s=t.length>0?t.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||t.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==s&&e.text(s):e.text()!==o&&e.text(o)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(e){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){const t=16,o=decodeURI(this.hash);let s=RegExp(/^#fnref:/).test(o),a=RegExp(/^#fn:/).test(o),l=o.includes(":")?o.replace(/\:/,"\\:"):o,n=$(l);if(n.length){e.preventDefault(),history.pushState&&history.pushState(null,null,o);let l=$(this).offset().top,c=n.offset().top;const r=c<l,i=$("#topbar-wrapper").outerHeight();r&&s&&(c-=i+t/2),$("html,body").animate({scrollTop:c},800,()=>{const e=$(n);e.focus();if($("[scroll-focus=true]").length&&$("[scroll-focus=true]").attr("scroll-focus",!1),$(":target").length&&$(":target").attr("scroll-focus",!1),(a||s)&&e.attr("scroll-focus",!0),e.is(":focus"))return!1;e.attr("tabindex","-1"),e.focus()})}}})});

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v3.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v3.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2021 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */
const getInitStatus=function(){let e=!1;return()=>{let t=e;return e||(e=!0),t}}(),PvOpts={isEnabled:()=>"true"===$("meta[name=pv-cache-enabled]").attr("content"),getProxyEndpoint:()=>$("meta[name=pv-proxy-endpoint]").attr("content"),getLocalData:()=>$("meta[name=pv-cache-data]").attr("content")},PvCache=function(){const e="origin",t="proxy";function a(e){return localStorage.getItem(e)}function n(e,t){localStorage.setItem(e,t)}return{getData:()=>JSON.parse(localStorage.getItem("pv")),saveOriginCache(t){n("pv",t),n("pv_source",e),n("pv_created_date",(new Date).toJSON())},saveProxyCache(e){n("pv",e),n("pv_source",t),n("pv_created_date",(new Date).toJSON())},isFromOrigin:()=>a("pv_source")===e,isFromProxy:()=>a("pv_source")===t,isExpired(){if(PvCache.isFromOrigin()){let e=new Date(a("pv_created_date"));return e.setDate(e.getDate()+1),Date.now()>=e.getTime()}if(PvCache.isFromProxy()){let e=new Date(a("pv_created_date"));return e.setHours(e.getHours()+1),Date.now()>=e.getTime()}return!1},getAllPageviews:()=>PvCache.getData().totalsForAllResults["ga:pageviews"],newerThan:e=>PvCache.getAllPageviews()>e.totalsForAllResults["ga:pageviews"],inspectKeys(){null!==localStorage.getItem("pv")&&null!==localStorage.getItem("pv_source")&&null!==localStorage.getItem("pv_created_date")||localStorage.clear()}}}();function countUp(e,t,a){if(e<t){let n=new CountUp(a,e,t);n.error?console.error(n.error):n.start()}}function countPV(e,t){let a=0;if(void 0!==t)for(let n=0;n<t.length;++n){if(t[parseInt(n,10)][0]===e){a+=parseInt(t[parseInt(n,10)][1],10);break}}return a}function tacklePV(e,t,a,n){let r=countPV(t,e);if(r=0===r?1:r,n){const e=parseInt(a.text().replace(/,/g,""),10);r>e&&countUp(e,r,a.attr("id"))}else a.text((new Intl.NumberFormat).format(r))}function displayPageviews(e){if(void 0===e)return;let t=getInitStatus();const a=e.rows;if($("#post-list").length>0)$(".post-preview").each(function(){const e=$(this).find("a").attr("href");tacklePV(a,e,$(this).find(".pageviews"),t)});else if($(".post").length>0){const e=window.location.pathname;tacklePV(a,e,$("#pv"),t)}}function fetchProxyPageviews(){$.ajax({type:"GET",url:PvOpts.getProxyEndpoint(),dataType:"jsonp",jsonpCallback:"displayPageviews",success:(e,t,a)=>{PvCache.saveProxyCache(JSON.stringify(e))},error:(e,t,a)=>{console.log("Failed to load pageviews from proxy server: "+a)}})}function fetchPageviews(e=!0,t=!1){PvOpts.isEnabled()&&e?fetch(PvOpts.getLocalData()).then(e=>e.json()).then(e=>{t&&PvCache.newerThan(e)||(displayPageviews(e),PvCache.saveOriginCache(JSON.stringify(e)))}).then(()=>fetchProxyPageviews()):fetchProxyPageviews()}$(function(){if($(".pageviews").length>0){PvCache.inspectKeys();let e=PvCache.getData();e?(displayPageviews(e),PvCache.isExpired()?fetchPageviews(!0,PvCache.isFromProxy()):PvCache.isFromOrigin()&&fetchPageviews(!1)):fetchPageviews()}}); const getInitStatus=function(){let e=!1;return()=>{let t=e;return e||(e=!0),t}}(),PvOpts={isEnabled:()=>"true"===$("meta[name=pv-cache-enabled]").attr("content"),getProxyEndpoint:()=>$("meta[name=pv-proxy-endpoint]").attr("content"),getLocalData:()=>$("meta[name=pv-cache-data]").attr("content")},PvCache=function(){const e="origin",t="proxy";function a(e){return localStorage.getItem(e)}function n(e,t){localStorage.setItem(e,t)}return{getData:()=>JSON.parse(localStorage.getItem("pv")),saveOriginCache(t){n("pv",t),n("pv_source",e),n("pv_created_date",(new Date).toJSON())},saveProxyCache(e){n("pv",e),n("pv_source",t),n("pv_created_date",(new Date).toJSON())},isFromOrigin:()=>a("pv_source")===e,isFromProxy:()=>a("pv_source")===t,isExpired(){if(PvCache.isFromOrigin()){let e=new Date(a("pv_created_date"));return e.setDate(e.getDate()+1),Date.now()>=e.getTime()}if(PvCache.isFromProxy()){let e=new Date(a("pv_created_date"));return e.setHours(e.getHours()+1),Date.now()>=e.getTime()}return!1},getAllPageviews:()=>PvCache.getData().totalsForAllResults["ga:pageviews"],newerThan:e=>PvCache.getAllPageviews()>e.totalsForAllResults["ga:pageviews"],inspectKeys(){null!==localStorage.getItem("pv")&&null!==localStorage.getItem("pv_source")&&null!==localStorage.getItem("pv_created_date")||localStorage.clear()}}}();function countUp(e,t,a){if(e<t){let n=new CountUp(a,e,t);n.error?console.error(n.error):n.start()}}function countPV(e,t){let a=0;if(void 0!==t)for(let n=0;n<t.length;++n){if(t[parseInt(n,10)][0]===e){a+=parseInt(t[parseInt(n,10)][1],10);break}}return a}function tacklePV(e,t,a,n){let r=countPV(t,e);if(r=0===r?1:r,n){const e=parseInt(a.text().replace(/,/g,""),10);r>e&&countUp(e,r,a.attr("id"))}else a.text((new Intl.NumberFormat).format(r))}function displayPageviews(e){if(void 0===e)return;let t=getInitStatus();const a=e.rows;if($("#post-list").length>0)$(".post-preview").each(function(){const e=$(this).find("a").attr("href");tacklePV(a,e,$(this).find(".pageviews"),t)});else if($(".post").length>0){const e=window.location.pathname;tacklePV(a,e,$("#pv"),t)}}function fetchProxyPageviews(){$.ajax({type:"GET",url:PvOpts.getProxyEndpoint(),dataType:"jsonp",jsonpCallback:"displayPageviews",success:(e,t,a)=>{PvCache.saveProxyCache(JSON.stringify(e))},error:(e,t,a)=>{console.log("Failed to load pageviews from proxy server: "+a)}})}function fetchPageviews(e=!0,t=!1){PvOpts.isEnabled()&&e?fetch(PvOpts.getLocalData()).then(e=>e.json()).then(e=>{t&&PvCache.newerThan(e)||(displayPageviews(e),PvCache.saveOriginCache(JSON.stringify(e)))}).then(()=>fetchProxyPageviews()):fetchProxyPageviews()}$(function(){if($(".pageviews").length>0){PvCache.inspectKeys();let e=PvCache.getData();e?(displayPageviews(e),PvCache.isExpired()?fetchPageviews(!0,PvCache.isFromProxy()):PvCache.isFromOrigin()&&fetchPageviews(!1)):fetchPageviews()}});

View File

@@ -2,12 +2,13 @@
Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) | 简体中文 Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) | 简体中文
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy)
[![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush) [![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg?color=blue)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
一个不一样的 Jekyll 主题,采用响应式设计,方便记录、管理、分享的知识和经验。[懂的进 »](https://chirpy.cotes.info) 一个不一样的 Jekyll 主题,采用响应式设计,方便记录、管理、分享的知识和经验。[懂的进 »](https://chirpy.cotes.info)
[![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info) [![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info)
@@ -19,6 +20,7 @@ Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) |
- [前提要求](#前提要求) - [前提要求](#前提要求)
- [安装](#安装) - [安装](#安装)
- [使用](#使用) - [使用](#使用)
- [文档](#文档)
- [参与贡献](#参与贡献) - [参与贡献](#参与贡献)
- [鸣谢](#鸣谢) - [鸣谢](#鸣谢)
- [赞助](#赞助) - [赞助](#赞助)
@@ -53,18 +55,18 @@ Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) |
有二法可得此主题: 有二法可得此主题:
-[RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy) 安装 - **从 RubyGems 安装** - 易于版本升级,隔离无关的主题项目文件,让您的仓库舒适清爽。
- 从 GitHub 上 Fork - **从 GitHub 上 Fork** - 对个性化二次开发友好,但是难于升级,只适合专业开发人员使用。
### Rubygems 安装 ### RubyGems 安装
的 Jekyll 站点的 `Gemfile` 添加: 的 Jekyll 站点的 `Gemfile` 添加:
```ruby ```ruby
gem "jekyll-theme-chirpy" gem "jekyll-theme-chirpy"
``` ```
然后,添加这行到的 Jekyll 站点的 `_config.yml`: 然后,添加这行到的 Jekyll 站点的 `_config.yml`:
```yaml ```yaml
theme: jekyll-theme-chirpy theme: jekyll-theme-chirpy
@@ -76,7 +78,7 @@ theme: jekyll-theme-chirpy
$ bundle $ bundle
``` ```
最后, 拷贝额外所需主题的 gem 文件(详见 [starter 项目][starter] 的文件目录)至的 Jekyll 站点, 然后把主题的 `_config.yml` 全部内容附加到的 Jekyll 站点的同名文件。 最后, 拷贝额外所需主题的 gem 文件(详见 [starter 项目][starter] 的文件目录)至的 Jekyll 站点, 然后把主题的 `_config.yml` 全部内容附加到的 Jekyll 站点的同名文件。
> **提示**: 定位主题的 gem 文件,可以执行: > **提示**: 定位主题的 gem 文件,可以执行:
> >
@@ -84,10 +86,7 @@ $ bundle
$ bundle info --path jekyll-theme-chirpy $ bundle info --path jekyll-theme-chirpy
``` ```
或者可以 [使用 starter template][use-starter] 来快速创建 Jekyll 站点,以省去复制主题 gem 文件的时间。 或者可以 [使用 starter template][use-starter] 来快速创建 Jekyll 站点,以省去复制主题 gem 文件的时间。
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
### 在 GitHub 上 Fork ### 在 GitHub 上 Fork
@@ -105,19 +104,18 @@ $ bundle
$ bash tools/init.sh $ bash tools/init.sh
``` ```
> 如果不打算部署到 GitHub Pages, 在上述命令后附加参数选项 `--no-gh`。 > 如果不打算部署到 GitHub Pages, 在上述命令后附加参数选项 `--no-gh`。
上述脚本完成了以下工作: 上述脚本完成了以下工作:
1.的仓库中删除了: 1.的仓库中删除了:
- `.travis.yml` - `.travis.yml`
- `_posts` 下的文件 - `_posts` 下的文件
- `docs` 目录 - `docs` 目录
2. 如果使用了参数 `--no-gh`,则会怒删 `.github`。否则,将会配置 GitHub Actions`.github/workflows/pages-deploy.yml.hook` 的后缀 `.hook` 去除,然后删除 `.github` 里的其他目录和文件。 2. 如果使用了参数 `--no-gh`,则会怒删 `.github`。否则,将会配置 GitHub Actions`.github/workflows/pages-deploy.yml.hook` 的后缀 `.hook` 去除,然后删除 `.github` 里的其他目录和文件。
3. 自动提交一个 Commit 以保存上述文件的更改。 3. 自动提交一个 Commit 以保存上述文件的更改。
## 使用 ## 使用
@@ -128,7 +126,7 @@ $ bash tools/init.sh
- `url` - `url`
- `avatar` - `avatar`
- `timezone` - `timezone`
- `theme_mode` - `lang`
### 本地运行 ### 本地运行
@@ -151,27 +149,28 @@ $ docker run -it --rm \
### 部署 ### 部署
部署开始前,把 `_config.yml``url` 改为 `https://<username>.github.io`(或者的私有域名,如:`https://yourdomain.com`)。另外,如果想使用 [Project 类型网站](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites),修改配置文件的 `baseurl` 为项目名称,以斜杠开头,如:`/project` 部署开始前,把 `_config.yml``url` 改为 `https://<username>.github.io`(或者的私有域名,如:`https://yourdomain.com`)。另外,如果想使用 [Project 类型网站](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites),修改配置文件的 `baseurl` 为项目名称,以斜杠开头,如:`/project`
现在可以选择下列其中一个方式去站点部署。 现在可以选择下列其中一个方式去站点部署。
#### 部署到 GitHub Pages #### 部署到 GitHub Pages
由于安全原因GitHub Pages 的构建强制加了 `safe`参数,这导致了我们不能使用插件去创建所需的附加页面。因此,我们可以使用 GitHub Actions 去构建站点,把站点文件存储在一个新分支上,再指定该分支作为 Pages 服务的源。 由于安全原因GitHub Pages 的构建强制加了 `safe`参数,这导致了我们不能使用插件去创建所需的附加页面。因此,我们可以使用 GitHub Actions 去构建站点,把站点文件存储在一个新分支上,再指定该分支作为 Pages 服务的源。
确保你的 Jekyll 站点存在文件 `/.github/workflows/pages-deploy.yml`。没有的话,新建并填入[示例工作流][workflow]的内容, 注意参数 `on.push.branches` 的值必须和你的仓库默认分支名相同。 快速检查 GitHub Actions 构建需要的文件:
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook - 确保您的 Jekyll 站点存在文件 `.github/workflows/pages-deploy.yml`。没有的话,新建并填入[示例工作流][workflow]的内容, 注意参数 `on.push.branches` 的值必须和您的仓库默认分支名相同。
- 检查您的 Jekyll 站点是否有文件 `tools/test.sh``tools/deploy.sh`. 没有的话, 从本仓库拷贝到您的 Jekyll 项目.
在 GitHub 把的仓库命名为 `<GH-USERNAME>.github.io`,然后: 在 GitHub 把的仓库命名为 `<GH-USERNAME>.github.io`,然后开始发布
1. 推送任意一个 commit 到 `origin/master` 以触发 GitHub Actions workflow。一旦 build 完毕并且成功,远端将会自动出现一个新分支 `gh-pages` 用来存储构建的站点文件。 1. 推送任意一个 commit 到 `origin/master` 以触发 GitHub Actions workflow。一旦 build 完毕并且成功,远端将会自动出现一个新分支 `gh-pages` 用来存储构建的站点文件。
2. 回到 GitHub 上的仓库, 通过 _Settings__Options__GitHub Pages_ 选择分支 `gh-pages` 作为[_发布源_](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site): 2. 回到 GitHub 上的仓库, 通过 _Settings__Options__GitHub Pages_ 选择分支 `gh-pages` 作为[_发布源_](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site):
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png) ![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png)
3. 按照 GitHub 指示的地址去访问的网站。 3. 按照 GitHub 指示的地址去访问的网站。
#### 部署到其他 Pages 平台 #### 部署到其他 Pages 平台
@@ -209,11 +208,9 @@ $ docker run -it --rm \
:tada: 感谢所有参与代码贡献的小伙伴, 他们的 GayHub ID 在这个[列表](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors)。 另外, 提交过 issues(或者未被合并 PR) 的高富帅和白富美也不会被遗忘,他/她们帮助报告 bug、分享新点子或者启发了我写出更通俗易懂的文档。 :tada: 感谢所有参与代码贡献的小伙伴, 他们的 GayHub ID 在这个[列表](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors)。 另外, 提交过 issues(或者未被合并 PR) 的高富帅和白富美也不会被遗忘,他/她们帮助报告 bug、分享新点子或者启发了我写出更通俗易懂的文档。
还有,感谢 [JetBrains][JB] 提供开源 License 还有,感谢 [JetBrains][jb] 提供开源 License
[![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][JB] [![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][jb]
[JB]:https://www.jetbrains.com/?from=jekyll-theme-chirpy
## 赞助 ## 赞助
@@ -222,3 +219,8 @@ $ docker run -it --rm \
## 许可证书 ## 许可证书
本项目开源,基于 [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) 许可。 本项目开源,基于 [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) 许可。
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy

View File

@@ -12,7 +12,6 @@ const fs = require('fs');
const JS_ROOT = './assets/js'; const JS_ROOT = './assets/js';
const jsDest = `${ JS_ROOT }/dist/`; const jsDest = `${ JS_ROOT }/dist/`;
const copyrightPath = `${ JS_ROOT }/.copyright`;
function concatJs(files, output) { function concatJs(files, output) {
return src(files) return src(files)
@@ -23,7 +22,7 @@ function concatJs(files, output) {
function minifyJs() { function minifyJs() {
return src(`${ jsDest }/*.js`) return src(`${ jsDest }/*.js`)
.pipe(insert.prepend(fs.readFileSync(copyrightPath, 'utf8'))) .pipe(insert.prepend(fs.readFileSync(`${ JS_ROOT }/.copyright`, 'utf8')))
.pipe(uglify({output: {comments: /^!|@preserve|@license|@cc_on/i}})) .pipe(uglify({output: {comments: /^!|@preserve|@license|@cc_on/i}}))
.pipe(dest(jsDest)); .pipe(dest(jsDest));
} }

View File

@@ -2,18 +2,27 @@
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "jekyll-theme-chirpy" spec.name = "jekyll-theme-chirpy"
spec.version = "3.0.1" spec.version = "3.1.0"
spec.authors = ["Cotes Chung"] spec.authors = ["Cotes Chung"]
spec.email = ["cotes.chung@gmail.com"] spec.email = ["cotes.chung@gmail.com"]
spec.summary = "Chirpy is a minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation." spec.summary = "Chirpy is a minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation."
spec.homepage = "https://github.com/cotes2020/jekyll-theme-chirpy#readme" spec.homepage = "https://github.com/cotes2020/jekyll-theme-chirpy"
spec.license = "MIT" spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").select { |f| spec.files = `git ls-files -z`.split("\x0").select { |f|
f.match(%r!^((assets\/(css|img|js\/[a-z])|_(includes|layouts|sass|config|data|tabs|plugins))|README|LICENSE|index|feed|app|sw|404|robots)!i) f.match(%r!^((assets\/(css|img|js\/[a-z])|_(includes|layouts|sass|config|data|tabs|plugins))|README|LICENSE|index|feed|app|sw|404|robots)!i)
} }
spec.metadata = {
"bug_tracker_uri" => "https://github.com/cotes2020/jekyll-theme-chirpy/issues",
"documentation_uri" => "https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/README.md",
"homepage_uri" => "https://cotes2020.github.io/chirpy-demo",
"source_code_uri" => "https://github.com/cotes2020/jekyll-theme-chirpy",
"wiki_uri" => "https://github.com/cotes2020/jekyll-theme-chirpy/wiki",
"plugin_type" => "theme"
}
spec.add_runtime_dependency "jekyll", "~> 4.1" spec.add_runtime_dependency "jekyll", "~> 4.1"
spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1"
spec.add_runtime_dependency "jekyll-redirect-from", "~> 0.16" spec.add_runtime_dependency "jekyll-redirect-from", "~> 0.16"
@@ -21,6 +30,4 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "jekyll-archives", "~> 2.2" spec.add_runtime_dependency "jekyll-archives", "~> 2.2"
spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4" spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4"
spec.add_development_dependency "html-proofer", "~> 3.18"
end end

View File

@@ -1,6 +1,6 @@
{ {
"name": "jekyll-theme-chirpy", "name": "jekyll-theme-chirpy",
"version": "3.0.0", "version": "3.1.0",
"description": "A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation.", "description": "A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation.",
"main": "index.js", "main": "index.js",
"directories": { "directories": {

View File

@@ -1,12 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Bump latest version to # 1. Bump latest version number to files:
# - _sass/jekyll-theme-chirpy.scss # - _sass/jekyll-theme-chirpy.scss
# - assets/js/_commons/_copyright.js # - assets/js/.copyright.js
# - assets/js/dist/*.js # - assets/js/dist/*.js (will be built by gulp later)
# - jekyll-theme-chirpy.gemspec # - jekyll-theme-chirpy.gemspec
# - package.json
# #
# Required: gulp # 2. Create a git-tag
#
# 3. Build a rubygem package
#
# Requires: gulp, rubygem
set -eu set -eu
@@ -17,23 +22,58 @@ ASSETS=(
GEM_SPEC="jekyll-theme-chirpy.gemspec" GEM_SPEC="jekyll-theme-chirpy.gemspec"
bump_assets() { NODE_META="package.json"
_check_src() {
if [[ ! -f $1 && ! -d $1 ]]; then
echo -e "Error: Missing file \"$1\"!\n"
exit -1
fi
}
check() {
if [[ -n $(git status . -s) ]]; then
echo "Error: Commit unstaged files first, and then run this tool againt."
exit -1
fi
# ensure the current branch is 'master'
if [[ "$(git branch --show-current)" != "master" ]]; then
echo "Error: This operation must be performed on the 'master' branch!"
exit -1
fi
for i in "${!ASSETS[@]}"; do
_check_src "${ASSETS[$i]}"
done
_check_src "$NODE_META"
_check_src "$GEM_SPEC"
}
_bump_assets() {
_version="$1" _version="$1"
for i in ${!ASSETS[@]}; do for i in "${!ASSETS[@]}"; do
sed -i "s/v[[:digit:]]\.[[:digit:]]\.[[:digit:]]/v$_version/" ${ASSETS[$i]} sed -i "s/v[[:digit:]]\.[[:digit:]]\.[[:digit:]]/v$_version/" "${ASSETS[$i]}"
done done
gulp gulp
} }
bump_gemspec() { _bump_gemspec() {
_version="$1" sed -i "s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/$1/" "$GEM_SPEC"
sed -i "s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/$_version/" $GEM_SPEC }
_bump_node() {
sed -i \
"s,[\"]version[\"]: [\"][[:digit:]]\.[[:digit:]]\.[[:digit:]][\"],\"version\": \"$1\"," \
$NODE_META
} }
bump() { bump() {
bump_assets $1 _bump_assets "$1"
bump_gemspec $1 _bump_gemspec "$1"
_bump_node "$1"
if [[ -n $(git status . -s) ]]; then if [[ -n $(git status . -s) ]]; then
git add . git add .
@@ -41,13 +81,52 @@ bump() {
fi fi
} }
main() { build_gem() {
if [[ -n $(git status . -s) ]]; then rm -f ./*.gem
echo "Warning: commit unstaged files first, and then run this tool againt." gem build "$GEM_SPEC"
exit -1 }
release() {
_version="$1"
_major=""
_minor=""
IFS='.' read -r -a array <<< "$_version"
for elem in "${array[@]}"; do
if [[ -z $_major ]]; then
_major="$elem"
elif [[ -z $_minor ]]; then
_minor="$elem"
else
break
fi
done
_release_branch="$_major-$_minor-stable"
if [[ -z $(git branch -v | grep "$_release_branch") ]]; then
git checkout -b "$_release_branch"
else
git checkout "$_release_branch"
# cherry-pick the latest 2 commit from master to release branch
git cherry-pick "$(git rev-parse master~1)" "$(git rev-parse master)"
fi fi
_latest_tag="$(git describe --tags --abbrev=0)" echo -e "Create tag v$_version\n"
git tag "v$_version"
build_gem
# head back to master branch
git checkout master
}
main() {
check
_latest_tag="$(git describe --tags $(git rev-list --tags --max-count=1))"
echo "Input a version number (hint: latest version is ${_latest_tag:1})" echo "Input a version number (hint: latest version is ${_latest_tag:1})"
@@ -60,16 +139,16 @@ main() {
exit -1 exit -1
fi fi
echo "Bump version to $_version" echo -e "Bump version to $_version\n"
bump "$_version" bump "$_version"
echo "Create tag v$_version" echo -e "Release to v$_version\n"
git tag "v$_version" release "$_version"
else else
echo "Error: Illegal version number: '$_version'" echo "Error: Illegal version number: '$_version'"
fi fi
} }
main main

View File

@@ -16,7 +16,8 @@ init() {
fi fi
# Gemfile could be changed by `bundle install` in actions workflow # Gemfile could be changed by `bundle install` in actions workflow
if [[ -n $(git status Gemfile.lock --porcelain) ]]; then if [[ -n $(git ls-files | grep Gemfile.lock) && -n \
$(git status Gemfile.lock --porcelain) ]]; then
git checkout -- Gemfile.lock git checkout -- Gemfile.lock
fi fi

View File

@@ -1,20 +0,0 @@
#!/usr/bin/env bash
#
# Fetch Google Analytics Pageviews reporting cache
# and save as 'assets/data/pagevies.json'
#
# Requirement:
# - jq
# - wget
set -eu
WORK_DIR="$(dirname "$(dirname "$(realpath "$0")")")"
URL_FILE="${WORK_DIR}/_config.yml"
PV_CACHE="${WORK_DIR}/assets/js/data/pageviews.json"
PROXY_URL="$(grep "proxy_endpoint:" "$URL_FILE" | sed "s/.*: '//g;s/'.*//")"
wget "$PROXY_URL" -O "$PV_CACHE"
echo "ls $PV_CACHE"