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

Compare commits

..

73 Commits

Author SHA1 Message Date
Cotes Chung
d761d340a8 Bump version to 4.2.0 2021-09-16 01:40:38 +08:00
Cotes Chung
f411ba33d8 Fix code style 2021-09-16 01:19:40 +08:00
Cotes Chung
f722757f6f Update docs 2021-09-16 01:17:09 +08:00
Cotes Chung
beabb36d7f Add custom title to code block 2021-09-16 01:17:09 +08:00
Cotes Chung
42ff0f2282 Merge branch 'feature/improve-code-clipoard' into develop 2021-09-15 18:20:01 +08:00
Cotes Chung
34631a0c30 Update locale settings for code block clipboard (resolve #408) 2021-09-15 15:02:23 +08:00
Cotes Chung
53b0329e5a Improve the clipboard UX 2021-09-15 14:57:59 +08:00
Cotes Chung
2877896b9e Merge branch 'feature/improve-disqus' into develop 2021-09-14 20:47:01 +08:00
Cotes Chung
7ef88c8b8f Auto switch Disqus theme 2021-09-14 20:45:17 +08:00
Cotes Chung
2acf14ecf0 Replace Disqus lazy loading plugin with native JS 2021-09-14 20:45:17 +08:00
Cotes Chung
603705f20e Merge branch 'feature/beautify-scrollbar' into develop 2021-09-14 20:40:44 +08:00
Cotes Chung
0267ad8d40 Move sass variables 2021-09-14 20:40:16 +08:00
Cotes Chung
c0b8c089c2 Custom the scrollbar on Webkit browsers
the default scrollbar on Windows looks like shit
2021-09-14 16:47:11 +08:00
Cotes Chung
a603aac8e8 Merge branch 'feature/hide-lineno-of-code-block' into develop 2021-09-14 15:53:04 +08:00
Cotes Chung
91ed3d4649 Hide line number of some posts 2021-09-13 22:36:01 +08:00
Cotes Chung
20454e5a57 Add the feature of hiding line numbers 2021-09-13 22:26:17 +08:00
Cotes Chung
aadda0347c Merge branch 'feature/copy-snippet' (resolve #396, close #400) 2021-09-11 00:42:47 +08:00
Cotes Chung
5e9a7b319e Add clipboard JS 2021-09-11 00:30:21 +08:00
Cotes Chung
2537283beb Add clipboard button to code block 2021-09-11 00:30:21 +08:00
Cotes Chung
7dc7a7efc8 Add code block header 2021-09-11 00:30:21 +08:00
Cotes Chung
39b09b97c0 Merge branch 'feature/full-text-search' into develop 2021-09-04 21:24:37 +08:00
Cotes Chung
8d164c2e6e Enable full-text search (fix #401) 2021-09-04 21:23:43 +08:00
Cotes Chung
1a94b1889f Upgrade simple-jekyll-search from 1.7.3 to 1.10.0 2021-09-04 21:23:09 +08:00
Cotes Chung
6d07d4738b Remove margin between list items 2021-08-26 21:10:57 +08:00
Cotes Chung
6e0afcf9e8 Improve recognition of CJK 2021-08-26 01:26:16 +08:00
Cotes Chung
952927762a Run travis build only when tagging 2021-08-10 19:47:14 +08:00
Cotes Chung
3c3598e8b1 Reduce SASS compressed blank lines 2021-08-09 19:39:43 +08:00
Cotes Chung
9d9bca5e3b Improve the bump tool 2021-08-09 13:17:40 +08:00
Cotes Chung
03248f5bff Update comments for locales 2021-08-09 12:50:49 +08:00
Cotes Chung
e2c288a925 Add not results prompt in zh-CN 2021-08-09 12:49:59 +08:00
Maulana Kurniawan
b80d95dcdd Add Indonesian translation for search: no results. (#394)
Signed-off-by: maulanakurniawann <maulanakurniawan@outlook.co.id>
2021-08-09 12:46:23 +08:00
Cotes Chung
72ba1f7849 Fix tabs & improve topbar items 2021-08-03 22:55:35 +08:00
Hadian Alkani
46d80cbf9a Add Indonesian translation & locales (#390) 2021-08-03 16:58:12 +08:00
Cotes Chung
0213331a16 Improve the way to set the default value of locales 2021-08-01 22:04:11 +08:00
Cotes Chung
780af9ac5f Remove unused variable on HTML & JS 2021-08-01 21:49:44 +08:00
Cotes Chung
b513c0764d Update some locales value 2021-07-30 15:55:59 +08:00
Cotes Chung
57e8c6e594 Drop site config options content_lang & outdated 2021-07-30 15:55:59 +08:00
Cotes Chung
49dc866bd8 Fix docs 2021-07-22 01:30:26 +08:00
Cotes Chung
b7a483680e Bump version to 4.1.0 2021-07-22 00:51:20 +08:00
Cotes Chung
7ecb377c9b Update docs 2021-07-22 00:14:08 +08:00
Cotes Chung
a83e4c1b30 Optimize JS loading priority 2021-07-21 23:50:16 +08:00
Cotes Chung
0b29c0321f Add layout localization 2021-07-21 23:50:16 +08:00
Cotes Chung
2e76300d04 Revert "Delete useless SCSS snippets"
This reverts commit ab8cef9174.
2021-07-21 01:00:05 +08:00
Cotes Chung
20f2ff4b23 Update bot's reply message 2021-07-20 02:51:46 +08:00
Cotes Chung
899609a291 Switch to another issue bot 2021-07-20 02:26:03 +08:00
Cotes Chung
f56852a700 Fix breadcrumb for pagination 2021-07-20 02:08:28 +08:00
Cotes Chung
c969eaa040 Recover the missing image link identifier class 2021-07-20 02:08:28 +08:00
Cotes Chung
ab8cef9174 Delete useless SCSS snippets 2021-07-19 17:53:44 +08:00
Cotes Chung
b3ff6c79a6 Ignore the variables hook in the site file 2021-07-17 13:26:29 +08:00
Cotes Chung
7f8c19d480 Improve the code style on shell scripts
Double quote to prevent globbing and word splitting.
2021-07-11 17:26:49 +08:00
Cotes Chung
d52fa88337 Prevent the post date from shifting when loading 2021-07-11 17:04:13 +08:00
Cotes Chung
bea170cff0 Add fade in effect for lazy-loaded images 2021-07-11 15:05:18 +08:00
Cotes Chung
961ebb545b Set the dollar sign of code snippets to non-selectable 2021-07-08 21:19:33 +08:00
Cotes Chung
797450174d Dynamically detect the sass variables hook 2021-07-07 03:00:13 +08:00
FieryThunder
f0a2113a9f Fix typo of the issue template (#359) 2021-07-07 01:56:23 +08:00
Cotes Chung
c98a41317f Add a hook for custom variables (fix #355) 2021-07-04 23:24:30 +08:00
Cotes Chung
5f1e6e9350 Create the code language badge by Liquid
It prevents the language badges from flashing
2021-07-04 22:02:52 +08:00
Cotes Chung
65dbea9d3b Prevent image caption shifting
Before the image tag modified by JS, the caption will shift
2021-07-03 05:11:11 +08:00
Cotes Chung
fd97067ec3 Optimize the JS loading priorities 2021-07-03 05:11:11 +08:00
Cotes Chung
d5413a954f Update posts
- Set width and height for images
- Update the related tutorial
2021-07-03 05:11:11 +08:00
Cotes Chung
9359d6ef11 Ignore image links in html-proofer test 2021-07-02 17:14:40 +08:00
Cotes Chung
6d1d440c00 Preventing image reflow (fix #351) 2021-07-02 17:14:40 +08:00
Cotes Chung
08ec6cd3b5 Simplify the gitlab flow history 2021-06-24 21:30:05 +08:00
Cotes Chung
3ecb59deb1 Bump version to 4.0.2
(cherry picked from commit a6d4db251f)
2021-06-23 23:02:55 +08:00
Cotes Chung
885ed44646 Lock the ruby version number (#245, #247, #344)
Since version 3.0, Ruby has no `webrick` that Jekyll (<= 4.2) needs
2021-06-23 23:00:46 +08:00
Cotes Chung
d31e677ca0 Fix git-ignore list (#343) 2021-06-04 19:43:45 +08:00
blacksheep-git
bf3b539d6d Update 2019-08-08-text-and-typography.md
Fixed typo from 'Setction' to 'Section'.
2021-05-28 10:30:25 -06:00
Cotes Chung
ab927e9954 Improve sidebar cursor position calculation (fix #338) 2021-05-27 01:05:01 +08:00
Cotes Chung
d5e08b05ab Remove PR filter from workflow
GitHub does not allow to run workflows on PR from first-time contributors.
see: <https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks>
2021-05-19 13:50:19 +08:00
Cotes Chung
eb247b8886 Improve the paginator design for the mobile screens (#331) 2021-05-19 11:09:52 +08:00
Cotes Chung
4fa7c6af6e Bump version to 4.0.1
(cherry picked from commit b887c439c6)
2021-05-08 03:26:04 +08:00
Cotes Chung
2cce0be8af Add the missing files to the gem 2021-05-08 03:19:13 +08:00
Cotes Chung
cf7d8a45ba Bump version to 4.0.0
(cherry picked from commit db82f71515)
2021-04-30 14:10:24 +08:00
77 changed files with 1294 additions and 626 deletions

View File

@@ -16,4 +16,4 @@ labels: question
- [ ] My question is based on the latest code of `master` branch. - [ ] My question is based on the latest code of `master` branch.
## Description ## Description
<!-- Please describe your question in detial. --> <!-- Please describe your question in detail. -->

18
.github/workflows/issue-interceptor.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Intercept bad issues
on:
issues:
types: [opened, edited]
jobs:
auto_close_issues:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Auto close issues that did not follow template
uses: lucasbento/auto-close-issues@v1.0.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-close-message: ":wave: Hi @${issue.user.login},\n\nThis issue is being automatically closed because it does not follow the issue template. Please DO NOT open another similar issue, try to edit the current issue according to the template, then it will be reopened automatically."
closed-issues-label: "🙁 Not following issue template"

View File

@@ -1,20 +0,0 @@
name: "Intercept bad issue/PRs"
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
autoclose:
runs-on: ubuntu-latest
steps:
- name: Auto close issues/pr that did not follow template
uses: roots/issue-closer@v1.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-pattern: "(\\[x\\]|\\[X\\]) I have read"
issue-close-message: ":wave: Hi @${issue.user.login},\n\nThis issue is being automatically closed because it does not follow the issue template."
pr-pattern: "(\\[x\\]|\\[X\\]) (Bug fix|New feature|Breaking change|Documentation update)|@dependabot"
pr-close-message: ":wave: Hi @${pull_request.user.login},\n\nThis PR is being automatically closed because it does not follow the PR template."

5
.gitignore vendored
View File

@@ -1,6 +1,9 @@
# hidden files # hidden files
.* .*
!.github !.git*
!.editorconfig
!.nojekyll
!.travis.yml
# bundler cache # bundler cache
_site _site

View File

@@ -3,48 +3,39 @@ dist: bionic
language: minimal language: minimal
if: tag =~ /^v(\d)+(\.(\d)+){2}$/
jobs: jobs:
include: include:
- name: Deploy
- name: CD
language: ruby language: ruby
rvm: 2.7.0 rvm: 2.7.0
addons: addons:
apt: apt:
packages: packages:
# required to avoid SSL error (for htmlproofer) # required to avoid SSL error (for htmlproofer)
- libcurl4-openssl-dev - libcurl4-openssl-dev
cache: cache:
directories: directories:
- $TRAVIS_BUILD_DIR/vendor/bundle - $TRAVIS_BUILD_DIR/vendor/bundle
before_install: before_install:
# match the Gemfile.lock, travis' bundler is 2.1.2 # match the Gemfile.lock, travis' bundler is 2.1.2
- gem install bundler:2.2.4 - gem install bundler:2.2.4
- bundle config path 'vendor/bundle' - bundle config path 'vendor/bundle'
install: install:
# overriding to drop the travis `--development` flag # overriding to drop the travis `--development` flag
- bundle install --jobs=3 --retry=3 - bundle install --jobs=3 --retry=3
script: script:
- eval "$BUILD_CMD" - eval "$BUILD_CMD"
git: git:
depth: false # for posts' lastmod depth: false # for posts' lastmod
- name: Flush Starter - name: Flush Starter
script: script: eval "$FLUSH_STARTER"
- eval "$FLUSH_STARTER"
before_script: before_script:
- git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q - git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
branches:
only: /.*-stable$/
notifications: notifications:
email: email:
recipients: recipients:

View File

@@ -1,47 +1,70 @@
# Chirpy <div align="right">
<a href="https://github.com/cotes2020/jekyll-theme-chirpy#readme">EN</a> |
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md">中文 (简体)</a>
</div>
Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md) <div align="center">
<h1>Chirpy Jekyll Theme</h1>
<p>
<a href="https://rubygems.org/gems/jekyll-theme-chirpy">
<img alt="Gem Version" src="https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen"></img>
</a>
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush">
<img alt="Build Status" src="https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push"></img>
</a>
<a href="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">
<img alt="Codacy Badge" src="https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b"></img>
</a>
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE">
<img alt="GitHub license" src="https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg"></img>
</a>
<a href="https://996.icu">
<img alt="996.icu" src="https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg"></img>
</a>
</p>
</div>
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy) A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation. Designed to help you easily record and share your knowledge.
[![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)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
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) [Live Demo »](https://chirpy.cotes.info)
[![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info) <p align="center">
<a href="https://chirpy.cotes.info">
<img alt="Devices Mockup" src="https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png"></img>
</a>
</p>
## Features ## Features
- Localized Layout
- Configurable Theme Mode
- Pinned Posts - Pinned Posts
- Configurable theme mode - Hierarchical Categories
- Double-level Categories - Last Modified Date for Posts
- Last modified date for posts
- Table of Contents - Table of Contents
- Automatically recommend related posts - Automatically Recommend Related Posts
- Syntax highlighting - Syntax Highlighting
- Mathematical expressions - Mathematical Expressions
- Mermaid diagram & flowchart - Mermaid Diagram & Flowchart
- Search - Search
- Atom Feeds - Atom Feeds
- Disqus Comments - Disqus Comments
- Google Analytics - Google Analytics
- GA Pageviews reporting (Advanced) - GA Pageviews Reporting (Advanced)
- SEO and Performance Optimization - SEO & 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`. Please note that the version of `Ruby` must meet the requirements of the theme on [RubyGems.org](https://rubygems.org/gems/jekyll-theme-chirpy).
## Installation ## Installation
There are two ways to get the theme: There are two ways to get the theme:
- **Install from RubyGems** - Easy to update, isolate irrelevant project files so you can focus on writing. - **[Install from RubyGems](#install-from-rubygems)** - Easy to update, isolate irrelevant project files so you can focus on writing.
- **Fork on GitHub** - Convenient for custom development, but difficult to update, only suitable for web developers. - **[Fork on GitHub](#fork-on-github)** - Convenient for custom development, but difficult to update, only suitable for web developers.
### Installing the Theme Gem ### Install from RubyGems
Add this line to your Jekyll site's `Gemfile`: Add this line to your Jekyll site's `Gemfile`:
@@ -61,15 +84,19 @@ And then execute:
$ bundle $ bundle
``` ```
Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site. Next, go to the installed local theme path:
> **Hint**: To locate the installed themes gem, execute: ```console
$ cd "$(bundle info --path jekyll-theme-chirpy)"
```
And then copy the critical files (for details, see [starter project][starter]) from the theme's gem to your Jekyll site.
> ⚠️ **Watch out for duplicate files!**
> >
> ```console > If your Jekyll site is created by the `jekyll new` command, there will be `index.markdown` and `about.markdown` in the root directory of your site. Please be sure to remove them, otherwise they will overwrite the `index.html` and `_tabs/about.html` from this project, resulting in blank or messy pages.
> $ bundle info --path jekyll-theme-chirpy
> ```
Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from the theme's gem. We have prepared everything for you there! As an alternative, which we recommend, you can create a Jekyll site [**using the starter template**][use-starter] to save time copying files from the theme's gem. We've prepared everything you need there!
### Fork on GitHub ### Fork on GitHub
@@ -111,6 +138,12 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
- `timezone` - `timezone`
- `lang` - `lang`
### Customing Stylesheet
If you need to customize stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file.
Starting from `v4.1.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it.
### Running Local Server ### Running Local Server
You may want to preview the site contents before publishing, so just run it by: You may want to preview the site contents before publishing, so just run it by:
@@ -181,7 +214,7 @@ Unless you specified the output path, the generated site files will be placed in
## Documentation ## Documentation
For more details and a better reading experience, please check out the [tutorials on the demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). For more details and a better reading experience, please check out the [tutorials on the demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Please note that the tutorials on the demo website or Wiki are based on the latest release, and the features of `master` branch usually ahead of the documentation.
## Contributing ## Contributing

View File

@@ -7,14 +7,17 @@ theme: jekyll-theme-chirpy
# change below value to '/projectname'. # change below value to '/projectname'.
baseurl: '' baseurl: ''
# the HTML language tag https://www.w3.org/International/questions/qa-choosing-language-tags # The language of the webpage http://www.lingoes.net/en/translator/langcode.htm
lang: en-US # If it has the same name as one of the files in folder `_data/locales`, the layout language will also be changed,
# otherwise, the layout language will use the default value of 'en'.
lang: en
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone # Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai timezone: Asia/Shanghai
# 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
tagline: A text-focused Jekyll theme # it will display as the sub-title tagline: A text-focused Jekyll theme # it will display as the sub-title
@@ -47,7 +50,9 @@ social:
# - https://www.linkedin.com/in/username # - https://www.linkedin.com/in/username
google_site_verification: google_meta_tag_verification # change to your verification string google_site_verification: google_meta_tag_verification # change to your verification string
# --------------------------
# ↑ --------------------------
google_analytics: google_analytics:
id: '' # fill in your Google Analytics ID id: '' # fill in your Google Analytics ID

View File

@@ -1,7 +0,0 @@
# The date format
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
post:
long: "%b %e, %Y"
short: "%b %e"

View File

@@ -1,19 +0,0 @@
# The label text of site.
panel:
lastmod: Recent Update
trending_tags: Trending Tags
toc: Contents
post:
relate_posts: Further Reading
share: Share
button:
next: Newer
previous: Older
search_hint: Search # text show on search bar
pin_prompt: Pinned # pinned prompt
read_time_unit: min # see posts' time to read

86
_data/locales/en.yml Normal file
View File

@@ -0,0 +1,86 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Post
category: Category
tag: Tag
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Home
categories: Categories
tags: Tags
archives: Archives
about: About
# the text displayed in the search bar & search results
search:
hint: search
cancel: Cancel
no_results: Oops! No result founds.
panel:
lastmod: Recent Update
trending_tags: Trending Tags
toc: Contents
# The liquid date format http://strftime.net/
date_format:
tooltip: '%a, %b %e, %Y, %l:%M %p %z'
post:
long: '%b %e, %Y'
short: '%b %e'
archive_month: '%b'
copyright:
# Shown at the bottom of the post
license:
template: This post is licensed under :LICENSE_NAME by the author.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Some rights reserved.
verbose: >-
Except where otherwise noted, the blog posts on this site are licensed
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
hint_template: :HEAD_BAK to try finding it again, or search for it on the :ARCHIVES_PAGE.
head_back: Head back Home
archives_page: Archives page
# ----- Posts related labels -----
post:
published: 'on'
updated: Updated
timeago:
day: days ago
hour: hours ago
minute: minutes ago
just_now: just now
words: words
pageview_measure: views
read_time:
unit: min
prompt: read
relate_posts: Further Reading
share: Share
button:
next: Newer
previous: Older
copy: Copied!
# pinned prompt of posts list on homepage
pin_prompt: Pinned
# categories page
categories:
category_measure: categories
post_measure: posts

86
_data/locales/id-ID.yml Normal file
View File

@@ -0,0 +1,86 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Postingan
category: Kategori
tag: Tagar
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Beranda
categories: Kategori
tags: Tagar
archives: Arsip
about: Tentang
# the text displayed in the search bar & search results
search:
hint: Cari
cancel: Batal
no_results: Ups! Tidak ada hasil yang ditemukan.
panel:
lastmod: Postingan Terbaru
trending_tags: Tagar Terpopuler
toc: Konten
# The liquid date format http://strftime.net/
date_format:
tooltip: "%a, %e %b, %Y, %l:%M %p"
post:
long: "%e %b, %Y"
short: "%e %b"
archive_month: "%b"
copyright:
# Shown at the bottom of the post
license:
template: Postingan ini dilisensikan di bawah :LICENSE_NAME oleh penulis.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Sebagian konten dilindungi.
verbose: >-
Kecuali jika dinyatakan, Postingan blog di situs ini dilisensikan
di bawah Lisensi Creative Commons Attribution 4.0 International (CC BY 4.0) oleh penulis.
meta: Didukung oleh :PLATFORM dengan tema :THEME.
not_found:
statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada.
hint_template: :HEAD_BAK untuk mencoba mencari kembali, atau cari di :ARCHIVES_PAGE.
head_back: Kembali ke Beranda
archives_page: Halaman Arsip
# ----- Posts related labels -----
post:
published: "pada"
updated: Diperbarui
timeago:
day: hari yang lalu
hour: jam yang lalu
minute: menit yang lalu
just_now: baru saja
words: kata
pageview_measure: dilihat
read_time:
unit: menit
prompt: baca
relate_posts: Postingan Lainya
share: Bagikan
button:
next: Terbaru
previous: Terlama
copy: Disalin!
# pinned prompt of posts list on homepage
pin_prompt: Disematkan
# categories page
categories:
category_measure: kategori
post_measure: Postingan

85
_data/locales/zh-CN.yml Normal file
View File

@@ -0,0 +1,85 @@
# The layout text of site
# ----- Commons label -----
layout:
post: 文章
category: 分类
tag: 标签
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: 首页
categories: 分类
tags: 标签
archives: 归档
about: 关于
# the text displayed in the search bar & search results
search:
hint: 搜索
cancel: 取消
no_results: 搜索结果为空
panel:
lastmod: 最近更新
trending_tags: 热门标签
toc: 文章内容
# The liquid date format http://strftime.net/
date_format:
tooltip: '%F, %R %z'
post:
long: '%F'
short: '%m-%d'
archive_month: '%m月'
copyright:
# Shown at the bottom of the post
license:
template: 本文由作者按照 :LICENSE_NAME 进行授权
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: 保留部分权利。
verbose: >-
除非另有说明,本网站上的博客文章均由作者按照知识共享署名 4.0 国际 (CC BY 4.0) 许可协议进行授权。
meta: 本站由 :PLATFORM 生成,采用 :THEME 主题。
not_found:
statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。
hint_template: :HEAD_BAK尝试再次查找它或在:ARCHIVES_PAGE上搜索它。
head_back: 返回主页
archives_page: 归档页面
# ----- Posts related labels -----
post:
published: 发表于
updated: 更新于
timeago:
day: 天前
hour: 小时前
minute: 分钟前
just_now: 刚刚
words:
pageview_measure: 次浏览
read_time:
unit: 分钟
prompt: 阅读
relate_posts: 相关文章
share: 分享
button:
next: 下一篇
previous: 上一篇
copy: 已复制!
# pinned prompt of posts list on homepage
pin_prompt: 顶置
# categories page
categories:
category_measure: 个分类
post_measure: 篇文章

View File

@@ -1,11 +0,0 @@
# License data
license:
name: CC BY 4.0
link: "https://creativecommons.org/licenses/by/4.0/"
brief: Some rights reserved.
verbose: >-
Except where otherwise noted, the blog posts on this site are licensed
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.

View File

@@ -1,25 +1,54 @@
<!-- <!--
The Disqus lazy loading. The Disqus lazy loading.
Powered by: <https://github.com/osvaldasvalutis/disqusLoader.js>
--> -->
<div id="disqus" class="pt-2 pb-2"> <div id="disqus_thread" class="pt-2 pb-2">
<p class="text-center text-muted small pb-5"> <p class="text-center text-muted small mb-5">
Comments powered by <a href="https://disqus.com/">Disqus</a>. Comments powered by <a href="https://disqus.com/">Disqus</a>.
</p> </p>
</div> </div>
<script src="{{ '/assets/js/lib/jquery.disqusloader.min.js' | relative_url }}"></script> <script type="text/javascript">
<script> var disqus_config = function () {
const options = { this.page.url = '{{ page.url | absolute_url }}';
scriptUrl: '//{{ site.disqus.shortname }}.disqus.com/embed.js', this.page.identifier = '{{ page.url }}';
disqusConfig: function() {
this.page.title = '{{ page.title }}';
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url }}';
}
}; };
$.disqusLoader('#disqus', options); /* Lazy loading */
var disqus_observer = new IntersectionObserver(function (entries) {
if(entries[0].isIntersecting) {
(function () {
var d = document, s = d.createElement('script');
s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
disqus_observer.disconnect();
}
}, { threshold: [0] });
disqus_observer.observe(document.querySelector('#disqus_thread'));
/* Auto switch theme */
function reloadDisqus() {
/* Disqus hasn't been loaded */
if (typeof DISQUS === "undefined") {
return;
}
if (document.readyState == 'complete') {
DISQUS.reset({ reload: true, config: disqus_config });
}
}
const modeToggle = document.querySelector(".mode-toggle");
if (modeToggle !== null) {
modeToggle.addEventListener('click', reloadDisqus);
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', reloadDisqus);
}
</script> </script>

View File

@@ -8,21 +8,28 @@
<p class="mb-0"> <p class="mb-0">
© {{ 'now' | date: "%Y" }} © {{ 'now' | date: "%Y" }}
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>. <a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
{% if site.data.rights.brief %} {% if site.data.locales[lang].copyright.brief %}
<span data-toggle="tooltip" data-placement="top" <span data-toggle="tooltip" data-placement="top"
title="{{ site.data.rights.verbose }}">{{ site.data.rights.brief }}</span> title="{{ site.data.locales[lang].copyright.verbose }}">{{ site.data.locales[lang].copyright.brief }}</span>
{% endif %} {% endif %}
</p> </p>
</div> </div>
<div class="footer-right"> <div class="footer-right">
<p class="mb-0"> <p class="mb-0">
Powered by {% capture _platform %}
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a> <a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
with {% endcapture %}
<a href="https://github.com/cotes2020/jekyll-theme-chirpy"
target="_blank" rel="noopener">Chirpy</a> {% capture _theme %}
theme. <a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
{% endcapture %}
{{ site.data.locales[lang].meta
| default: 'Powered by :PLATFORM with :THEME theme.'
| replace: ':PLATFORM', _platform | replace: ':THEME', _theme
}}
</p> </p>
</div> </div>

View File

@@ -8,6 +8,12 @@
{% if page.layout == 'home' or page.layout == 'post' %} {% if page.layout == 'home' or page.layout == 'post' %}
<!-- i18n for `_javascript/utils/timeago.js` -->
<meta name="day-prompt" content="{{ site.data.locales[lang].post.timeago.day }}">
<meta name="hour-prompt" content="{{ site.data.locales[lang].post.timeago.hour }}">
<meta name="minute-prompt" content="{{ site.data.locales[lang].post.timeago.minute }}">
<meta name="justnow-prompt" content="{{ site.data.locales[lang].post.timeago.just_now }}">
{% if site.google_analytics.pv.proxy_endpoint %} {% if site.google_analytics.pv.proxy_endpoint %}
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}"> <meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
{% endif %} {% endif %}
@@ -62,13 +68,8 @@
{% include css-selector.html %} {% include css-selector.html %}
<!-- JavaScripts --> <!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
<script defer
src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4/dist/js/bootstrap.min.js"></script>
{% include js-selector.html %}
</head> </head>

View File

@@ -2,18 +2,19 @@
JS selector for site. JS selector for site.
--> -->
<!-- layout specified -->
{% if page.layout == 'home' or page.layout == 'post' %} {% if page.layout == 'home' or page.layout == 'post' %}
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<!-- pv-report needs countup.js --> <!-- pv-report needs countup.js -->
<script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script> <script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>
<script async src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script> <script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if page.layout == 'post' or page.layout == 'page' %} {% if page.layout == 'post' or page.layout == 'page' %}
<!-- image lazy-loading & popup --> <!-- image lazy-loading & popup -->
<script async <script src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js,npm/clipboard@2/dist/clipboard.min.js"></script>
src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js"></script>
{% endif %} {% endif %}
{% if page.layout == 'home' {% if page.layout == 'home'
@@ -51,6 +52,10 @@
</script> </script>
{% endif %} {% endif %}
<!-- commons -->
<script src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.16.1,npm/bootstrap@4/dist/js/bootstrap.min.js"></script>
{% if jekyll.environment == 'production' %} {% if jekyll.environment == 'production' %}
<!-- PWA --> <!-- PWA -->
<script defer src="{{ '/app.js' | relative_url }}"></script> <script defer src="{{ '/app.js' | relative_url }}"></script>

8
_includes/lang.html Normal file
View File

@@ -0,0 +1,8 @@
{% comment %}
Detect appearance language and return it through variable "lang"
{% endcomment %}
{% if site.data.locales[site.lang] %}
{% assign lang = site.lang %}
{% else %}
{% assign lang = 'en' %}
{% endif %}

View File

@@ -0,0 +1,13 @@
{% comment %}
Remove the zero padding from a month/day string
{% endcomment %}
{% assign ret = include.date_str %}
{% assign _first_chat = ret | slice: 0 %}
{% if _first_chat == '0' %}
{% assign _last_idx = ret.size | minus: 1 %}
{% assign ret = ret | slice: 1, _last_idx %}
{% endif %}
{{ ret | replace: ' 0', ' ' }}

View File

@@ -2,6 +2,8 @@
The Pannel on right side (Desktop views) The Pannel on right side (Desktop views)
--> -->
{% include lang.html %}
<div id="panel-wrapper" class="col-xl-3 pl-2 text-muted topbar-down"> <div id="panel-wrapper" class="col-xl-3 pl-2 text-muted topbar-down">
<div class="access"> <div class="access">
@@ -11,7 +13,7 @@
{% if update_list.size > 0 %} {% if update_list.size > 0 %}
<div id="access-lastmod" class="post"> <div id="access-lastmod" class="post">
<span>{{- site.data.label.panel.lastmod | default: 'Recent Update' -}}</span> <span>{{- site.data.locales[lang].panel.lastmod -}}</span>
<ul class="post-content pl-0 pb-1 ml-1 mt-2"> <ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %} {% for item in update_list %}
@@ -30,7 +32,7 @@
{% if trending_tags.size > 0 %} {% if trending_tags.size > 0 %}
<div id="access-tags"> <div id="access-tags">
<span>{{- site.data.label.panel.trending_tags | default: 'Trending Tags' -}}</span> <span>{{- site.data.locales[lang].panel.trending_tags -}}</span>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3"> <div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% for tag_name in trending_tags %} {% for tag_name in trending_tags %}
@@ -48,7 +50,7 @@
<script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script>
<div id="toc-wrapper" class="pl-0 pr-4 mb-5"> <div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<span class="pl-3 pt-2 mb-2"> <span class="pl-3 pt-2 mb-2">
{{- site.data.label.panel.toc | default: 'Contents' -}} {{- site.data.locales[lang].panel.toc -}}
</span> </span>
<nav id="toc" data-toggle="toc"></nav> <nav id="toc" data-toggle="toc"></nav>
</div> </div>

View File

@@ -5,24 +5,24 @@
<div class="post-navigation d-flex justify-content-between"> <div class="post-navigation d-flex justify-content-between">
{% if page.previous.url %} {% if page.previous.url %}
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary" <a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}"> prompt="{{ site.data.locales[lang].post.button.previous }}">
<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' }}"> prompt="{{ site.data.locales[lang].post.button.previous }}">
<p>-</p> <p>-</p>
</span> </span>
{% endif %} {% endif %}
{% if page.next.url %} {% if page.next.url %}
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary" <a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
prompt="{{ site.data.label.post.button.next | default: 'next' }}"> prompt="{{ site.data.locales[lang].post.button.next }}">
<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' }}"> prompt="{{ site.data.locales[lang].post.button.next }}">
<p>-</p> <p>-</p>
</span> </span>
{% endif %} {% endif %}

View File

@@ -2,13 +2,14 @@
The paginator for post list on HomgPage. The paginator for post list on HomgPage.
--> -->
<ul class="pagination mt-4 mb-0 pl-lg-2"> <ul class="pagination align-items-center mt-4 mb-0 pl-lg-2">
<!-- left arrow --> <!-- left arrow -->
{% if paginator.previous_page %} {% if paginator.previous_page %}
{% assign prev_url = paginator.previous_page_path | relative_url %} {% assign prev_url = paginator.previous_page_path | relative_url %}
{% else %} {% else %}
{% assign prev_url = "#" %} {% assign prev_url = "#" %}
{% endif %} {% endif %}
<li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}"> <li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
<a class="page-link btn-box-shadow" href="{{ prev_url }}" aria-label="previous-page"> <a class="page-link btn-box-shadow" href="{{ prev_url }}" aria-label="previous-page">
<i class="fas fa-angle-left"></i> <i class="fas fa-angle-left"></i>
@@ -65,12 +66,19 @@
{% endfor %} {% endfor %}
<!-- mobile pagination -->
<li class="page-index align-middle">
<span>{{ paginator.page }}</span>
<span class="text-muted">/ {{ paginator.total_pages }}</span>
</li>
<!-- right arrow --> <!-- right arrow -->
{% if paginator.next_page_path %} {% if paginator.next_page_path %}
{% assign next_url = paginator.next_page_path | relative_url %} {% assign next_url = paginator.next_page_path | relative_url %}
{% else %} {% else %}
{% assign next_url = "#" %} {% assign next_url = "#" %}
{% endif %} {% endif %}
<li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}"> <li class="page-item {% unless paginator.next_page_path %}disabled{% endunless %}">
<a class="page-link btn-box-shadow" href="{{ next_url }}" aria-label="next-page"> <a class="page-link btn-box-shadow" href="{{ next_url }}" aria-label="next-page">
<i class="fas fa-angle-right"></i> <i class="fas fa-angle-right"></i>

View File

@@ -3,7 +3,7 @@
--> -->
<div class="share-wrapper"> <div class="share-wrapper">
<span class="share-label text-muted mr-1">{{ site.data.label.post.share | default: 'Share' }}</span> <span class="share-label text-muted mr-1">{{ site.data.locales[lang].post.share }}</span>
<span class="share-icons"> <span class="share-icons">
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %} {% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
{% assign url = page.url | absolute_url %} {% assign url = page.url | absolute_url %}
@@ -16,8 +16,10 @@
</a> </a>
{% endfor %} {% endfor %}
<i class="fa-fw fas fa-link small" onclick="copyLink()" <i class="fa-fw fas fa-link small" onclick="copyLink('', '{{ site.data.locales[lang].post.button.copy.succeed }}')"
data-toggle="tooltip" data-placement="top" title="Copy link"></i> data-toggle="tooltip" data-placement="top"
title="{{ site.data.locales[lang].post.button.copy.title }}">
</i>
</span> </span>
</div> </div>

View File

@@ -1,9 +1,11 @@
<!-- <!--
Calculate the post's reading time, and display the word count in tooltip Calculate the post's reading time, and display the word count in tooltip
--> -->
{% assign words = include.content | strip_html | number_of_words: "auto" %} {% assign words = include.content | strip_html | number_of_words: "auto" %}
<!-- words per minute --> <!-- words per minute -->
{% assign wpm = 180 %} {% assign wpm = 180 %}
{% assign min_time = 1 %} {% assign min_time = 1 %}
@@ -13,7 +15,16 @@
{% assign read_time = min_time %} {% assign read_time = min_time %}
{% endunless %} {% endunless %}
{% capture read_prompt %}
{{- site.data.locales[lang].post.read_time.prompt -}}
{% endcapture %}
<!-- return element --> <!-- return element -->
<span class="readtime" data-toggle="tooltip" data-placement="bottom" title="{{ words }} words"> <span class="readtime" data-toggle="tooltip" data-placement="bottom"
{{- read_time -}}{{" "}}{{- site.data.label.read_time_unit | default: "min" -}} title="{{ words }} {{ site.data.locales[lang].post.words }}">
{{- read_time -}}{{" "}}{{- site.data.locales[lang].post.read_time.unit -}}
{%- if include.prompt -%}
{% assign _prompt_words = read_prompt | number_of_words: 'auto' %}
{% unless _prompt_words > 1 %}{{" "}}{% endunless %}{{ read_prompt }}
{%- endif -%}
</span> </span>

View File

@@ -8,6 +8,7 @@
In order to allow a wide table to scroll horizontally, In order to allow a wide table to scroll horizontally,
we suround the markdown table with `<div class="table-wrapper">` and `</div>` we suround the markdown table with `<div class="table-wrapper">` and `</div>`
--> -->
{% if _content contains '<table>' %} {% if _content contains '<table>' %}
{% assign _content = _content {% assign _content = _content
| replace: '<table>', '<div class="table-wrapper"><table>' | replace: '<table>', '<div class="table-wrapper"><table>'
@@ -21,6 +22,7 @@
https://github.com/penibelst/jekyll-compress-html/issues/101 https://github.com/penibelst/jekyll-compress-html/issues/101
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901 https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
--> -->
{% if _content contains '<pre class="highlight">' %} {% if _content contains '<pre class="highlight">' %}
{% assign _content = _content {% assign _content = _content
| replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code' | replace: '<div class="highlight"><pre class="highlight"><code', '<div class="highlight"><code'
@@ -29,14 +31,20 @@
{% endif %} {% endif %}
<!-- Add attribute 'hide-bullet' to the checkbox list --> <!-- Add attribute 'hide-bullet' to the checkbox list -->
{% if _content contains '<li class="task-list-item"><' %} {% if _content contains '<li class="task-list-item"><' %}
{% assign _content = _content {% assign _content = _content
| replace: '"task-list-item"><', '"task-list-item" hide-bullet><' | replace: '"task-list-item"><', '"task-list-item" hide-bullet><'
%} %}
{% endif %} {% endif %}
<!-- images -->
{% if _content contains '<img src="' %} {% if _content contains '<img src="' %}
<!-- add CDN prefix if it exists -->
{% if site.img_cdn != '' %} {% if site.img_cdn != '' %}
{% assign img_path_replacement = '<img src="' | append: site.img_cdn | append: '/' %} {% assign img_path_replacement = '<img src="' | append: site.img_cdn | append: '/' %}
{% else %} {% else %}
@@ -46,16 +54,93 @@
{% assign _content = _content | replace: '<img src="/', img_path_replacement %} {% assign _content = _content | replace: '<img src="/', img_path_replacement %}
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> --> <!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
{% assign img_placehodler
= 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' %}
{% assign lozad_replacement = '<img src="' {% assign _content = _content | replace: '<img src="', '<img data-proofer-ignore data-src="' %}
| append: img_placehodler
| append: '" data-src="' %}
{% assign _content = _content | replace: '<img src="', lozad_replacement %} <!-- add image placehoder to prevent layout reflow -->
{% assign _img_content = nil %}
{% assign _images = _content | split: '<img ' %}
{% for _img in _images %}
{% if forloop.first %}
{% assign _img_content = _img %}
{% continue %}
{% endif %}
{% assign _width = nil %}
{% assign _height = nil %}
{% assign _attrs = _img | split: '>' | first | split: ' ' %}
{% for _attr in _attrs %}
{% capture _key %}{{ _attr | split: '=' | first }}{% endcapture %}
{% capture _value %}{{ _attr | split: '=' | last | replace: '"', '' }}{% endcapture %}
{% case _key %}
{% when 'width' %}
{% assign _width = _value %}
{% when 'height' %}
{% assign _height = _value %}
{% endcase %}
{% if _width and _height %}
{% capture _svg %}data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{_width}} {{_height}}'%3E%3C/svg%3E{% endcapture %}
{% assign _img_content = _img_content | append: '<img src="' | append: _svg | append: '" ' | append: _img %}
{% break %}
{% endif %}
{% endfor %}
{% unless _width and _height %}
{% assign _img_content = _img_content | append: '<img ' | append: _img %}
{% endunless %}
{% endfor %}
{% assign _content = _img_content %}
{% endif %} {% endif %}
<!-- Add header for code snippets -->
{% if _content contains '<div class="highlight"><code>' %}
{% assign _code_spippets = _content | split: '<div class="highlight"><code>' %}
{% assign _new_content = '' %}
{% for _snippet in _code_spippets %}
{% if forloop.last %}
{% assign _new_content = _new_content | append: _snippet %}
{% else %}
{% assign _left = _snippet | split: '><' | last%}
{% if _left contains 'file="' %}
{% assign _text = _left | split: 'file="' | last | split: '"' | first %}
{% else %}
{% assign _text = _left | split: 'language-' | last | split: ' ' | first %}
{% endif %}
{% assign _new_content = _new_content | append: _snippet
| append: '<div class="code-header" text-data="'
| append: _text
| append: '"><button data-original-title="'
| append: site.data.locales[lang].post.button.copy
| append: '"><i class="far fa-clone"></i></button></div>'
| append: '<div class="highlight"><code>'
%}
{% endif %}
{% endfor %}
{% assign _content = _new_content %}
{% endif %}
<!-- return --> <!-- return -->
{{ _content }} {{ _content }}

View File

@@ -81,7 +81,7 @@
{% if index_list.size > 0 %} {% if index_list.size > 0 %}
<div id="related-posts" class="mt-5 mb-2 mb-sm-4"> <div id="related-posts" class="mt-5 mb-2 mb-sm-4">
<h3 class="pt-2 mt-1 mb-4 ml-1" <h3 class="pt-2 mt-1 mb-4 ml-1"
data-toc-skip>{{ site.data.label.post.relate_posts | default: 'Further Reading' }}</h3> data-toc-skip>{{ site.data.locales[lang].post.relate_posts }}</h3>
<div class="card-deck mb-4"> <div class="card-deck mb-4">
{% for entry in index_list %} {% for entry in index_list %}
{% assign index = entry | plus: 0 %} {% assign index = entry | plus: 0 %}

View File

@@ -14,9 +14,9 @@
</div> </div>
{% endcapture %} {% endcapture %}
{% capture not_found %}<p class="mt-5">Oops! No result founds.</p>{% endcapture %} {% capture not_found %}<p class="mt-5">{{ site.data.locales[lang].search.no_results }}</p>{% endcapture %}
<script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.7.3/dest/simple-jekyll-search.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js"></script>
<script> <script>
SimpleJekyllSearch({ SimpleJekyllSearch({

View File

@@ -4,7 +4,7 @@
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded"> <div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
<div class="col-12 col-sm-11 post-content"> <div class="col-12 col-sm-11 post-content">
<div id="search-hints"> <div id="search-hints">
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags | default: 'Trending Tags' }}</h4> <h4 class="text-muted mb-4">{{ site.data.locales[lang].panel.trending_tags }}</h4>
{% include trending-tags.html %} {% include trending-tags.html %}

View File

@@ -2,8 +2,7 @@
The Side Bar The Side Bar
--> -->
<div id="sidebar" class="d-flex flex-column align-items-end"> <div id="sidebar" class="d-flex flex-column align-items-end" lang="{{lang}}">
<div class="profile-wrapper text-center"> <div class="profile-wrapper text-center">
<div id="avatar"> <div id="avatar">
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto"> <a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto">
@@ -21,19 +20,19 @@
</div> </div>
<div class="site-title mt-3"> <div class="site-title mt-3">
<a href="{{ '/' | relative_url }}">{{- site.title -}}</a> <a href="{{ '/' | relative_url }}">{{ site.title }}</a>
</div> </div>
<div class="site-subtitle font-italic">{{ site.tagline }}</div>
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
</div><!-- .profile-wrapper --> </div><!-- .profile-wrapper -->
<ul class="w-100"> <ul class="w-100">
<!-- home --> <!-- home -->
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}"> <li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
<a href="{{ '/' | relative_url }}" class="nav-link"> <a href="{{ '/' | relative_url }}" class="nav-link">
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i> <i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
<span>{{ "HOME" }}</span> <span>{{ site.data.locales[lang].tabs.home | upcase }}</span>
</a> </a>
</li> </li>
<!-- the real tabs --> <!-- the real tabs -->
@@ -41,7 +40,9 @@
<li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}"> <li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
<a href="{{ tab.url | relative_url }}" class="nav-link"> <a href="{{ tab.url | relative_url }}" class="nav-link">
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i> <i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
<span>{{ tab.title | upcase }}</span> {% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
<span>{{ site.data.locales[lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
</a> </a>
</li> <!-- .nav-item --> </li> <!-- .nav-item -->
{% endfor %} {% endfor %}

View File

@@ -3,29 +3,25 @@
See: /assets/js/_utils/timeage.js See: /assets/js/_utils/timeage.js
--> -->
{% assign tooltip_df = site.data.date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %} {% assign tooltip_df = site.data.locales[lang].date_format.tooltip %}
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %} {% assign post_long_df = site.data.locales[lang].date_format.post.long %}
{% assign post_short_df = site.data.date_format.post.short | default: '%b %e' %} {% assign post_short_df = site.data.locales[lang].date_format.post.short %}
{% if include.preposition %}
{{ include.preposition }}
{% endif %}
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}" <span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
{% if include.tooltip %} {% if include.tooltip %}
data-toggle="tooltip" data-toggle="tooltip"
data-placement="bottom" data-placement="bottom"
title="{{ include.date | date: tooltip_df }}" title="{{ include.date | date: tooltip_df }}"
{% endif %} {% endif %}>
{%- assign this_year = site.time | date: "%Y" -%}
{% if include.prefix %}prefix="{{ include.prefix }} "{% endif%} {%- assign post_year = include.date | date: "%Y" -%}
{% if include.prep %}prep="{{ include.prep }}"{% endif %} > {%- if post_year == this_year -%}
{% assign this_year = site.time | date: "%Y" %}
{% assign post_year = include.date | date: "%Y" %}
{% if post_year == this_year %}
{{ include.date | date: post_short_df }} {{ include.date | date: post_short_df }}
{% else %} {%- else -%}
{{ include.date | date: post_long_df }} {{ include.date | date: post_long_df }}
{% endif %} {%- endif -%}
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i> <i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
</span> </span>

View File

@@ -8,34 +8,35 @@
{% assign paths = page.url | split: '/' %} {% assign paths = page.url | split: '/' %}
{% if paths.size == 0 %} {% if paths.size == 0 or page.layout == 'home' %}
<!-- index page --> <!-- index page -->
<span>{{ 'Posts' }}</span> <span>{{ site.data.locales[lang].tabs.home | capitalize }}</span>
{% else %} {% else %}
{% for item in paths %} {% for item in paths %}
{% if forloop.first %} {% if forloop.first %}
{% unless page.layout == 'post' %}
<span> <span>
<a href="{{ '/' | relative_url }}">{{ 'Home' }}</a> <a href="{{ '/' | relative_url }}">
{{ site.data.locales[lang].tabs.home | capitalize }}
</a>
</span> </span>
{% endunless %}
{% elsif forloop.last %} {% elsif forloop.last %}
<span>{{ page.title }}</span>
{% else %} {% if page.collection == 'tabs' %}
<span> <span>{{ site.data.locales[lang].tabs[item] | default: page.title }}</span>
{% assign url = item %} {% else %}
{% if item == 'posts' and page.layout == 'post' %} <span>{{ page.title }}</span>
{% assign url = '/' %}
{% endif %} {% endif %}
<a href="{{ url | relative_url }}">
{{ item | capitalize }}
</a>
</span>
{% elsif page.layout == 'category' or page.layout == 'tag' %}
<span>
<a href="{{ item | relative_url }}">
{{ site.data.locales[lang].tabs[item] | default: page.title }}
</a>
</span>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@@ -48,11 +49,12 @@
<div id="topbar-title"> <div id="topbar-title">
{% if page.layout == 'home' %} {% if page.layout == 'home' %}
{{- site.title -}} {{- site.data.locales[lang].title | default: site.title -}}
{% elsif page.dynamic_title %} {% elsif page.collection == 'tabs' %}
{{- page.title -}} {%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[lang].tabs[tab_key] | default: page.title -}}
{% else %} {% else %}
{{- page.layout | capitalize -}} {{- site.data.locales[lang].layout[page.layout] | default: page.layout | capitalize -}}
{% endif %} {% endif %}
</div> </div>
@@ -60,10 +62,10 @@
<span id="search-wrapper" class="align-items-center"> <span id="search-wrapper" class="align-items-center">
<i class="fas fa-search fa-fw"></i> <i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search" <input class="form-control" id="search-input" type="search"
aria-label="search" autocomplete="off" placeholder="{{ site.data.label.search_hint | default: 'Search' }}..."> aria-label="search" autocomplete="off" placeholder="{{ site.data.locales[lang].search.hint | capitalize }}...">
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i> <i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span> </span>
<span id="search-cancel" >Cancel</span> <span id="search-cancel" >{{ site.data.locales[lang].search.cancel }}</span>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,5 @@
/*! /*!
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v4.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -0,0 +1,81 @@
/*
* Initial the clipboard.js object
*
* Dependencies:
* - popper.js (https://github.com/popperjs/popper-core)
* - clipboard.js (https://github.com/zenorocha/clipboard.js)
*/
$(function() {
const btnSelector = '.code-header>button';
const ICON_SUCCESS = 'fas fa-check';
const ATTR_LOCKED = 'locked';
const TIMEOUT = 2000; // in milliseconds
const clipboard = new ClipboardJS(btnSelector, {
target(trigger) {
return trigger.parentNode.nextElementSibling;
}
});
$(btnSelector).tooltip({
trigger: 'click',
placement: 'left'
});
function getIcon(btn) {
let iconNode = $(btn).children();
return iconNode.attr('class');
}
const ICON_DEFAULT = getIcon(btnSelector);
function setTooltip(btn) {
$(btn).tooltip('hide')
.tooltip('show');
}
function hideTooltip(btn) {
setTimeout(function() {
$(btn).tooltip('hide');
}, TIMEOUT);
}
function setSuccessIcon(btn) {
let btnNode = $(btn);
let iconNode = btnNode.children();
btnNode.attr(ATTR_LOCKED, true);
iconNode.attr('class', ICON_SUCCESS);
}
function resumeIcon(btn) {
let btnNode = $(btn);
let iconNode = btnNode.children();
setTimeout(function() {
btnNode.removeAttr(ATTR_LOCKED);
iconNode.attr('class', ICON_DEFAULT);
}, TIMEOUT);
}
function isLocked(btn) {
let locked = $(btn).attr(ATTR_LOCKED);
return locked === 'true';
}
clipboard.on('success', (e) => {
e.clearSelection();
if (isLocked(e.trigger)) {
return;
}
setTooltip(e.trigger);
hideTooltip(e.trigger);
setSuccessIcon(e.trigger);
resumeIcon($(e.trigger));
});
});

View File

@@ -1,18 +0,0 @@
/*
* Copy current page url to clipboard.
*/
function copyLink(url) {
if (!url || 0 === url.length) {
url = window.location.href;
}
const $temp = $("<input>");
$("body").append($temp);
$temp.val(url).select();
document.execCommand("copy");
$temp.remove();
alert("Link copied successfully!");
}

View File

@@ -11,10 +11,10 @@ $(function() {
return; return;
} }
/* lozy loading */ /* lazy loading */
const imgs = document.querySelectorAll(`${IMG_SCOPE} img[data-src]`); const imgList = document.querySelectorAll(`${IMG_SCOPE} img[data-src]`);
const observer = lozad(imgs); const observer = lozad(imgList);
observer.observe(); observer.observe();
/* popup */ /* popup */
@@ -40,9 +40,8 @@ $(function() {
} }
}); });
/* markup the image links */ /* markup the image links */
$(`${IMG_SCOPE} a`).has("img").addClass('img-link');
$(`${IMG_SCOPE} a`).has('img').addClass('img-link');
}); });

View File

@@ -1,20 +0,0 @@
/**
* Add language indicator to code snippets
*/
$(function() {
const prefix = "language-";
const regex = new RegExp(`^${prefix}([a-z])+$`);
$(`div[class^=${prefix}`).each(function() {
let classes = $(this).attr("class").split(" ");
classes.forEach((_class) => {
if (regex.test(_class)) {
let lang = _class.substring(prefix.length);
$(this).attr("lang", `${lang}`);
}
});
});
});

View File

@@ -10,26 +10,18 @@ $(function() {
let intervalId = void 0; let intervalId = void 0;
function timeago(iso, preposition) { const dPrompt = $("meta[name=day-prompt]").attr("content");
const hrPrompt = $("meta[name=hour-prompt]").attr("content");
const minPrompt = $("meta[name=minute-prompt]").attr("content");
const justnowPrompt = $("meta[name=justnow-prompt]").attr("content");
function timeago(isoDate, dateStr) {
let now = new Date(); let now = new Date();
let past = new Date(iso); let past = new Date(isoDate);
let prep = (typeof preposition !== "undefined" ? `${preposition} ` : "");
if (past.getFullYear() !== now.getFullYear()) { if (past.getFullYear() !== now.getFullYear()
toRefresh -= 1; || past.getMonth() !== now.getMonth()) {
return prep + past.toLocaleString("en-US", { return dateStr;
year: "numeric",
month: "short",
day: "numeric"
});
}
if (past.getMonth() !== now.getMonth()) {
toRefresh -= 1;
return prep + past.toLocaleString("en-US", {
month: "short",
day: "numeric"
});
} }
let seconds = Math.floor((now - past) / 1000); let seconds = Math.floor((now - past) / 1000);
@@ -37,28 +29,29 @@ $(function() {
let day = Math.floor(seconds / 86400); let day = Math.floor(seconds / 86400);
if (day >= 1) { if (day >= 1) {
toRefresh -= 1; toRefresh -= 1;
return day + " day" + (day > 1 ? "s" : "") + " ago"; return ` ${day} ${dPrompt}`;
} }
let hour = Math.floor(seconds / 3600); let hour = Math.floor(seconds / 3600);
if (hour >= 1) { if (hour >= 1) {
return hour + " hour" + (hour > 1 ? "s" : "") + " ago"; return ` ${hour} ${hrPrompt}`;
} }
let minute = Math.floor(seconds / 60); let minute = Math.floor(seconds / 60);
if (minute >= 1) { if (minute >= 1) {
return minute + " minute" + (minute > 1 ? "s" : "") + " ago"; return ` ${minute} ${minPrompt}`;
} }
return "just now"; return justnowPrompt;
} }
function updateTimeago() { function updateTimeago() {
$(".timeago").each(function() { $(".timeago").each(function() {
if ($(this).children("i").length > 0) { if ($(this).children("i").length > 0) {
let dateStr = $(this).clone().children().remove().end().text();
let node = $(this).children("i"); let node = $(this).children("i");
let date = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */ let iosDate = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */
$(this).text(timeago(date, $(this).attr("prep"))); $(this).text(timeago(iosDate, dateStr));
$(this).append(node); $(this).append(node);
} }
}); });

View File

@@ -3,8 +3,10 @@ layout: page
# The Archives of posts. # The Archives of posts.
--- ---
{% include lang.html %}
<div id="archives" class="pl-xl-2"> <div id="archives" class="pl-xl-2">
{% for post in site.posts %} {% for post in site.posts %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %} {% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
@@ -17,9 +19,10 @@ layout: page
<li> <li>
<div> <div>
{% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %} {% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %}
{% capture this_month %}{{ post.date | date: "%b" }}{% endcapture %} {% capture _mth_df %}{{ site.data.locales[lang].date_format.post.archive_month }}{% endcapture %}
{% capture this_month %}{{ post.date | date: _mth_df }}{% endcapture %}
<span class="date day">{{ this_day }}</span> <span class="date day">{{ this_day }}</span>
<span class="date month small text-muted">{{ this_month }}</span> <span class="date month small text-muted">{% include no-zero-date.html date_str=this_month %}</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div> </div>
</li> </li>

View File

@@ -3,6 +3,7 @@ layout: page
# All the Categories of posts # All the Categories of posts
--- ---
{% include lang.html %}
{% assign HEAD_PREFIX = "h_" %} {% assign HEAD_PREFIX = "h_" %}
{% assign LIST_PREFIX = "l_" %} {% assign LIST_PREFIX = "l_" %}
@@ -33,28 +34,23 @@ layout: page
<div class="card categories"> <div class="card categories">
<!-- top-category --> <!-- top-category -->
<div class="card-header d-flex justify-content-between hide-border-bottom" <div id="{{ HEAD_PREFIX }}{{ group_index }}"
id="{{ HEAD_PREFIX }}{{ group_index }}"> class="card-header d-flex justify-content-between hide-border-bottom">
<span> <span>
{% if sub_categories_size > 0 %} <i class="far fa-folder{% if sub_categories_size > 0 %}-open{% endif %} fa-fw"></i>
<i class="far fa-folder-open fa-fw"></i>
{% else %} {% capture _category_url %}/categories/{{ category_name | slugify | url_encode }}/{% endcapture %}
<i class="far fa-folder fa-fw"></i> <a href="{{ _category_url | relative_url }}" class="ml-1 mr-2">{{ category_name }}</a>
{% endif %}
<a href="{{ site.baseurl }}/categories/{{ category_name | slugify | url_encode }}/"
class="ml-1 mr-2">
{{ category_name }}
</a>
<!-- content count --> <!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %} {% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light"> <span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %} {% if sub_categories_size > 0 %}
{{ sub_categories_size }} {{ sub_categories_size }}
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %}, {{ site.data.locales[lang].categories.category_measure }},
{% endif %} {% endif %}
{{ top_posts_size }} {{ top_posts_size }}
post{% if top_posts_size > 1 %}s{% endif %} {{ site.data.locales[lang].categories.post_measure }}
</span> </span>
</span> </span>
@@ -80,11 +76,14 @@ layout: page
{% for sub_category in sub_categories %} {% for sub_category in sub_categories %}
<li class="list-group-item"> <li class="list-group-item">
<i class="far fa-folder fa-fw"></i> <i class="far fa-folder fa-fw"></i>
<a href="{{ site.baseurl }}/categories/{{ sub_category | slugify | url_encode }}/"
class="ml-1 mr-2">{{ sub_category }}</a> {% capture _sub_ctg_url %}/categories/{{ sub_category | slugify | url_encode }}/{% endcapture %}
<a href="{{ _sub_ctg_url | relative_url }}" class="ml-1 mr-2">{{ sub_category }}</a>
{% assign posts_size = site.categories[sub_category] | size %} {% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light">{{ posts_size }} <span class="text-muted small font-weight-light">
post{% if posts_size > 1 %}s{% endif %} {{ posts_size }}
{{ site.data.locales[lang].categories.post_measure }}
</span> </span>
</li> </li>
{% endfor %} {% endfor %}

View File

@@ -3,6 +3,8 @@ layout: page
# The Category layout # The Category layout
--- ---
{% include lang.html %}
<div id="page-category"> <div id="page-category">
<h1 class="pl-lg-2"> <h1 class="pl-lg-2">
<i class="far fa-folder-open fa-fw text-muted"></i> <i class="far fa-folder-open fa-fw text-muted"></i>
@@ -11,13 +13,13 @@ layout: page
</h1> </h1>
<ul class="post-content pl-0"> <ul class="post-content pl-0">
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %} {% assign post_df = site.data.locales[lang].date_format.post.long %}
{% for post in page.posts %} {% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3"> <li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span> <span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: post_long_df }}</span> <span class="text-muted small">{{ post.date | date: post_df }}</span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@@ -5,13 +5,15 @@ layout: compress
<!DOCTYPE html> <!DOCTYPE html>
{% include lang.html %}
{% capture prefer_mode %} {% capture prefer_mode %}
{% if site.theme_mode %} {% if site.theme_mode %}
mode="{{ site.theme_mode }}" mode="{{ site.theme_mode }}"
{% endif %} {% endif %}
{% endcapture %} {% endcapture %}
<html lang="{{ site.lang | default: "en-US" }}" {{ prefer_mode }}> <html lang="{{ site.lang }}" {{ prefer_mode }}>
{% include head.html %} {% include head.html %}
@@ -46,6 +48,8 @@ layout: compress
{% include search-loader.html %} {% include search-loader.html %}
{% include js-selector.html %}
</body> </body>
</html> </html>

View File

@@ -3,9 +3,11 @@ layout: page
# The Home page layout # The Home page layout
--- ---
{% include lang.html %}
{% assign pinned = site.posts | where: "pin", "true" %}
{% assign default = site.posts | where_exp: "item", "item.pin != true" %}
{% assign pinned = site.posts | where_exp: "item", "item.pin == true" %}
{% assign default = site.posts | where_exp: "item", "item.pin != true" %}
{% assign posts = "" | split: "" %} {% assign posts = "" | split: "" %}
<!-- Get pinned posts --> <!-- Get pinned posts -->
@@ -39,7 +41,6 @@ layout: page
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<div id="post-list"> <div id="post-list">
{% for post in posts %} {% for post in posts %}
@@ -79,7 +80,7 @@ layout: page
{% if post.pin %} {% if post.pin %}
<div class="pin"> <div class="pin">
<i class="fas fa-thumbtack fa-fw"></i> <i class="fas fa-thumbtack fa-fw"></i>
<span>{{ site.data.label.pin_prompt | default: 'Pinned' }}</span> <span>{{ site.data.locales[lang].post.pin_prompt }}</span>
</div> </div>
{% endif %} {% endif %}

View File

@@ -7,7 +7,14 @@ layout: default
<div class="col-12 col-lg-11 col-xl-8"> <div class="col-12 col-lg-11 col-xl-8">
<div id="page" class="post pb-5 pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4 mb-md-4"> <div id="page" class="post pb-5 pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4 mb-md-4">
{% if page.dynamic_title %} {% if page.dynamic_title %}
<h1 class="dynamic-title">{{ page.title }}</h1> <h1 class="dynamic-title">
{% if page.collection == 'tabs' %}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[lang].tabs[tab_key] | default: page.title -}}
{% else %}
{{- page.title -}}
{% endif %}
</h1>
<div class="post-content"> <div class="post-content">
{{ content }} {{ content }}
</div> </div>

View File

@@ -3,6 +3,8 @@ layout: default
# The posts' layout # The posts' layout
--- ---
{% include lang.html %}
<div class="row"> <div class="row">
<div id="post-wrapper" class="col-12 col-lg-11 col-xl-8"> <div id="post-wrapper" class="col-12 col-lg-11 col-xl-8">
@@ -17,24 +19,28 @@ layout: default
<span class="semi-bold"> <span class="semi-bold">
{{ page.author | default: site.social.name }} {{ page.author | default: site.social.name }}
</span> </span>
{% include timeago.html date=page.date prep="on" tooltip=true %} {% capture _preposition %}{{ site.data.locales[lang].post.published }}{% endcapture %}
{% include timeago.html date=page.date tooltip=true preposition=_preposition %}
</div> </div>
<div> <div>
<!-- lastmod --> <!-- lastmod -->
{% if page.last_modified_at %} {% if page.last_modified_at %}
<span> <span>
{% include timeago.html date=page.last_modified_at {{ site.data.locales[lang].post.updated }}
class="lastmod" prefix="Updated" tooltip=true %} {% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
</span> </span>
{% endif %} {% endif %}
<!-- read time --> <!-- read time -->
{% include read-time.html content=content %} {% include read-time.html content=content prompt=true %}
<!-- page views --> <!-- page views -->
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<span id="pv" class="pageviews"><i class="fas fa-spinner fa-spin fa-fw"></i></span> <span id="pv" class="pageviews">
<i class="fas fa-spinner fa-spin fa-fw"></i>
</span>
{{ site.data.locales[lang].post.pageview_measure }}
{% endif %} {% endif %}
</div> </div>
@@ -44,7 +50,11 @@ layout: default
<div class="post-content"> <div class="post-content">
{% if page.image.src %} {% if page.image.src %}
<img src="{{ page.image.src }}" class="preview-img" alt="{{ page.image.alt | default: "Preview Image" }}"> <img src="{{ page.image.src }}"
class="preview-img"
alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %}width="{{ page.image.width }}"{% endif %}
{% if page.image.height %}height="{{ page.image.height }}"{% endif %}>
{% endif %} {% endif %}
{{ content }} {{ content }}
@@ -55,6 +65,7 @@ layout: default
<!-- categories --> <!-- categories -->
{% if page.categories.size > 0 %} {% if page.categories.size > 0 %}
<div class="post-meta mb-3"> <div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw mr-1"></i> <i class="far fa-folder-open fa-fw mr-1"></i>
{% for category in page.categories %} {% for category in page.categories %}
@@ -79,13 +90,16 @@ layout: default
<div class="post-tail-bottom <div class="post-tail-bottom
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2"> d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
{% if site.data.rights.license %}
<div class="license-wrapper"> <div class="license-wrapper">
This post is licensed under {% if site.data.locales[lang].copyright.license.template %}
<a href="{{ site.data.rights.license.link }}">{{ site.data.rights.license.name }}</a> {% capture _replacement %}
by the author. <a href="{{ site.data.locales[lang].copyright.license.link }}">
</div> {{ site.data.locales[lang].copyright.license.name }}
</a>
{% endcapture %}
{{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
{% endif %} {% endif %}
</div>
{% include post-sharing.html %} {% include post-sharing.html %}

View File

@@ -3,6 +3,7 @@ layout: page
# The layout for Tag page # The layout for Tag page
--- ---
{% include lang.html %}
<div id="page-tag"> <div id="page-tag">
<h1 class="pl-lg-2"> <h1 class="pl-lg-2">
@@ -11,13 +12,13 @@ layout: page
<span class="lead text-muted pl-2">{{ page.posts | size }}</span> <span class="lead text-muted pl-2">{{ page.posts | size }}</span>
</h1> </h1>
<ul class="post-content pl-0"> <ul class="post-content pl-0">
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %} {% assign post_df = site.data.locales[lang].date_format.post.long %}
{% for post in page.posts %} {% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3"> <li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span> <span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: post_long_df }}</span> <span class="text-muted small">{{ post.date | date: post_df }}</span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@@ -8,6 +8,8 @@ math: true
mermaid: true mermaid: true
image: image:
src: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png src: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
width: 850
height: 585
--- ---
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.
@@ -50,7 +52,7 @@ Fluttering and dancing in the breeze.
### Unordered list ### Unordered list
- Chapter - Chapter
- Setcion - Section
- Paragraph - Paragraph
### Task list ### Task list
@@ -97,39 +99,34 @@ Click the hook will locate the footnote[^footnote], and here is another footnote
- Default (with caption) - Default (with caption)
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png) ![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="972" height="589" }
_Full screen width and center alignment_ _Full screen width and center alignment_
<br> <br>
- Specify width
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="400"}
_400px image width_
- Shadow - Shadow
![Shadow Avatar](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/window.png){: .shadow width="90%" } ![Window shadow](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/window.png){: .shadow width="1548" height="864" style="max-width: 90%" }
_shadow effect (visible in light mode)_ _shadow effect (visible in light mode)_
<br> <br>
- Left aligned - Left aligned
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="350" .normal} ![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="972" height="589" style="max-width: 70%" .normal}
<br> <br>
- Float to left - Float to left
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="240" .left} ![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="972" height="589" style="max-width: 200px" .left}
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space." "A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
<br> <br>
- Float to right - Float to right
![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="240" .right} ![Desktop View](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190808/mockup.png){: width="972" height="589" style="max-width: 200px" .right}
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space." "A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
<br> <br>
@@ -179,44 +176,23 @@ SHELL=/usr/local/bin/bash
PYENV_SHELL=bash PYENV_SHELL=bash
``` ```
#### Ruby
```ruby
def sum_eq_n?(arr, n)
return true if arr.empty? && n == 0
arr.product(arr).reject { |a,b| a == b }.any? { |a,b| a + b == n }
end
```
#### Shell #### Shell
```shell ```bash
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "The command was not successful."; echo "The command was not successful.";
#do the needful / exit #do the needful / exit
fi; fi;
``` ```
#### Liquid ### Specific filename
{% raw %} ```sass
```liquid @import
{% if product.title contains 'Pack' %} "colors/light-typography",
This product's title contains the word Pack. "colors/dark-typography"
{% endif %}
```
{% endraw %}
#### Java
```java
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
// Write out any hidden serialization magic
s.defaultWriteObject();
for (E e: map.keySet()) s.writeObject(e);
}
``` ```
{: file='_sass/jekyll-theme-chirpy.scss'}
## Reverse Footnote ## Reverse Footnote

View File

@@ -4,6 +4,7 @@ author: Cotes Chung
date: 2019-08-08 14:10:00 +0800 date: 2019-08-08 14:10:00 +0800
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [writing] tags: [writing]
render_with_liquid: false
--- ---
## Naming and Path ## Naming and Path
@@ -72,7 +73,7 @@ math: true
[**Mermaid**](https://github.com/mermaid-js/mermaid) is a great diagrams generation tool. To enable it on your post, add the following to the YAML block: [**Mermaid**](https://github.com/mermaid-js/mermaid) is a great diagrams generation tool. To enable it on your post, add the following to the YAML block:
```yml ```yaml
--- ---
mermaid: true mermaid: true
--- ---
@@ -84,16 +85,21 @@ 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 and alt attribute for the image: If you want to add an image to the top of the post contents, specify the attribute `src`, `width`, `height` and `alt` for the image:
```yaml ```yaml
--- ---
image: image:
src: /path/to/image/file src: /path/to/image/file
width: 1000 # in pixels
height: 400 # in pixels
alt: image alternative text alt: image alternative text
--- ---
``` ```
Except for `alt`, all other options are necessary, especially the `width` and `height`, which are related to user experience and web page loading performance. Later section ["Image size"](#image-size) will also mention this.
### Image caption ### Image caption
Add italics to the next line of an imagethen it will become the caption and appear at the bottom of the image: Add italics to the next line of an imagethen it will become the caption and appear at the bottom of the image:
@@ -102,14 +108,16 @@ Add italics to the next line of an imagethen it will become the caption and a
![img-description](/path/to/image) ![img-description](/path/to/image)
_Image Caption_ _Image Caption_
``` ```
{: .nolineno}
### Image size ### Image size
You can specify the width (and height) of a image with `width`: In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image:
```markdown ```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="400"} ![Desktop View](/assets/img/sample/mockup.png){: width="700" height="400" }
``` ```
{: .nolineno}
### Image position ### Image position
@@ -120,20 +128,23 @@ By default, the image is centered, but you can specify the position by using one
Image will be left aligned in below sample: Image will be left aligned in below sample:
```markdown ```markdown
![Desktop View](/assets/img/sample/mockup.png){: .normal} ![Desktop View](/assets/img/sample/mockup.png){: .normal }
``` ```
{: .nolineno}
- **Float to the left** - **Float to the left**
```markdown ```markdown
![Desktop View](/assets/img/sample/mockup.png){: .left} ![Desktop View](/assets/img/sample/mockup.png){: .left }
``` ```
{: .nolineno}
- **Float to the right** - **Float to the right**
```markdown ```markdown
![Desktop View](/assets/img/sample/mockup.png){: .right} ![Desktop View](/assets/img/sample/mockup.png){: .right }
``` ```
{: .nolineno}
> **Limitation**: Once you specify the position of an image, it is forbidden to add the image caption. > **Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
@@ -142,9 +153,9 @@ By default, the image is centered, but you can specify the position by using one
The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode: The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode:
```markdown ```markdown
![Desktop View](/assets/img/sample/mockup.png){: .shadow} ![Desktop View](/assets/img/sample/mockup.png){: .shadow }
``` ```
{: .nolineno}
### CDN URL ### CDN URL
@@ -153,6 +164,7 @@ If you host the images on the CDN, you can save the time of repeatedly writing t
```yaml ```yaml
img_cdn: https://cdn.com img_cdn: https://cdn.com
``` ```
{: file='_config.yml' .nolineno}
Once `img_cdn` is assigned, the CDN url will be added to the path of all images (images of site avatar and posts) starting with `/`. Once `img_cdn` is assigned, the CDN url will be added to the path of all images (images of site avatar and posts) starting with `/`.
@@ -161,12 +173,14 @@ For instance, when using images:
```markdown ```markdown
![The flower](/path/to/flower.png) ![The flower](/path/to/flower.png)
``` ```
{: .nolineno}
The parsing result will automatically add the CDN prefix `https://cdn.com` before the image path: The parsing result will automatically add the CDN prefix `https://cdn.com` before the image path:
```html ```html
<img src="https://cdn.com/path/to/flower.png" alt="The flower"> <img src="https://cdn.com/path/to/flower.png" alt="The flower">
``` ```
{: .nolineno}
## Pinned Posts ## Pinned Posts
@@ -180,31 +194,51 @@ pin: true
## Code Block ## Code Block
Markdown symbols ```` ``` ```` can easily create a code block as following examples. Markdown symbols ```` ``` ```` can easily create a code block as follows:
``` ```
This is a common code snippet, without syntax highlight and line number. This is a plaintext code snippet.
``` ```
## Specific Language ### Specifying Language
Using ```` ```language ```` you will get code snippets with line numbers and syntax highlight. Using ```` ```{language} ```` you will get a code block with syntax highlight:
> **Note**: The Jekyll style `{% raw %}{%{% endraw %} highlight LANGUAGE {% raw %}%}{% endraw %}` or `{% raw %}{%{% endraw %} highlight LANGUAGE linenos {% raw %}%}{% endraw %}` are not allowed to be used in this theme !
````markdown
```yaml ```yaml
# Yaml code snippet key: value
items:
- part_no: A4786
descrip: Water Bucket (Filled)
price: 1.47
quantity: 4
``` ```
````
> **Limination**: The Jekyll style `highlight` tag ais not compatible with this theme.
### Line Number
By default, all languages except `plaintext`, `console` and `terminal` will display line numbers. When you want to hide the line number of the code block, you can append `{: .nolineno}` at the next line:
````markdown
```shell
echo 'No more line numbers!'
```
{: .nolineno}
````
### Specifying the Filename
You may have noticed that the code language will be displayed on the left side of the header of the code block. If you want to replace it with the file name, you can add the attribute `file` to achieve this:
````markdown
```shell
# content
```
{: file="path/to/file" }
````
### Liquid Codes ### Liquid Codes
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}{%{% endraw %} raw {%raw%}%}{%endraw%}` and `{% raw %}{%{% endraw %} endraw {%raw%}%}{%endraw%}` . If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:
````markdown
{% raw %} {% raw %}
```liquid ```liquid
{% if product.title contains 'Pack' %} {% if product.title contains 'Pack' %}
@@ -212,6 +246,9 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{%
{% endif %} {% endif %}
``` ```
{% endraw %} {% endraw %}
````
Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block.
## Learn More ## Learn More

View File

@@ -9,28 +9,30 @@ pin: true
## 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`. Please note that the version of `Ruby` must meet the requirements of the theme on [RubyGems.org](https://rubygems.org/gems/jekyll-theme-chirpy).
## Installation ## Installation
There are two ways to get the theme: There are two ways to get the theme:
- **Install from RubyGems** - Easy to update, isolate irrelevant project files so you can focus on writing. - **[Install from RubyGems](#install-from-rubygems)** - Easy to update, isolate irrelevant project files so you can focus on writing.
- **Fork on GitHub** - Convenient for custom development, but difficult to update, only suitable for web developers. - **[Fork on GitHub](#fork-on-github)** - Convenient for custom development, but difficult to update, only suitable for web developers.
### Installing the Theme Gem ### Install from RubyGems
Add this line to your Jekyll site's `Gemfile`: Add this line to your Jekyll site's `Gemfile`:
```ruby ```ruby
gem "jekyll-theme-chirpy" gem "jekyll-theme-chirpy"
``` ```
{: .nolineno file='Gemfile' }
And add this line to your Jekyll site's `_config.yml`: And add this line to your Jekyll site's `_config.yml`:
```yaml ```yaml
theme: jekyll-theme-chirpy theme: jekyll-theme-chirpy
``` ```
{: .nolineno file='_config.yml' }
And then execute: And then execute:
@@ -38,15 +40,19 @@ And then execute:
$ bundle $ bundle
``` ```
Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site. Next, go to the installed local theme path:
> **Hint**: To locate the installed themes gem, execute: ```console
$ cd "$(bundle info --path jekyll-theme-chirpy)"
```
And then copy the critical files (for details, see [starter project][starter]) from the theme's gem to your Jekyll site.
> ⚠️ **Watch out for duplicate files!**
> >
> ```console > If your Jekyll site is created by the `jekyll new` command, there will be `index.markdown` and `about.markdown` in the root directory of your site. Please be sure to remove them, otherwise they will overwrite the `index.html` and `_tabs/about.html` from this project, resulting in blank or messy pages.
> $ bundle info --path jekyll-theme-chirpy
> ```
Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from the theme's gem. We have prepared everything for you there! As an alternative, which we recommend, you can create a Jekyll site [**using the starter template**][use-starter] to save time copying files from the theme's gem. We've prepared everything you need there!
### Fork on GitHub ### Fork on GitHub
@@ -88,6 +94,12 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
- `timezone` - `timezone`
- `lang` - `lang`
### Customing Stylesheet
If you need to customize stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file.
Starting from `v4.1.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it.
### Running Local Server ### Running Local Server
You may want to preview the site contents before publishing, so just run it by: You may want to preview the site contents before publishing, so just run it by:
@@ -130,7 +142,7 @@ Now publish your Jekyll site by:
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) through _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) through _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){: width="850" height="153" }
3. Visit your website at the address indicated by GitHub. 3. Visit your website at the address indicated by GitHub.

View File

@@ -33,7 +33,7 @@ With your property created, you now need to set up Data Stream to track your blo
It should look like this: It should look like this:
![google-analytics-data-stream](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/01-google-analytics-data-stream.png) ![google-analytics-data-stream](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/01-google-analytics-data-stream.png){: width="1086" height="542"}
Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml` file Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml` file
@@ -45,10 +45,11 @@ google_analytics:
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
cache_path: # the local PV cache data, friendly to visitors from GFW region cache_path: # the local PV cache data, friendly to visitors from GFW region
``` ```
{: file="_config.yml"}
When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pickup your changes. You should now be able to monitor your traffic in realtime. When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pickup your changes. You should now be able to monitor your traffic in realtime.
![google-analytics-realtime](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/02-google-analytics-realtime.png) ![google-analytics-realtime](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/02-google-analytics-realtime.png){: width="616" height="557"}
## Setup Page Views ## Setup Page Views
@@ -140,6 +141,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
# XSRF Settings # XSRF Settings
XSRF_KEY = 'OnceUponATimeThereLivedALegend' XSRF_KEY = 'OnceUponATimeThereLivedALegend'
``` ```
{: file="src/config.py"}
**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.
@@ -183,7 +185,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
If everything went good, you'll get this screen: If everything went good, you'll get this screen:
![superProxy-deployed](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/03-superProxy-deployed.png) ![superProxy-deployed](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/03-superProxy-deployed.png){: width="1366" height="354"}
### Create Google Analytics Query ### Create Google Analytics Query
@@ -208,14 +210,14 @@ After <kbd>Run Query</kbd>, copy the generated contents of **API Query URI** at
After the query is saved on GAE, a **Public Endpoint** (public access address) will be generated, and we will get the query result in JSON format when accessing it. Finally, click <kbd>Enable Endpoint</kbd> in **Public Request Endpoint** to make the query effective, and click <kbd>Start Scheduling</kbd> in **Scheduling** to start the scheduled task. After the query is saved on GAE, a **Public Endpoint** (public access address) will be generated, and we will get the query result in JSON format when accessing it. Finally, click <kbd>Enable Endpoint</kbd> in **Public Request Endpoint** to make the query effective, and click <kbd>Start Scheduling</kbd> in **Scheduling** to start the scheduled task.
![superproxy-query](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/04-superproxy-query.png) ![superproxy-query](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/04-superproxy-query.png){: width="1100" height="126"}
## Configure Chirpy to Display Page View ## Configure Chirpy to Display Page View
Once all the hard part is done, it is very easy to enable the Page View on Chirpy theme. Your superProxy dashboard should look something like below and you can grab the required values. Once all the hard part is done, it is very easy to enable the Page View on Chirpy theme. Your superProxy dashboard should look something like below and you can grab the required values.
![superproxy-dashboard](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/05-superproxy-dashboard.png) ![superproxy-dashboard](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20210103/05-superproxy-dashboard.png){: width="1210" height="694"}
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:
@@ -226,6 +228,7 @@ google_analytics:
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>' proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
cache_path: # the local PV cache data, friendly to visitors from GFW region cache_path: # the local PV cache data, friendly to visitors from GFW region
``` ```
{: file="_config.yml"}
Now, you should see the Page View enabled on your blog. Now, you should see the Page View enabled on your blog.

View File

@@ -53,6 +53,26 @@ body {
font-family: 'Source Sans Pro', 'Microsoft Yahei', sans-serif; font-family: 'Source Sans Pro', 'Microsoft Yahei', sans-serif;
} }
/* --- Scrollbar --- */
$scrollbar-size: 7px;
::-webkit-scrollbar {
width: $scrollbar-size;
height: $scrollbar-size;
}
::-webkit-scrollbar-track {
@at-root body#{&} {
-webkit-box-shadow: inset 0 0 6px var(--scrollbar-track-bg);
}
}
::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-thumb-bg);
border-radius: calc(#{$scrollbar-size} / 2);
}
/* --- Typography --- */ /* --- Typography --- */
h1 { h1 {
@@ -107,6 +127,7 @@ a {
img { img {
max-width: 100%; max-width: 100%;
height: auto;
} }
blockquote { blockquote {
@@ -363,9 +384,29 @@ footer {
overflow-wrap: break-word; overflow-wrap: break-word;
word-wrap: break-word; word-wrap: break-word;
@mixin caption {
+ em {
display: block;
text-align: center;
font-style: normal;
font-size: 80%;
padding: 0;
color: #6d6c6c;
}
}
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
img[data-src] { img[data-src] {
margin: 0.5rem 0; margin: 0.5rem 0;
&[data-loaded=true] {
animation: fade-in linear .5s;
}
&.left { &.left {
float: left; float: left;
margin: 0.75rem 1rem 1rem 0; margin: 0.75rem 1rem 1rem 0;
@@ -380,6 +421,8 @@ footer {
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08)); filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
} }
@include caption;
} }
a { a {
@@ -404,14 +447,7 @@ footer {
} }
&.img-link { &.img-link {
+ em { @include caption;
display: block;
text-align: center;
font-style: normal;
font-size: 80%;
padding: 0;
color: #6d6c6c;
}
} }
} // a } // a
@@ -444,10 +480,6 @@ footer {
padding-left: 2rem; padding-left: 2rem;
li { li {
+ li {
margin-top: 0.3rem;
}
ol, ol,
ul { // sub list ul { // sub list
padding-left: 2rem; padding-left: 2rem;
@@ -589,8 +621,6 @@ figure .mfp-title {
/* --- sidebar layout --- */ /* --- sidebar layout --- */
$tab-count: 5 !default;
$sidebar-display: "sidebar-display"; $sidebar-display: "sidebar-display";
#sidebar { #sidebar {
@@ -601,7 +631,7 @@ $sidebar-display: "sidebar-display";
left: 0; left: 0;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
width: $sidebar-width-medium; width: $sidebar-width;
z-index: 99; z-index: 99;
background: var(--sidebar-bg); background: var(--sidebar-bg);
@@ -710,7 +740,6 @@ $sidebar-display: "sidebar-display";
width: 100%; width: 100%;
&:last-child { &:last-child {
$cursor-width: 3px;
a { a {
position: relative; position: relative;
@@ -740,12 +769,12 @@ $sidebar-display: "sidebar-display";
@for $i from 1 through $tab-count { @for $i from 1 through $tab-count {
$offset: $tab-count - $i; $offset: $tab-count - $i;
$top: -$offset * $tab-height + $tab-cursor-height / 2; $top: -$offset * $tab-height + ($tab-height - $tab-cursor-height) / 2;
@if $i < $tab-count { @if $i < $tab-count {
> li.active:nth-child(#{$i}), > li.active:nth-child(#{$i}),
> li.nav-item:nth-child(#{$i}):hover { > li.nav-item:nth-child(#{$i}):hover {
~li:last-child::after { ~ li:last-child::after {
@include fix-cursor($top); @include fix-cursor($top);
} }
} }
@@ -839,7 +868,7 @@ $sidebar-display: "sidebar-display";
height: $topbar-height; height: $topbar-height;
position: fixed; position: fixed;
top: 0; top: 0;
left: 260px; /* same as sidebar width */ left: $sidebar-width; /* same as sidebar width */
right: 0; right: 0;
transition: top 0.2s ease-in-out; transition: top 0.2s ease-in-out;
z-index: 50; z-index: 50;
@@ -880,7 +909,7 @@ $sidebar-display: "sidebar-display";
#search-wrapper { #search-wrapper {
display: flex; display: flex;
width: 95%; width: 85%;
border-radius: 1rem; border-radius: 1rem;
border: 1px solid var(--search-wrapper-bg); border: 1px solid var(--search-wrapper-bg);
background: var(--search-wrapper-bg); background: var(--search-wrapper-bg);
@@ -1083,7 +1112,7 @@ $sidebar-display: "sidebar-display";
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
$footer-height: 6rem; // overwrite $footer-height: $footer-height-mobile; // overwrite
#main > div.row:first-child > div:first-child { #main > div.row:first-child > div:first-child {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height}); min-height: calc(100vh - #{$topbar-height} - #{$footer-height});
@@ -1157,7 +1186,7 @@ $sidebar-display: "sidebar-display";
#topbar-wrapper, #topbar-wrapper,
#main-wrapper { #main-wrapper {
transform: translateX(#{$sidebar-width-medium}); transform: translateX(#{$sidebar-width});
} }
} }
@@ -1165,8 +1194,8 @@ $sidebar-display: "sidebar-display";
#sidebar { #sidebar {
@extend %slide; @extend %slide;
transform: translateX(-#{$sidebar-width-medium}); // hide transform: translateX(-#{$sidebar-width}); // hide
-webkit-transform: translateX(-#{$sidebar-width-medium}); -webkit-transform: translateX(-#{$sidebar-width});
.cursor { .cursor {
-webkit-transition: none; -webkit-transition: none;
@@ -1264,7 +1293,7 @@ $sidebar-display: "sidebar-display";
} }
#main-wrapper { #main-wrapper {
margin-left: $sidebar-width-medium; margin-left: $sidebar-width;
} }
.profile-wrapper { .profile-wrapper {

View File

@@ -27,20 +27,20 @@ html[mode=dark] {
/* -- Codes Snippet -- */ /* -- Codes Snippet -- */
$code-radius: 6px;
%code-snippet-bg { %code-snippet-bg {
background: var(--highlight-bg-color); background: var(--highlight-bg-color);
} }
%code-snippet-radius { %code-snippet-radius {
border-radius: 6px; border-radius: $code-radius;
} }
%code-snippet-padding { %code-snippet-padding {
padding: 1.5rem; padding: 1.2rem;
} }
$code-font-size: 0.85rem;
div > pre { div > pre {
@extend %code-snippet-bg; @extend %code-snippet-bg;
@extend %code-snippet-radius; @extend %code-snippet-radius;
@@ -65,26 +65,14 @@ div > pre {
} }
overflow: auto; overflow: auto;
.lineno {
margin-left: 0.2rem;
padding-right: 0.5rem;
min-width: 2.2rem;
text-align: right;
color: var(--highlight-lineno-color);
border-right: 1px solid var(--highlight-lineno-border-color);
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
pre { pre {
margin-bottom: 0; margin-bottom: 0;
font-size: $code-font-size; font-size: $code-font-size;
line-height: 1.4rem; line-height: 1.4rem;
word-wrap: normal; /* Fixed Safari overflow-x */ word-wrap: normal; /* Fixed Safari overflow-x */
} }
table { table {
padding: 0; padding: 0;
border: 0; border: 0;
@@ -93,10 +81,30 @@ div > pre {
word-break: normal; /* Fixed iOS safari linenos code break */ word-break: normal; /* Fixed iOS safari linenos code break */
} }
} }
td { td {
padding: 0; padding: 0;
border: 0; border: 0;
} }
.lineno {
padding-right: 0.5rem;
min-width: 2.2rem;
text-align: right;
color: var(--highlight-lineno-color);
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
/* set the dollar sign to non-selectable */
.gp {
user-select: none;
}
} //.highlight } //.highlight
code { code {
@@ -127,7 +135,7 @@ code {
} }
td.rouge-code { td.rouge-code {
padding: 1.5rem 1.5rem 1.5rem 1rem; padding: 1.2rem 1.5rem 1.2rem 1rem;
// Prevent some browser extends from // Prevent some browser extends from
// changing the URL string of code block. // changing the URL string of code block.
@@ -144,7 +152,8 @@ div {
&[class^='highlighter-rouge'], &[class^='highlighter-rouge'],
&.language-plaintext.highlighter-rouge, &.language-plaintext.highlighter-rouge,
&.language-console.highlighter-rouge, &.language-console.highlighter-rouge,
&.language-terminal.highlighter-rouge { &.language-terminal.highlighter-rouge,
&.nolineno {
pre.lineno { pre.lineno {
display: none; display: none;
} }
@@ -154,25 +163,76 @@ div {
} }
} }
div[class^='language-']::before { .code-header {
content: attr(lang); background: var(--code-header-bg);
position: absolute; border-top-left-radius: $code-radius;
right: 2rem; border-top-right-radius: $code-radius;
margin-top: 3px; display: flex;
font-size: 0.7rem; justify-content: space-between;
font-weight: 600; align-items: center;
color: var(--highlight-lineno-color); line-height: 1.85rem;
text-transform: uppercase;
// text data
&::before {
content: attr(text-data);
color: var(--lang-badge-color);
padding-left: 1em;
// language
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
// file name
@at-root [file] #{&} {
font-size: 0.85rem;
text-transform: none;
}
}
// clipboard
button {
border: 1px solid var(--code-header-bg);
border-radius: $code-radius;
padding: 0;
width: 1.95rem;
background-color: inherit;
color: var(--highlight-lineno-color);
&[locked=true] {
color: var(--clipboard-checked-color);
border-color: var(--clipboard-checked-color);
}
&:not([locked]):hover {
background-color: gray;
color: white;
}
&:focus {
outline: none;
}
i {
font-size: 0.9rem;
}
}
} }
@media (min-width: 768px) { @media all and (max-width: 576px) {
div[class^='language-']::before { .post-content {
right: 3.1rem; > div[class^='language-'] {
} @include ml-mr(-1.25rem);
}
@media (min-width: 1650px) { border-radius: 0;
div[class^='language-']::before {
right: 3.5rem; .code-header {
border-radius: 0;
padding-left: 0.4rem;
padding-right: 0.5rem;
}
}
} }
} }

View File

@@ -1,22 +1,34 @@
/* /*
* Mainly scss variables * The SCSS variables
*/ */
/* --- ↓ width and height ---- */ /* sidebar */
$tab-height: 3.2rem; $sidebar-width: 260px !default; // the basic width
$tab-cursor-height: 1.6rem; $sidebar-width-small: 210px !default; // screen width: >= 850px, <= 1199px (iPad landscape)
$sidebar-width-large: 350px !default; // screen width: >= 1650px
$sidebar-width-small: 210px; /* tabs of sidebar */
$sidebar-width-medium: 260px;
$sidebar-width-large: 350px;
$topbar-height: 3rem; $tab-count: 5 !default; // backward compatible (version <= 4.0.2)
$tab-height: 3.2rem !default;
$tab-cursor-height: 1.6rem !default;
$footer-height: 5rem; $cursor-width: 3px !default; // the cursor width of the selected tab
$main-content-max-width: 1150px; /* other framework sizes */
$panel-max-width: 300px; $topbar-height: 3rem !default;
$post-extend-min-height: 35rem; $footer-height: 5rem !default;
$footer-height-mobile: 6rem !default; // screen width: <= 576px
$main-content-max-width: 1150px !default;
$panel-max-width: 300px !default;
$post-extend-min-height: 35rem !default;
/* syntax highlight */
$code-font-size: 0.85rem !default;

View File

@@ -3,20 +3,6 @@
*/ */
@mixin dark-syntax { @mixin dark-syntax {
/* ----- My styles ------ */
--highlight-bg-color: #252525;
--highlighter-rouge-color: #de6b18;
--highlight-lineno-color: #6c6c6d;
--highlight-lineno-border-color: #303435;
--inline-code-bg: #272822;
.highlight {
.gp { color: #818c96; }
}
pre { color: #bfbfbf; } /* override Bootstrap */
kbd { background-color: black; }
/* syntax highlight colors from https://raw.githubusercontent.com/jwarby/pygments-css/master/monokai.css */ /* syntax highlight colors from https://raw.githubusercontent.com/jwarby/pygments-css/master/monokai.css */
.highlight pre { background-color: var(--highlight-bg-color); } .highlight pre { background-color: var(--highlight-bg-color); }
.highlight .hll { background-color: var(--highlight-bg-color); } .highlight .hll { background-color: var(--highlight-bg-color); }
@@ -81,4 +67,21 @@
.highlight .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */ .highlight .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */
.highlight .gd { color: #f92672; background-color: #561c08; } /* Generic.Deleted & Diff Deleted */ .highlight .gd { color: #f92672; background-color: #561c08; } /* Generic.Deleted & Diff Deleted */
.highlight .gi { color: #a6e22e; background-color: #0b5858; } /* Generic.Inserted & Diff Inserted */ .highlight .gi { color: #a6e22e; background-color: #0b5858; } /* Generic.Inserted & Diff Inserted */
/* ----- custom styles ------ */
--highlight-bg-color: #252525;
--highlighter-rouge-color: #de6b18;
--highlight-lineno-color: #6c6c6d;
--inline-code-bg: #272822;
--code-header-bg: #353535;
--lang-badge-color: #6c6c6d;
--clipboard-checked-color: #2bcc2b;
.highlight {
.gp { color: #818c96; }
}
pre { color: #bfbfbf; } /* override Bootstrap */
kbd { background-color: black; }
} }

View File

@@ -3,26 +3,23 @@
*/ */
@mixin dark-scheme { @mixin dark-scheme {
/* framework */ /* Framework color */
--main-wrapper-bg: rgb(27, 27, 30);
--body-bg: var(--main-wrapper-bg); --body-bg: var(--main-wrapper-bg);
--topbar-wrapper-bg: rgb(39, 40, 43);
--search-wrapper-bg: rgb(34, 34, 39);
--search-icon-color: rgb(100, 102, 105);
--input-focus-border-color: rgb(112, 114, 115);
--mask-bg: rgb(68, 69, 70); --mask-bg: rgb(68, 69, 70);
--footer-bg-color: var(--main-wrapper-bg); --main-wrapper-bg: rgb(27, 27, 30);
/* common color */
--text-color: rgb(175, 176, 177);
--heading-color: #cccccc;
--text-muted-color: rgb(107, 116, 124);
--link-color: rgb(138, 180, 248);
--link-underline-color: rgb(82, 108, 150);
--main-border-color: rgb(44, 45, 45); --main-border-color: rgb(44, 45, 45);
--button-bg: rgb(39, 40, 43); --scrollbar-track-bg: rgba(0, 0, 0, 0.3);
--scrollbar-thumb-bg: rgb(173 171 171 / 50%);
/* Common color */
--text-color: rgb(175, 176, 177);
--text-muted-color: rgb(107, 116, 124);
--heading-color: #cccccc;
--blockquote-border-color: rgb(66, 66, 66); --blockquote-border-color: rgb(66, 66, 66);
--blockquote-text-color: rgb(117, 117, 117); --blockquote-text-color: rgb(117, 117, 117);
--link-color: rgb(138, 180, 248);
--link-underline-color: rgb(82, 108, 150);
--button-bg: rgb(39, 40, 43);
--btn-border-color: rgb(63, 65, 68); --btn-border-color: rgb(63, 65, 68);
--btn-backtotop-color: var(--text-color); --btn-backtotop-color: var(--text-color);
--btn-backtotop-border-color: var(--btn-border-color); --btn-backtotop-border-color: var(--btn-border-color);
@@ -36,8 +33,12 @@
--nav-cursor-color: rgb(183, 182, 182); --nav-cursor-color: rgb(183, 182, 182);
--sidebar-bg: radial-gradient(circle, #242424 0%, #1d1f27 100%); --sidebar-bg: radial-gradient(circle, #242424 0%, #1d1f27 100%);
/* Top Bar */ /* Topbar */
--topbar-text-color: var(--text-color); --topbar-text-color: var(--text-color);
--topbar-wrapper-bg: rgb(39, 40, 43);
--search-wrapper-bg: rgb(34, 34, 39);
--search-icon-color: rgb(100, 102, 105);
--input-focus-border-color: rgb(112, 114, 115);
/* Home page */ /* Home page */
--post-list-text-color: rgb(175, 176, 177); --post-list-text-color: rgb(175, 176, 177);
@@ -82,6 +83,7 @@
--timeline-year-dot-color: var(--timeline-color); --timeline-year-dot-color: var(--timeline-color);
/* Footer */ /* Footer */
--footer-bg-color: var(--main-wrapper-bg);
--footer-link: rgb(171, 171, 171); --footer-link: rgb(171, 171, 171);
.post-content img { .post-content img {

View File

@@ -70,6 +70,9 @@
--highlight-bg-color: #f7f7f7; --highlight-bg-color: #f7f7f7;
--highlighter-rouge-color: #2f2f2f; --highlighter-rouge-color: #2f2f2f;
--highlight-lineno-color: #c2c6cc; --highlight-lineno-color: #c2c6cc;
--highlight-lineno-border-color: #e9ecef;
--inline-code-bg: #f3f3f3; --inline-code-bg: #f3f3f3;
--code-header-bg: #eaeaea;
--lang-badge-color: #a4a7ab;
--clipboard-checked-color: #43c743;
} // light-syntax } // light-syntax

View File

@@ -3,22 +3,24 @@
*/ */
@mixin light-scheme { @mixin light-scheme {
/* Common */ /* Framework color */
--body-bg: #fafafa; --body-bg: #fafafa;
--mask-bg: #c1c3c5; --mask-bg: #c1c3c5;
--main-wrapper-bg: white; --main-wrapper-bg: white;
--main-border-color: #f3f3f3; --main-border-color: #f3f3f3;
--btn-border-color: #e9ecef; --scrollbar-track-bg: rgba(0, 0, 0, 0.3);
--scrollbar-thumb-bg: rgba(0, 0, 0, 0.3);
/* Common color */
--text-color: #34343c; --text-color: #34343c;
--text-muted-color: gray;
--heading-color: black; --heading-color: black;
--blockquote-border-color: #eee; --blockquote-border-color: #eee;
--blockquote-text-color: #9a9a9a; --blockquote-text-color: #9a9a9a;
--link-color: #2a408e; --link-color: #2a408e;
--link-underline-color: #dee2e6; --link-underline-color: #dee2e6;
--text-muted-color: gray;
--tb-odd-bg: #fbfcfd;
--tb-border-color: #eaeaea;
--button-bg: #fff; --button-bg: #fff;
--btn-border-color: #e9ecef;
--btn-backtotop-color: #686868; --btn-backtotop-color: #686868;
--btn-backtotop-border-color: #f1f1f1; --btn-backtotop-border-color: #f1f1f1;
--btn-box-shadow: #eaeaea; --btn-box-shadow: #eaeaea;
@@ -26,15 +28,12 @@
--checkbox-checked-color: #07a8f7; --checkbox-checked-color: #07a8f7;
/* Sidebar */ /* Sidebar */
--sidebar-bg: radial-gradient( --sidebar-bg: radial-gradient(circle, rgba(42, 30, 107, 1) 0%, rgba(35, 37, 46, 1) 100%);
circle,
rgba(42, 30, 107, 1) 0%,
rgba(35, 37, 46, 1) 100%);
--nav-cursor-color: #fcfcfc; --nav-cursor-color: #fcfcfc;
/* Topbar */ /* Topbar */
--topbar-wrapper-bg: white;
--topbar-text-color: rgb(78, 78, 78); --topbar-text-color: rgb(78, 78, 78);
--topbar-wrapper-bg: white;
--search-wrapper-bg: #f5f5f5; --search-wrapper-bg: #f5f5f5;
--search-tag-bg: #f8f9fa; --search-tag-bg: #f8f9fa;
--search-icon-color: #c2c6cc; --search-icon-color: #c2c6cc;
@@ -58,10 +57,13 @@
--card-box-shadow: rgba(234, 234, 234, 0.7686274509803922); --card-box-shadow: rgba(234, 234, 234, 0.7686274509803922);
--label-color: #616161; --label-color: #616161;
--relate-post-date: rgba(30, 55, 70, 0.4); --relate-post-date: rgba(30, 55, 70, 0.4);
--footnote-target-bg: lightcyan;
--tag-bg: rgba(0, 0, 0, 0.075); --tag-bg: rgba(0, 0, 0, 0.075);
--tag-border: #dee2e6; --tag-border: #dee2e6;
--tag-shadow: var(--btn-border-color); --tag-shadow: var(--btn-border-color);
--tag-hover: rgb(222, 226, 230); --tag-hover: rgb(222, 226, 230);
--tb-odd-bg: #fbfcfd;
--tb-border-color: #eaeaea;
--categories-hover-bg: var(--btn-border-color); --categories-hover-bg: var(--btn-border-color);
--dash-color: silver; --dash-color: silver;
@@ -72,6 +74,5 @@
/* Footer */ /* Footer */
--footer-bg-color: #ffffff; --footer-bg-color: #ffffff;
--footnote-target-bg: lightcyan;
--footer-link: #424242; --footer-link: #424242;
} // light-scheme } // light-scheme

View File

@@ -1,7 +1,7 @@
/*! /*!
* The styles for Jekyll theme Chirpy * The styles for Jekyll theme Chirpy
* *
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy) * Chirpy v4.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */
@@ -12,6 +12,7 @@
"addon/module", "addon/module",
"addon/variables", "addon/variables",
"variables-hook",
"addon/syntax", "addon/syntax",
"addon/commons", "addon/commons",

View File

@@ -3,27 +3,24 @@
*/ */
.pagination { .pagination {
font-size: 1rem; color: var(--btn-patinator-text-color);
font-family: 'Lato', sans-serif;
a:hover { a:hover {
text-decoration: none; text-decoration: none;
} }
.page-item { .page-item {
.page-link { .page-link {
color: var(--btn-patinator-text-color); color: inherit;
width: 2.5rem; width: 2.5rem;
height: 2.5rem; height: 2.5rem;
padding: 0; padding: 0;
text-align: center;
display: -webkit-box; display: -webkit-box;
display: flex;
-webkit-box-pack: center; -webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center; -webkit-box-align: center;
align-items: center;
border-radius: 50%; border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color); border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg); background-color: var(--button-bg);
&:hover { &:hover {
background-color: var(--btn-paginator-hover-color); background-color: var(--btn-paginator-hover-color);
@@ -49,9 +46,6 @@
&:last-child .page-link { &:last-child .page-link {
border-radius: 50%; border-radius: 50%;
} }
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item } // .page-item
} // .pagination } // .pagination
@@ -116,7 +110,15 @@
/* Hide SideBar and TOC */ /* Hide SideBar and TOC */
@media all and (max-width: 830px) { @media all and (max-width: 830px) {
.pagination { .pagination {
justify-content: center; justify-content: space-evenly;
.page-item {
&:not(:first-child):not(:last-child) {
display: none;
}
}
} }
} }
@@ -144,11 +146,24 @@
.pagination { .pagination {
font-size: 0.85rem; font-size: 0.85rem;
.page-item .page-link {
width: 2.2rem; .page-item {
height: 2.2rem; &:not(:last-child) {
margin-right: 0.7rem;
}
.page-link {
width: 2rem;
height: 2rem;
}
} }
}
.page-index {
display: none;
}
} // .pagination
} }

View File

@@ -23,24 +23,12 @@
padding-right: $pr; padding-right: $pr;
} }
.timeago::before {
content: attr(prefix);
}
#post-wrapper .post-meta { #post-wrapper .post-meta {
> div:nth-child(2) { > div:nth-child(2) {
> span:not(:first-child)::before { > span:not(:first-child)::before {
@include dot; @include dot;
} }
} }
#pv::after {
content: " views";
}
.readtime::after {
content: " read";
}
} }
.post-content { .post-content {
@@ -311,16 +299,6 @@
margin-top: 1rem; margin-top: 1rem;
} }
} }
.post-content > div[class^='language-'] {
@include ml-mr(-1.25rem);
border-radius: 0;
&::before { // the lang badge
right: 1rem;
}
}
} }
@media all and (max-width: 768px) { @media all and (max-width: 768px) {

View File

@@ -0,0 +1,3 @@
/*
Appending custom SCSS variables will override the default ones in `_sass/addon/variables.scsss`
*/

View File

@@ -11,11 +11,23 @@ redirect_from:
dynamic_title: true dynamic_title: true
--- ---
{% include lang.html %}
<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> {%- capture _head_back -%}
<a href="{{ '/' | relative_url }}">Head back Home</a> <a href="{{ '/' | relative_url }}">{{ site.data.locales[lang].not_found.head_back }}</a>
to try finding it again, or search for it on the {%- endcapture -%}
<a href="{{ 'archives' | relative_url }}">Archives page</a>.
{%- capture _archives_page -%}
<a href="{{ 'archives' | relative_url }}">{{ site.data.locales[lang].not_found.archives_page }}</a>
{%- endcapture -%}
<p>{{site.data.locales[lang].not_found.statment }}</p>
<p>{{ site.data.locales[lang].not_found.hint_template
| replace: ':HEAD_BAK', _head_back
| replace: ':ARCHIVES_PAGE', _archives_page }}
</p> </p>
</div> </div>

View File

@@ -1,7 +1,12 @@
--- ---
--- ---
// see: /_sass/addon/commons.scss /*
If the number of TAB files has changed, the following variable is required.
And it must be defined before `@import`.
*/
$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab $tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
@import "jekyll-theme-chirpy"; @import "{{ site.theme }}";
/* append your custom style below */

View File

@@ -15,7 +15,7 @@ permalink: /feed.xml
<uri>{{ "/" | absolute_url }}</uri> <uri>{{ "/" | absolute_url }}</uri>
</author> </author>
<link rel="self" type="application/atom+xml" href="{{ page.url | absolute_url }}"/> <link rel="self" type="application/atom+xml" href="{{ page.url | absolute_url }}"/>
<link rel="alternate" type="text/html" hreflang="{{ site.lang | default: 'en' }}" <link rel="alternate" type="text/html" hreflang="{{ site.lang }}"
href="{{ '/' | absolute_url }}"/> href="{{ '/' | absolute_url }}"/>
<generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator> <generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
<rights> © {{ 'now' | date: '%Y' }} {{ site.social.name }} </rights> <rights> © {{ 'now' | date: '%Y' }} {{ site.social.name }} </rights>

View File

@@ -11,7 +11,7 @@ layout: compress
"tags": "{{ post.tags | join: ', ' }}", "tags": "{{ post.tags | join: ', ' }}",
"date": "{{ post.date }}", "date": "{{ post.date }}",
{% include no-linenos.html content=post.content %} {% include no-linenos.html content=post.content %}
"snippet": "{{ content | strip_html | strip_newlines | remove_chars | escape | truncate: 300 | replace: '\', '\\\\' }}" "snippet": "{{ content | strip_html | strip_newlines | remove_chars | escape | replace: '\', '\\\\' }}"
}{% unless forloop.last %},{% endunless %} }{% unless forloop.last %},{% endunless %}
{% endfor %} {% endfor %}
] ]

View File

@@ -1,5 +1,5 @@
/*! /*!
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v4.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -1,5 +1,5 @@
/*! /*!
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v4.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v4.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */
$(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(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),i=$("#search-results"),d=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),h={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")}},f=function(){let e=!1;return{on(){e||(u.block(),r.removeClass("unloaded"),s.addClass("unloaded"),e=!0)},off(){e&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),a.removeClass("visible"),s.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible:()=>e}}();function p(){return o.hasClass("loaded")}t.click(function(){h.on(),f.on(),d.focus()}),o.click(function(){h.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?p()?c.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),p()&&c.addClass("unloaded"))}),a.on("click",function(){d.val(""),p()?(c.removeClass("unloaded"),i.empty()):f.off(),d.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,l=0;const n=5,r=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(s=!0)}),setInterval(function(){s&&(!function(){var s=$(this).scrollTop();Math.abs(l-s)<=n||(s>l&&s>r?(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")),l=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){let t=$(this).children("i"),o=t.text();$(this).text(function(t,o){let a=new Date,s=new Date(t),l=void 0!==o?`${o} `:"";if(s.getFullYear()!==a.getFullYear())return e-=1,l+s.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric"});if(s.getMonth()!==a.getMonth())return e-=1,l+s.toLocaleString("en-US",{month:"short",day:"numeric"});let n=Math.floor((a-s)/1e3),r=Math.floor(n/86400);if(r>=1)return e-=1,r+" day"+(r>1?"s":"")+" ago";let i=Math.floor(n/3600);if(i>=1)return i+" hour"+(i>1?"s":"")+" ago";let d=Math.floor(n/60);return d>=1?d+" minute"+(d>1?"s":"")+" ago":"just now"}(o,$(this).attr("prep"))),$(this).append(t)}}),0===e&&void 0!==t&&clearInterval(t),e}0!==e&&o()>0&&(t=setInterval(o,6e4))}); $(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(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),l=$("#main"),n=$("#topbar-title"),s=$("#search-wrapper"),r=$("#search-result-wrapper"),i=$("#search-results"),d=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),p={on(){e.addClass("unloaded"),n.addClass("unloaded"),t.addClass("unloaded"),s.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),s.removeClass("d-flex"),e.removeClass("unloaded"),n.removeClass("unloaded"),t.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),r.removeClass("unloaded"),l.addClass("unloaded"),e=!0)},off(){e&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),a.removeClass("visible"),l.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible:()=>e}}();function h(){return o.hasClass("loaded")}t.click(function(){p.on(),f.on(),d.focus()}),o.click(function(){p.off(),f.off()}),d.focus(function(){s.addClass("input-focus")}),d.focusout(function(){s.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?h()?c.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),h()&&c.addClass("unloaded"))}),a.on("click",function(){d.val(""),h()?(c.removeClass("unloaded"),i.empty()):f.off(),d.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 l,n=0;const s=5,r=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(l=!0)}),setInterval(function(){l&&(!function(){var l=$(this).scrollTop();Math.abs(n-l)<=s||(l>n&&l>r?(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()):l+$(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=l)}(),l=!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;const o=$("meta[name=day-prompt]").attr("content"),a=$("meta[name=hour-prompt]").attr("content"),l=$("meta[name=minute-prompt]").attr("content"),n=$("meta[name=justnow-prompt]").attr("content");function s(){return $(".timeago").each(function(){if($(this).children("i").length>0){let t=$(this).clone().children().remove().end().text(),s=$(this).children("i"),r=s.text();$(this).text(function(t,s){let r=new Date,i=new Date(t);if(i.getFullYear()!==r.getFullYear()||i.getMonth()!==r.getMonth())return s;let d=Math.floor((r-i)/1e3),c=Math.floor(d/86400);if(c>=1)return e-=1,` ${c} ${o}`;let u=Math.floor(d/3600);if(u>=1)return` ${u} ${a}`;let $=Math.floor(d/60);return $>=1?` ${$} ${l}`:n}(r,t)),$(this).append(s)}}),0===e&&void 0!==t&&clearInterval(t),e}0!==e&&s()>0&&(t=setInterval(s,6e4))});

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v4.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 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(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),i=$("#search-result-wrapper"),c=$("#search-results"),d=$("#search-input"),r=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),i.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(c.empty(),r.hasClass("unloaded")&&r.removeClass("unloaded"),i.addClass("unloaded"),s.removeClass("visible"),a.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible:()=>e}}();function h(){return t.hasClass("loaded")}o.click(function(){p.on(),f.on(),d.focus()}),t.click(function(){p.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?h()?r.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),s.hasClass("visible")||s.addClass("visible"),h()&&r.addClass("unloaded"))}),s.on("click",function(){d.val(""),h()?(r.removeClass("unloaded"),c.empty()):f.off(),d.focus(),s.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"),t=$(".access"),s=$("#search-input");let a,l=0;const n=5,i=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>i?(e.removeClass("topbar-down").addClass("topbar-up"),o.length>0&&o.removeClass("topbar-down"),t.length>0&&t.removeClass("topbar-down"),s.is(":focus")&&s.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),o.length>0&&o.addClass("topbar-down"),t.length>0&&t.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),t=e.text().trim();let s=o.length>0?o.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||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==s&&e.text(s):e.text()!==t&&e.text(t)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(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="#main > div.row:first-child > div:first-child";if($(`${e} img`).length<=0)return;const o=document.querySelectorAll(`${e} img[data-src]`);lozad(o).observe(),$(`${e} p > img[data-src],${e} img[data-src].preview-img`).each(function(){let e=$(this).next();const o="EM"===e.prop("tagName")?e.text():"",t=$(this).attr("data-src");$(this).wrap(`<a href="${t}" title="${o}" class="popup"></a>`)}),$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),$(`${e} a`).has("img").addClass("img-link")}); $(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(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),i=$("#search-result-wrapper"),r=$("#search-results"),c=$("#search-input"),d=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),p={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")}},f=function(){let e=!1;return{on(){e||(u.block(),i.removeClass("unloaded"),s.addClass("unloaded"),e=!0)},off(){e&&(r.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),i.addClass("unloaded"),a.removeClass("visible"),s.removeClass("unloaded"),u.release(),c.val(""),e=!1)},isVisible:()=>e}}();function h(){return o.hasClass("loaded")}t.click(function(){p.on(),f.on(),c.focus()}),o.click(function(){p.off(),f.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()?d.removeClass("unloaded"):f.off():""!==c.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),h()&&d.addClass("unloaded"))}),a.on("click",function(){c.val(""),h()?(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,l=0;const n=5,i=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(s=!0)}),setInterval(function(){s&&(!function(){var s=$(this).scrollTop();Math.abs(l-s)<=n||(s>l&&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")),l=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(){$("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="#main > div.row:first-child > div:first-child";if($(`${e} img`).length<=0)return;const t=document.querySelectorAll(`${e} img[data-src]`);lozad(t).observe(),$(`${e} p > img[data-src],${e} img[data-src].preview-img`).each(function(){let e=$(this).next();const t="EM"===e.prop("tagName")?e.text():"",o=$(this).attr("data-src");$(this).wrap(`<a href="${o}" title="${t}" class="popup"></a>`)}),$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),$(`${e} a`).has("img").addClass("img-link")}),$(function(){const e="fas fa-check",t="locked",o=2e3,a=new ClipboardJS(".code-header>button",{target:e=>e.parentNode.nextElementSibling});$(".code-header>button").tooltip({trigger:"click",placement:"left"});const s=$(".code-header>button").children().attr("class");a.on("success",a=>{a.clearSelection(),function(e){return"true"===$(e).attr(t)}(a.trigger)||(function(e){$(e).tooltip("hide").tooltip("show")}(a.trigger),function(e){setTimeout(function(){$(e).tooltip("hide")},o)}(a.trigger),function(o){let a=$(o),s=a.children();a.attr(t,!0),s.attr("class",e)}(a.trigger),function(e){let a=$(e),l=a.children();setTimeout(function(){a.removeAttr(t),l.attr("class",s)},o)}($(a.trigger)))})});

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
/*! /*!
* Chirpy v4.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v4.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -1,8 +0,0 @@
/*!
disqusLoader.js v1.0
A JavaScript plugin for lazy-loading Disqus comments widget.
-
By Osvaldas Valutis, www.osvaldas.info
Available for use under the MIT License
*/
(function(e,g,h,d){var a=e(g),k=function(o,n){var q,p;return function(){var t=this,s=arguments,r=+new Date;q&&r<q+o?(clearTimeout(p),p=setTimeout(function(){q=r,n.apply(t,s)},o)):(q=r,n.apply(t,s))}},m=false,j=false,i=false,c=false,f="unloaded",b=e(),l=function(){if(!b.length||b.data("disqusLoaderStatus")=="loaded"){return true}var n=a.scrollTop();if(b.offset().top-n>a.height()*j||n-b.offset().top-b.outerHeight()-(a.height()*j)>0){return true}e("#disqus_thread").removeAttr("id");b.attr("id","disqus_thread").data("disqusLoaderStatus","loaded");if(f=="loaded"){DISQUS.reset({reload:true,config:i})}else{g.disqus_config=i;if(f=="unloaded"){f="loading";e.ajax({url:c,async:true,cache:true,dataType:"script",success:function(){f="loaded"}})}}};a.on("scroll resize",k(m,l));e.disqusLoader=function(o,n){n=e.extend({},{laziness:1,throttle:250,scriptUrl:false,disqusConfig:false},n);j=n.laziness+1;m=n.throttle;i=n.disqusConfig;c=c===false?n.scriptUrl:c;b=(typeof o=="string"?e(o):o).eq(0);b.data("disqusLoaderStatus","unloaded");l()}})(jQuery,window,document);

View File

@@ -1,21 +1,44 @@
# Chirpy <div align="right">
<a href="https://github.com/cotes2020/jekyll-theme-chirpy#readme">EN</a> |
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md">中文 (简体)</a>
</div>
Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) | 简体中文 <div align="center">
<h1>Chirpy Jekyll Theme</h1>
<p>
<a href="https://rubygems.org/gems/jekyll-theme-chirpy">
<img alt="Gem Version" src="https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen"></img>
</a>
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush">
<img alt="Build Status" src="https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push"></img>
</a>
<a href="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">
<img alt="Codacy Badge" src="https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b"></img>
</a>
<a href="https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE">
<img alt="GitHub license" src="https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg"></img>
</a>
<a href="https://996.icu">
<img alt="996.icu" src="https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg"></img>
</a>
</p>
</div>
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy) 一个采用了最简化、侧边栏、响应式设计的 Jekyll 主题,专注于文本展示,旨在帮助您轻松地记录和分享知识。
[![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)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
一个不一样的 Jekyll 主题,采用响应式设计,方便记录、管理、分享您的知识和经验。[懂的进 »](https://chirpy.cotes.info) [在线体验 »](https://chirpy.cotes.info)
[![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info) <p align="center">
<a href="https://chirpy.cotes.info">
<img alt="Devices Mockup" src="https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png"></img>
</a>
</p>
## 功能一览 ## 功能一览
- 本地化外观语言
- 可配置的主题颜色
- 文章置顶 - 文章置顶
- 可配置的全局主题颜色
- 文章最后修改日期 - 文章最后修改日期
- 文章目录 - 文章目录
- 自动推荐相关文章 - 自动推荐相关文章
@@ -34,17 +57,16 @@ Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) |
## 前提要求 ## 前提要求
参考 [Jekyll Docs](https://jekyllrb.com/docs/installation/) 安装 `Ruby``RubyGems``Jekyll``Bundler`Docker 粉可免。 参考 [Jekyll Docs](https://jekyllrb.com/docs/installation/) 安装 `Ruby``RubyGems``Jekyll``Bundler`。需要注意的是,`Ruby` 的版本必须与主题在 [RubyGems.org](https://rubygems.org/gems/jekyll-theme-chirpy) 上的要求一致.
## 安装 ## 安装
有二法可得此主题: 有二法可得此主题:
- **从 RubyGems 安装** - 易于版本升级,隔离无关的主题项目文件,让您的仓库舒适清爽。 - **[从 RubyGems 安装](#从-rubygems-安装)** - 易于版本升级,隔离无关的主题项目文件,让您的仓库舒适清爽。
- **从 GitHub 上 Fork** - 对个性化二次开发友好,但是难于升级,只适合专业开发人员使用。 - **[从 GitHub 上 Fork](#从-github-上-fork)** - 对个性化二次开发友好,但是难于升级,只适合专业开发人员使用。
### RubyGems 安装 ### RubyGems 安装
在您的 Jekyll 站点的 `Gemfile` 添加: 在您的 Jekyll 站点的 `Gemfile` 添加:
@@ -64,17 +86,22 @@ theme: jekyll-theme-chirpy
$ bundle $ bundle
``` ```
最后, 拷贝额外所需主题的 gem 文件(详见 [starter 项目][starter] 的文件目录)至您的 Jekyll 站点, 然后把主题的 `_config.yml` 全部内容附加到您的 Jekyll 站点的同名文件。 然后,进入主题的 gem 目录:
> **提示**: 定位主题的 gem 文件,可以执行:
>
```console ```console
$ bundle info --path jekyll-theme-chirpy $ cd "$(bundle info --path jekyll-theme-chirpy)"
``` ```
或者您可以 [使用 starter template][use-starter] 来快速创建 Jekyll 站点,以省去复制主题 gem 文件的时间 拷贝运行站点所需主题的 gem 文件(详见 [starter 仓库][starter] 的文件目录)至您的 Jekyll 站点, 然后把主题的 `_config.yml` 全部内容附加到您的 Jekyll 站点的同名文件
### 在 GitHub 上 Fork > ⚠️ **留意重叠的文件!**
>
> 如果您的网站是通过命令 `jekyll new` 创建的,那么站点的根目录会存在文件 `index.markdown` 和 `about.markdown`。 请务必删除它们, 否则在网站构建后将覆盖主题的 `index.html` 和 `_tabs/about.html`,引起空白或错乱的页面出现。
作为替代方案,同时也被我们力荐,您可以 [使用 starter template][use-starter] 来快速创建 Jekyll 站点,以省去复制主题 gem 文件的时间。那里早已为您准备好建站需要的一切!
### 从 GitHub 上 Fork
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) 然后克隆到本地。(友情提示:默认分支的代码处于开发状态,如果您想博客更加稳定,请切换到最新的 [Tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags) 开始写作。) [Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) 然后克隆到本地。(友情提示:默认分支的代码处于开发状态,如果您想博客更加稳定,请切换到最新的 [Tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags) 开始写作。)
@@ -114,6 +141,12 @@ $ bash tools/init.sh
- `timezone` - `timezone`
- `lang` - `lang`
### 自定义样式
如果您需要自定义样式, 拷贝主题的文件 `assets/css/style.scss` 到您站点的相同路径上,然后在该文件末尾添加样式。
`v4.1.0` 起,如果您想覆盖文件 `_sass/addon/variables.scss` 里定义的 SASS 变量的默认值,新建文件 `_sass/variables-hook.scss`,然后重写您需要的变量即可。
### 本地运行 ### 本地运行
发布之前,在本地预览: 发布之前,在本地预览:
@@ -182,7 +215,7 @@ $ docker run -it --rm \
## 文档 ## 文档
若想要更多细节以及更佳的阅读体验,请参阅 [线上教程](https://chirpy.cotes.info/categories/tutorial/)。 与此同时,[Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki) 也有一份教程的拷贝。 若想要更多细节以及更佳的阅读体验,请参阅 [线上教程](https://chirpy.cotes.info/categories/tutorial/)。 与此同时,[Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki) 也有一份教程的拷贝。请注意Demo 网站和 Wiki 上的文档都是基于最新的发行版本,而 `master` 分支的功能往往领先于现有文档。
## 参与贡献 ## 参与贡献

View File

@@ -45,9 +45,8 @@ const postJs = () => {
`${JS_SRC}/commons/*.js`, `${JS_SRC}/commons/*.js`,
`${JS_SRC}/utils/img-extra.js`, `${JS_SRC}/utils/img-extra.js`,
`${JS_SRC}/utils/timeago.js`, `${JS_SRC}/utils/timeago.js`,
`${JS_SRC}/utils/lang-badge.js`,
`${JS_SRC}/utils/checkbox.js`, `${JS_SRC}/utils/checkbox.js`,
`${JS_SRC}/utils/copy-link.js`, `${JS_SRC}/utils/clipboard.js`,
// 'smooth-scroll.js' must be called after ToC is ready // 'smooth-scroll.js' must be called after ToC is ready
`${JS_SRC}/utils/smooth-scroll.js` `${JS_SRC}/utils/smooth-scroll.js`
], 'post' ], 'post'
@@ -67,7 +66,7 @@ const pageJs = () => {
`${JS_SRC}/commons/*.js`, `${JS_SRC}/commons/*.js`,
`${JS_SRC}/utils/checkbox.js`, `${JS_SRC}/utils/checkbox.js`,
`${JS_SRC}/utils/img-extra.js`, `${JS_SRC}/utils/img-extra.js`,
`${JS_SRC}/utils/copy-link.js`, `${JS_SRC}/utils/clipboard.js`
], 'page' ], 'page'
); );
}; };

View File

@@ -2,7 +2,7 @@
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "jekyll-theme-chirpy" spec.name = "jekyll-theme-chirpy"
spec.version = "4.0.2" spec.version = "4.2.0"
spec.authors = ["Cotes Chung"] spec.authors = ["Cotes Chung"]
spec.email = ["cotes.chung@gmail.com"] spec.email = ["cotes.chung@gmail.com"]

View File

@@ -1,6 +1,6 @@
{ {
"name": "jekyll-theme-chirpy", "name": "jekyll-theme-chirpy",
"version": "4.0.2", "version": "4.2.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

@@ -2,29 +2,32 @@
# #
# How does it work: # How does it work:
# #
# 1. Bump latest version number to files: # 1. Cherry pick the latest commit from default branch
# to the target release branch if the target release branch already existed.
#
# 2. Bump latest version number to the following files:
#
# - _sass/jekyll-theme-chirpy.scss # - _sass/jekyll-theme-chirpy.scss
# - _javascript/copyright # - _javascript/copyright
# - assets/js/dist/*.js (will be built by gulp later) # - assets/js/dist/*.js (will be built by gulp later)
# - jekyll-theme-chirpy.gemspec # - jekyll-theme-chirpy.gemspec
# - package.json # - package.json
# #
# 2. Create a git-tag on release branch # 3. Create a git-tag on release branch
# #
# 3. Build a RubyGems package base on the latest git-tag # 4. Build a RubyGems package base on the latest git-tag
# #
# #
# Usage: # Usage:
# #
# Switch to 'master' branch or 'X-Y-stable' branch with argument '-m', # Run on default branch, if run on other branch requires parameter '-m' (manual mode).
#` and then run this script.
# #
# #
# Requires: Git, Gulp, RubyGems # Requires: Git, Gulp, RubyGems
set -eu set -eu
manual_release=false opt_manual=false
ASSETS=( ASSETS=(
"_sass/jekyll-theme-chirpy.scss" "_sass/jekyll-theme-chirpy.scss"
@@ -35,6 +38,10 @@ GEM_SPEC="jekyll-theme-chirpy.gemspec"
NODE_META="package.json" NODE_META="package.json"
DEFAULT_BRANCH="master"
_working_branch="$(git branch --show-current)"
_check_src() { _check_src() {
if [[ ! -f $1 && ! -d $1 ]]; then if [[ ! -f $1 && ! -d $1 ]]; then
echo -e "Error: Missing file \"$1\"!\n" echo -e "Error: Missing file \"$1\"!\n"
@@ -48,8 +55,8 @@ check() {
exit -1 exit -1
fi fi
# ensure the current branch is 'master' or running in 'manual' mode # ensure working on default branch or running in 'manual' mode
if [[ "$(git branch --show-current)" != "master" && $manual_release == "false" ]]; then if [[ $_working_branch != $DEFAULT_BRANCH && $opt_manual == "false" ]]; then
echo "Error: This operation must be performed on the 'master' branch or '--manual' mode!" echo "Error: This operation must be performed on the 'master' branch or '--manual' mode!"
exit -1 exit -1
fi fi
@@ -100,6 +107,7 @@ release() {
_version="$1" _version="$1"
_major="" _major=""
_minor="" _minor=""
_new_release_branch=false
IFS='.' read -r -a array <<< "$_version" IFS='.' read -r -a array <<< "$_version"
@@ -115,18 +123,15 @@ release() {
_release_branch="$_major-$_minor-stable" _release_branch="$_major-$_minor-stable"
if $manual_release; then if ! $opt_manual; then
echo -e "Bump version to $_version (manual release)\n" if [[ -z $(git branch -v | grep "$_release_branch") ]]; then
bump "$_version" git checkout -b "$_release_branch"
exit 0 _new_release_branch=true
fi else
git checkout "$_release_branch"
if [[ -z $(git branch -v | grep "$_release_branch") ]]; then # cherry-pick the latest commit from master branch to release branch
git checkout -b "$_release_branch" git cherry-pick "$(git rev-parse $DEFAULT_BRANCH)"
else fi
git checkout "$_release_branch"
# cherry-pick the latest commit from master branch to release branch
git cherry-pick "$(git rev-parse master)"
fi fi
echo -e "Bump version to $_version\n" echo -e "Bump version to $_version\n"
@@ -138,10 +143,14 @@ release() {
echo -e "Build the gem pakcage for v$_version\n" echo -e "Build the gem pakcage for v$_version\n"
build_gem build_gem
# head back to master branch # head back to working branch
git checkout master git checkout "$_working_branch"
# cherry-pick the latest commit from release branch to master branch
git cherry-pick "$_release_branch" -x if [[ $_working_branch == $DEFAULT_BRANCH ]]; then
if $_new_release_branch; then
git merge "$_release_branch"
fi
fi
} }
@@ -185,7 +194,7 @@ while (($#)); do
opt="$1" opt="$1"
case $opt in case $opt in
-m | --manual) -m | --manual)
manual_release=true opt_manual=true
shift shift
;; ;;
-h | --help) -h | --help)

View File

@@ -7,7 +7,6 @@
# Usage: bash /path/to/test.sh [indicated path] # Usage: bash /path/to/test.sh [indicated path]
DEST=_site DEST=_site
URL_IGNORE=cdn.jsdelivr.net
_build=false _build=false
@@ -62,6 +61,4 @@ fi
bundle exec htmlproofer "$DEST" \ bundle exec htmlproofer "$DEST" \
--disable-external \ --disable-external \
--check-html \ --check-html \
--empty_alt_ignore \ --allow_hash_href
--allow_hash_href \
--url_ignore $URL_IGNORE