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

Compare commits

...

18 Commits

Author SHA1 Message Date
Cotes Chung
82856b9cb6 Bump version to 3.1.1 2021-02-05 02:07:35 +08:00
Cotes Chung
a201adeacb Add a modification to Gemfile.lock in bump tool 2021-02-05 01:57:41 +08:00
Cotes Chung
d948f84f99 Fix search results slow scrolling (#273)
also:
- improve its responsive design
- fix the js path in gulp
2021-02-05 01:56:47 +08:00
Cotes Chung
665a26e079 Hide empty categries/tags in search (#273) 2021-02-05 01:35:05 +08:00
Cotes Chung
d7443aad5d Bump version to 3.1.0 2021-02-03 01:42:10 +08:00
Cotes Chung
b2beaa0f4c Update travis settings for release-branches
- drop the deprecated flag `--deployment` of bundle (so we have to specify the bundler caching path)
2021-02-03 00:46:36 +08:00
Cotes Chung
83a7878043 Improved bump tool to fit the release branches 2021-02-02 21:56:17 +08:00
Cotes Chung
94b99350fc Restore the prompt in the page nav button in the latest/oldest articles 2021-02-02 21:56:17 +08:00
Cotes Chung
6dc9cdfa25 Reduce the font size of the Disqus prompt 2021-02-02 21:56:17 +08:00
Cotes Chung
fa56ea48c3 Improve docs 2021-02-02 21:56:17 +08:00
dependabot-preview[bot]
7d3e25c90d Bump tzinfo-data from 1.2020.6 to 1.2021.1 (#272)
Bumps [tzinfo-data](https://github.com/tzinfo/tzinfo-data) from 1.2020.6 to 1.2021.1.
- [Release notes](https://github.com/tzinfo/tzinfo-data/releases)
- [Commits](https://github.com/tzinfo/tzinfo-data/compare/v1.2020.6...v1.2021.1)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-02-01 19:33:45 +08:00
Cotes Chung
6c9ab6e5f8 Fix gemfile 2021-02-01 18:03:27 +08:00
Cotes Chung
91da99282d Add lang option to the site config sample 2021-02-01 17:38:50 +08:00
Cotes Chung
413a86277b Generate the breadcrumb by Liquid
also subtracted '/tabs/' from the tabs path
2021-01-31 22:06:10 +08:00
Cotes Chung
1879b94f3d Exclude gem-spec from output 2021-01-30 05:28:33 +08:00
Cotes Chung
7b5f7086b7 Fix post feature image style 2021-01-30 03:12:43 +08:00
Cotes Chung
a8b8a379f6 Improve the docs
- Add missing url references in the tutorial
- Add gem version badge in README
2021-01-30 02:00:34 +08:00
Bogdan Stoica
eacad65cbb Add alt attribute to the post's preview image (#271) 2021-01-30 01:14:03 +08:00
31 changed files with 303 additions and 210 deletions

View File

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

View File

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

13
Gemfile
View File

@@ -1,15 +1,8 @@
# frozen_string_literal: true
source "https://rubygems.org" source "https://rubygems.org"
gem "jekyll", "~> 4.1" gemspec
# plugins
group :jekyll_plugins do
gem "jekyll-paginate", "~> 1.1"
gem "jekyll-redirect-from", "~> 0.16"
gem "jekyll-seo-tag", "~> 2.7"
gem "jekyll-archives", "~> 2.2"
gem "jekyll-sitemap", "~> 1.4"
end
group :test do group :test do
gem "html-proofer", "~> 3.18" gem "html-proofer", "~> 3.18"

View File

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

View File

@@ -2,9 +2,10 @@
Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md) Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md)
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy)
[![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush) [![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg?color=blue)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation. Designed to help you record and share your knowledge easily. [Live Demo »](https://chirpy.cotes.info) A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation. Designed to help you record and share your knowledge easily. [Live Demo »](https://chirpy.cotes.info)
@@ -49,10 +50,10 @@ Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete th
There are two ways to get the theme: There are two ways to get the theme:
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy) - **Install from RubyGems** - Easy to upgrade, isolate irrelevant project files so you can focus on writing.
- Fork from GitHub - **Fork from GitHub** - Convenient for custom development, but difficult to upgrade, only suitable for web developers.
### Install From Rubygems ### Install From RubyGems
Add this line to your Jekyll site's `Gemfile`: Add this line to your Jekyll site's `Gemfile`:
@@ -72,15 +73,15 @@ And then execute:
$ bundle $ bundle
``` ```
Finally, copy the extra files (refer to the [starter project][starter] for the detailed file directory structure) from the theme's gem to your Jekyll site, and append all the variables of the theme's `_config.yml` to your Jekyll site. Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
> **Hint**: To locate the themes gem, execute: > **Hint**: To locate the installed themes gem, execute:
> >
```console ```console
$ bundle info --path jekyll-theme-chirpy $ bundle info --path jekyll-theme-chirpy
``` ```
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem. Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from theme's gem. We have prepared everything for you there!
### Fork From GitHub ### Fork From GitHub
@@ -120,7 +121,7 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
- `url` - `url`
- `avatar` - `avatar`
- `timezone` - `timezone`
- `theme_mode` - `lang`
### Running Local Server ### Running Local Server
@@ -153,12 +154,12 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
Quickly check the files needed for GitHub Actions build: Quickly check the files needed for GitHub Actions build:
1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. - Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site. - Ensuer your Jekyll site has file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub. And then rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
And then publish your Jekyll site by: Now publish your Jekyll site by:
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files. 1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
@@ -218,5 +219,6 @@ This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chi
[starter]: https://github.com/cotes2020/chirpy-starter [starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate [use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook [workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
[jb]:https://www.jetbrains.com/?from=jekyll-theme-chirpy [jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy

View File

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

View File

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

View File

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

View File

@@ -1,13 +1,14 @@
<!-- <!--
Jekyll Simple Search loader Jekyll Simple Search loader
See: <https://github.com/christian-fei/Simple-Jekyll-Search>
--> -->
{% capture result_elem %} {% capture result_elem %}
<div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0"> <div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0">
<a href="{{ site.url }}{url}">{title}</a> <a href="{{ site.url }}{url}">{title}</a>
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1"> <div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>{categories}</div> {categories}
<div><i class="fa fa-tag fa-fw"></i>{tags}</div> {tags}
</div> </div>
<p>{snippet}</p> <p>{snippet}</p>
</div> </div>
@@ -23,6 +24,23 @@ SimpleJekyllSearch({
resultsContainer: document.getElementById('search-results'), resultsContainer: document.getElementById('search-results'),
json: '{{ '/assets/js/data/search.json' | relative_url }}', json: '{{ '/assets/js/data/search.json' | relative_url }}',
searchResultTemplate: '{{ result_elem | strip_newlines }}', searchResultTemplate: '{{ result_elem | strip_newlines }}',
noResultsText: '{{ not_found }}' noResultsText: '{{ not_found }}',
templateMiddleware: function(prop, value, template) {
if (prop === 'categories') {
if (value === '') {
return `${value}`;
} else {
return `<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
}
}
if (prop === 'tags') {
if (value === '') {
return `${value}`;
} else {
return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
}
}
}
}); });
</script> </script>

View File

@@ -2,7 +2,7 @@
The Search results The Search results
--> -->
<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-xl-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.label.panel.trending_tags | default: 'Trending Tags' }}</h4>

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,8 @@ categories: [Blogging, Demo]
tags: [typography] tags: [typography]
math: true math: true
mermaid: true mermaid: true
image: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png image:
src: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
--- ---
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography. This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.

View File

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

View File

@@ -15,10 +15,10 @@ Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete th
There are two ways to get the theme: There are two ways to get the theme:
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy) - **Install from RubyGems** - Easy to upgrade, isolate irrelevant project files so you can focus on writing.
- Fork from GitHub - **Fork from GitHub** - Convenient for custom development, but difficult to upgrade, only suitable for web developers.
### Install From Rubygems ### Install From RubyGems
Add this line to your Jekyll site's `Gemfile`: Add this line to your Jekyll site's `Gemfile`:
@@ -38,15 +38,15 @@ And then execute:
$ bundle $ bundle
``` ```
Finally, copy the extra files (refer to the [starter project][starter] for the detailed file directory structure) from the theme's gem to your Jekyll site, and append all the variables of the theme's `_config.yml` to your Jekyll site. Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
> **Hint**: To locate the themes gem, execute: > **Hint**: To locate the installed themes gem, execute:
> >
```console ```console
$ bundle info --path jekyll-theme-chirpy $ bundle info --path jekyll-theme-chirpy
``` ```
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem. Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from theme's gem. We have prepared everything for you there!
### Fork From GitHub ### Fork From GitHub
@@ -69,7 +69,6 @@ $ bash tools/init.sh
What it does is: What it does is:
1. Remove some files or directories from your repository: 1. Remove some files or directories from your repository:
- `.travis.yml` - `.travis.yml`
- files under `_posts` - files under `_posts`
- folder `docs` - folder `docs`
@@ -78,7 +77,6 @@ What it does is:
3. Automatically create a commit to save the changes. 3. Automatically create a commit to save the changes.
## Usage ## Usage
### Configuration ### Configuration
@@ -88,7 +86,7 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
- `url` - `url`
- `avatar` - `avatar`
- `timezone` - `timezone`
- `theme_mode` - `lang`
### Running Local Server ### Running Local Server
@@ -121,12 +119,12 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
Quickly check the files needed for GitHub Actions build: Quickly check the files needed for GitHub Actions build:
1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. - Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site. - Ensuer your Jekyll site has file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub. And then rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
And then publish your Jekyll site by: Now publish your Jekyll site by:
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files. 1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
@@ -157,3 +155,7 @@ $ docker run -it --rm \
``` ```
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server. Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook

View File

@@ -811,9 +811,6 @@ $sidebar-display: "sidebar-display";
#search-result-wrapper { #search-result-wrapper {
display: none; display: none;
position: fixed;
top: 0;
padding-top: 3rem;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
.post-content { .post-content {
@@ -1257,6 +1254,10 @@ $sidebar-display: "sidebar-display";
min-width: 150px; min-width: 150px;
} }
#search-result-wrapper {
margin-top: 3rem;
}
div.post-content .table-wrapper > table { div.post-content .table-wrapper > table {
min-width: 70%; min-width: 70%;
} }
@@ -1311,10 +1312,6 @@ $sidebar-display: "sidebar-display";
left: 210px; left: 210px;
} }
#search-result-wrapper {
width: calc(100% - 210px);
}
#search-results > div { #search-results > div {
max-width: 700px; max-width: 700px;
} }
@@ -1392,10 +1389,6 @@ $sidebar-display: "sidebar-display";
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
} }
#search-result-wrapper {
width: calc(100% - 260px);
}
#search-results > div { #search-results > div {
max-width: 46%; max-width: 46%;
&:nth-child(odd) { &:nth-child(odd) {
@@ -1608,7 +1601,6 @@ $sidebar-display: "sidebar-display";
} }
#search-result-wrapper { #search-result-wrapper {
width: calc(100% - #{$sidebar-width-large});
> div { > div {
max-width: #{$main-content-max-width}; max-width: #{$main-content-max-width};
} }
@@ -1651,7 +1643,7 @@ $sidebar-display: "sidebar-display";
} }
#search-result-wrapper { #search-result-wrapper {
padding-right: calc(100% - #{$sidebar-width-large} - 1530px); padding-right: calc(100% - #{$sidebar-width-large} - 1180px);
} }
#panel-wrapper { #panel-wrapper {

View File

@@ -1,7 +1,7 @@
/*! /*!
* The styles for Jekyll theme Chirpy * The styles for Jekyll theme Chirpy
* *
* Chirpy v3.0.3 (https://github.com/cotes2020/jekyll-theme-chirpy) * Chirpy v3.1.1 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -44,7 +44,7 @@
@include align-center; @include align-center;
margin-top: 0; margin-top: 0;
margin-bottom: 2.5rem; margin-bottom: 2.5rem !important;
} }
} }
@@ -85,6 +85,12 @@
&.btn-outline-primary.disabled:focus { &.btn-outline-primary.disabled:focus {
box-shadow: none; box-shadow: none;
} }
&::before {
color: var(--text-muted-color);
font-size: 0.65rem;
text-transform: uppercase;
content: attr(prompt);
}
} }
p { p {
@@ -95,12 +101,6 @@
} }
a { a {
&::before {
color: var(--text-muted-color);
font-size: 0.65rem;
text-transform: uppercase;
content: attr(prompt);
}
&:first-child { &:first-child {
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
@@ -112,6 +112,7 @@
right: 0.5px; right: 0.5px;
} }
} }
} // .post-navigation } // .post-navigation
@keyframes fade-up { @keyframes fade-up {

View File

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

View File

@@ -17,14 +17,12 @@ $(function() {
const input = $("#search-input"); const input = $("#search-input");
const hints = $("#search-hints"); const hints = $("#search-hints");
/*--- Actions in small screens (Sidebar unloaded) ---*/
const scrollBlocker = (function () { const scrollBlocker = (function () {
let offset = 0; let offset = 0;
return { return {
block() { block() {
offset = $(window).scrollTop(); offset = window.scrollY;
$("html,body").scrollTop(0);
}, },
release() { release() {
$("html,body").scrollTop(offset); $("html,body").scrollTop(offset);
@@ -35,6 +33,9 @@ $(function() {
}; };
}()); }());
/*--- Actions in small screens (Sidebar unloaded) ---*/
const mobileSearchBar = (function () { const mobileSearchBar = (function () {
return { return {
on() { on() {
@@ -60,11 +61,11 @@ $(function() {
return { return {
on() { on() {
if (!visible) { if (!visible) {
resultWrapper.removeClass("unloaded"); // the block method must be called before $(#main) unloaded.
main.addClass("hidden");
visible = true;
scrollBlocker.block(); scrollBlocker.block();
resultWrapper.removeClass("unloaded");
main.addClass("unloaded");
visible = true;
} }
}, },
off() { off() {
@@ -75,12 +76,13 @@ $(function() {
} }
resultWrapper.addClass("unloaded"); resultWrapper.addClass("unloaded");
btnClear.removeClass("visible"); btnClear.removeClass("visible");
main.removeClass("hidden"); main.removeClass("unloaded");
// now the release method must be called after $(#main) display
scrollBlocker.release();
input.val(""); input.val("");
visible = false; visible = false;
scrollBlocker.release();
} }
}, },
isVisible() { isVisible() {

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -2,12 +2,13 @@
Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) | 简体中文 Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) | 简体中文
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)](https://rubygems.org/gems/jekyll-theme-chirpy)
[![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush) [![Build Status](https://github.com/cotes2020/jekyll-theme-chirpy/workflows/build/badge.svg?branch=master&event=push)](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8220b926db514f13afc3f02b7f884f4b)](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg?color=blue)](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu)
一个不一样的 Jekyll 主题,采用响应式设计,方便记录、管理、分享的知识和经验。[懂的进 »](https://chirpy.cotes.info) 一个不一样的 Jekyll 主题,采用响应式设计,方便记录、管理、分享的知识和经验。[懂的进 »](https://chirpy.cotes.info)
[![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info) [![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info)
@@ -54,18 +55,18 @@ Language: [English](https://github.com/cotes2020/jekyll-theme-chirpy#readme) |
有二法可得此主题: 有二法可得此主题:
-[RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy) 安装 - **从 RubyGems 安装** - 易于版本升级,隔离无关的主题项目文件,让您的仓库舒适清爽。
- 从 GitHub 上 Fork - **从 GitHub 上 Fork** - 对个性化二次开发友好,但是难于升级,只适合专业开发人员使用。
### Rubygems 安装 ### RubyGems 安装
的 Jekyll 站点的 `Gemfile` 添加: 的 Jekyll 站点的 `Gemfile` 添加:
```ruby ```ruby
gem "jekyll-theme-chirpy" gem "jekyll-theme-chirpy"
``` ```
然后,添加这行到的 Jekyll 站点的 `_config.yml`: 然后,添加这行到的 Jekyll 站点的 `_config.yml`:
```yaml ```yaml
theme: jekyll-theme-chirpy theme: jekyll-theme-chirpy
@@ -77,7 +78,7 @@ theme: jekyll-theme-chirpy
$ bundle $ bundle
``` ```
最后, 拷贝额外所需主题的 gem 文件(详见 [starter 项目][starter] 的文件目录)至的 Jekyll 站点, 然后把主题的 `_config.yml` 全部内容附加到的 Jekyll 站点的同名文件。 最后, 拷贝额外所需主题的 gem 文件(详见 [starter 项目][starter] 的文件目录)至的 Jekyll 站点, 然后把主题的 `_config.yml` 全部内容附加到的 Jekyll 站点的同名文件。
> **提示**: 定位主题的 gem 文件,可以执行: > **提示**: 定位主题的 gem 文件,可以执行:
> >
@@ -85,7 +86,7 @@ $ bundle
$ bundle info --path jekyll-theme-chirpy $ bundle info --path jekyll-theme-chirpy
``` ```
或者可以 [使用 starter template][use-starter] 来快速创建 Jekyll 站点,以省去复制主题 gem 文件的时间。 或者可以 [使用 starter template][use-starter] 来快速创建 Jekyll 站点,以省去复制主题 gem 文件的时间。
### 在 GitHub 上 Fork ### 在 GitHub 上 Fork
@@ -103,11 +104,11 @@ $ bundle
$ bash tools/init.sh $ bash tools/init.sh
``` ```
> 如果不打算部署到 GitHub Pages, 在上述命令后附加参数选项 `--no-gh`。 > 如果不打算部署到 GitHub Pages, 在上述命令后附加参数选项 `--no-gh`。
上述脚本完成了以下工作: 上述脚本完成了以下工作:
1.的仓库中删除了: 1.的仓库中删除了:
- `.travis.yml` - `.travis.yml`
- `_posts` 下的文件 - `_posts` 下的文件
- `docs` 目录 - `docs` 目录
@@ -125,7 +126,7 @@ $ bash tools/init.sh
- `url` - `url`
- `avatar` - `avatar`
- `timezone` - `timezone`
- `theme_mode` - `lang`
### 本地运行 ### 本地运行
@@ -148,9 +149,9 @@ $ docker run -it --rm \
### 部署 ### 部署
部署开始前,把 `_config.yml``url` 改为 `https://<username>.github.io`(或者的私有域名,如:`https://yourdomain.com`)。另外,如果想使用 [Project 类型网站](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites),修改配置文件的 `baseurl` 为项目名称,以斜杠开头,如:`/project` 部署开始前,把 `_config.yml``url` 改为 `https://<username>.github.io`(或者的私有域名,如:`https://yourdomain.com`)。另外,如果想使用 [Project 类型网站](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites),修改配置文件的 `baseurl` 为项目名称,以斜杠开头,如:`/project`
现在可以选择下列其中一个方式去站点部署。 现在可以选择下列其中一个方式去站点部署。
#### 部署到 GitHub Pages #### 部署到 GitHub Pages
@@ -158,10 +159,10 @@ $ docker run -it --rm \
快速检查 GitHub Actions 构建需要的文件: 快速检查 GitHub Actions 构建需要的文件:
1. 确保的 Jekyll 站点存在文件 `/.github/workflows/pages-deploy.yml`。没有的话,新建并填入[示例工作流][workflow]的内容, 注意参数 `on.push.branches` 的值必须和的仓库默认分支名相同。 - 确保的 Jekyll 站点存在文件 `.github/workflows/pages-deploy.yml`。没有的话,新建并填入[示例工作流][workflow]的内容, 注意参数 `on.push.branches` 的值必须和的仓库默认分支名相同。
2. 检查的 Jekyll 站点是否有文件 `/tools/test.sh``/tools/deploy.sh`. 没有的话, 从本仓库拷贝到的 Jekyll 项目. - 检查的 Jekyll 站点是否有文件 `tools/test.sh``tools/deploy.sh`. 没有的话, 从本仓库拷贝到的 Jekyll 项目.
在 GitHub 把的仓库命名为 `<GH-USERNAME>.github.io`,然后: 在 GitHub 把的仓库命名为 `<GH-USERNAME>.github.io`,然后开始发布
1. 推送任意一个 commit 到 `origin/master` 以触发 GitHub Actions workflow。一旦 build 完毕并且成功,远端将会自动出现一个新分支 `gh-pages` 用来存储构建的站点文件。 1. 推送任意一个 commit 到 `origin/master` 以触发 GitHub Actions workflow。一旦 build 完毕并且成功,远端将会自动出现一个新分支 `gh-pages` 用来存储构建的站点文件。
@@ -169,7 +170,7 @@ $ docker run -it --rm \
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png) ![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png)
3. 按照 GitHub 指示的地址去访问的网站。 3. 按照 GitHub 指示的地址去访问的网站。
#### 部署到其他 Pages 平台 #### 部署到其他 Pages 平台
@@ -221,5 +222,5 @@ $ docker run -it --rm \
[starter]: https://github.com/cotes2020/chirpy-starter [starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate [use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook [workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
[jb]:https://www.jetbrains.com/?from=jekyll-theme-chirpy [jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy

View File

@@ -10,7 +10,7 @@ const uglify = require('gulp-uglify');
const insert = require('gulp-insert'); const insert = require('gulp-insert');
const fs = require('fs'); const fs = require('fs');
const JS_ROOT = './assets/js'; const JS_ROOT = 'assets/js';
const jsDest = `${ JS_ROOT }/dist/`; const jsDest = `${ JS_ROOT }/dist/`;
function concatJs(files, output) { function concatJs(files, output) {

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 = "3.0.3" spec.version = "3.1.1"
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": "3.0.3", "version": "3.1.1",
"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

@@ -5,16 +5,20 @@
# - assets/js/.copyright.js # - assets/js/.copyright.js
# - 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
# - Gemfile.lock
# - package.json # - package.json
# #
# 2. Create a git-tag # 2. Create a git-tag on release branch
# #
# 3. Build a rubygem package # 3. Build a rubygem package
# #
#
# Requires: gulp, rubygem # Requires: gulp, rubygem
set -eu set -eu
auto_release=true
ASSETS=( ASSETS=(
"_sass/jekyll-theme-chirpy.scss" "_sass/jekyll-theme-chirpy.scss"
"assets/js/.copyright" "assets/js/.copyright"
@@ -22,18 +26,26 @@ ASSETS=(
GEM_SPEC="jekyll-theme-chirpy.gemspec" GEM_SPEC="jekyll-theme-chirpy.gemspec"
GEM_LOCK="Gemfile.lock"
NODE_META="package.json" NODE_META="package.json"
_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"
exit -1 exit -1
fi fi
} }
check() { check() {
if [[ -n $(git status . -s) ]]; then if [[ -n $(git status . -s) ]]; then
echo "Warning: commit unstaged files first, and then run this tool againt." echo "Error: Commit unstaged files first, and then run this tool againt."
exit -1
fi
# ensure the current branch is 'master'
if [[ "$(git branch --show-current)" != "master" ]]; then
echo "Error: This operation must be performed on the 'master' branch!"
exit -1 exit -1
fi fi
@@ -48,26 +60,33 @@ check() {
_bump_assets() { _bump_assets() {
_version="$1" _version="$1"
for i in "${!ASSETS[@]}"; do for i in "${!ASSETS[@]}"; do
sed -i "s/v[[:digit:]]\.[[:digit:]]\.[[:digit:]]/v$_version/" "${ASSETS[$i]}" sed -i "s/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/v$_version/" "${ASSETS[$i]}"
done done
gulp gulp
} }
_bump_gemspec() { _bump_gemspec() {
sed -i "s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/$1/" "$GEM_SPEC" sed -i "s/[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/$1/" "$GEM_SPEC"
} }
_bump_node() { _bump_node() {
sed -i \ sed -i \
"s,[\"]version[\"]: [\"][[:digit:]]\.[[:digit:]]\.[[:digit:]][\"],\"version\": \"$1\"," \ "s,[\"]version[\"]: [\"][[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+[\"],\"version\": \"$1\"," \
$NODE_META $NODE_META
} }
_bump_gemlock() {
sed -i \
"s/jekyll-theme-chirpy ([[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/jekyll-theme-chirpy ($1/" \
$GEM_LOCK
}
bump() { bump() {
_bump_assets "$1" _bump_assets "$1"
_bump_gemspec "$1" _bump_gemspec "$1"
_bump_node "$1" _bump_node "$1"
_bump_gemlock "$1"
if [[ -n $(git status . -s) ]]; then if [[ -n $(git status . -s) ]]; then
git add . git add .
@@ -76,13 +95,51 @@ bump() {
} }
build_gem() { build_gem() {
rm -f ./*.gem
gem build "$GEM_SPEC" gem build "$GEM_SPEC"
} }
release() {
_version="$1"
_major=""
_minor=""
IFS='.' read -r -a array <<< "$_version"
for elem in "${array[@]}"; do
if [[ -z $_major ]]; then
_major="$elem"
elif [[ -z $_minor ]]; then
_minor="$elem"
else
break
fi
done
_release_branch="$_major-$_minor-stable"
if [[ -z $(git branch -v | grep "$_release_branch") ]]; then
git checkout -b "$_release_branch"
else
git checkout "$_release_branch"
# cherry-pick the latest 2 commit from master to release branch
git cherry-pick "$(git rev-parse master~1)" "$(git rev-parse master)"
fi
echo -e "Create tag v$_version\n"
git tag "v$_version"
build_gem
# head back to master branch
git checkout master
}
main() { main() {
check check
_latest_tag="$(git describe --tags --abbrev=0)" _latest_tag="$(git describe --tags $(git rev-list --tags --max-count=1))"
echo "Input a version number (hint: latest version is ${_latest_tag:1})" echo "Input a version number (hint: latest version is ${_latest_tag:1})"
@@ -98,16 +155,30 @@ main() {
echo -e "Bump version to $_version\n" echo -e "Bump version to $_version\n"
bump "$_version" bump "$_version"
echo -e "Create tag v$_version\n" echo -e "Release to v$_version\n"
git tag "v$_version"
build_gem if $auto_release; then
release "$_version"
fi
else else
echo "Error: Illegal version number: '$_version'" echo "Error: Illegal version number: '$_version'"
fi fi
} }
while (($#)); do
opt="$1"
case $opt in
-m | --manual)
auto_release=false
shift
;;
*)
echo "unknown option '$opt'!"
exit 1
;;
esac
done
main main