diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..cdded4641a8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +# 2 space indentation +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +# Unix-style newlines with a newline ending every file +end_of_line = lf +insert_final_newline = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..262d6bd7b86 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +# Set default behavior to automatically normalize line endings. +* text=auto + +# Force bash scripts to always use LF line endings so that if a repo is accessed +# in Unix via a file share from Windows, the scripts will work. +*.sh text eol=lf + +# Force batch scripts to always use CRLF line endings so that if a repo is accessed +# in Windows via a file share from Linux, the scripts will work. +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary +*.ico binary diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..bf8db4d09ef --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,73 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at `cotes.chung@gmail.com`. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at + +For answers to common questions about this code of conduct, see + + +[homepage]: https://www.contributor-covenant.org \ No newline at end of file diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000000..ca532e0af2c --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,16 @@ +# How to Contribute + +I want to thank you for sparing a time to improve this project! Here are some guidelines for contributing: + +To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a [`Feature Request`](https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md) issue to discuss whether your idea fits the project. + +Generally, contribute to the project by: + +1. Fork this project on GitHub and clone it locally. +2. Create a new branch from `master` and give it a descriptive name (e.g., `my-new-feature`, `fix-a-bug`). +3. After completing the development, commit and push to remote. +4. Submit a new pull request. + +--- + +:tada: Your volunteering will make the open source world more beautiful, thanks again! :tada: \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..a15c54f0f00 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +custom: + - https://www.buymeacoffee.com/coteschung + - https://cotes.gitee.io/alipay-wechat-donation diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000000..11a9936e7f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,54 @@ +--- +name: Bug Report +about: Create a report to help us improve +--- + + + +## Checklist + +- [ ] I have read the [tutorials](https://chirpy.cotes.info/categories/tutorial/) and know the correct effect of the functional design. +- [ ] There are no similar reports on existing issues (including closed ones). +- [ ] I found the bug on the latest code of `master` branch. + +## Describe the bug + + +### To Reproduce + +Steps to reproduce the behavior: + + +### Expected behavior + + +### Screenshots + + +### Software + +- Ruby version: +- Gem version: +- Bundler version: +- Jekyll version: + +### Desktop + + +### Smartphone + + +### Additional context + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000000..f6ddfdaf08c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,30 @@ +--- +name: Feature Request +about: Suggest an idea for this project +labels: enhancement +--- + + + +## Checklist + +- [ ] I have read the [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/CONTRIBUTING.md). +- [ ] There are no similar request on existing issues (including closed ones). +- [ ] I have read the [project progress](https://github.com/cotes2020/jekyll-theme-chirpy/projects) and know the current progress of the project. +- [ ] I was in the `master` branch of the latest code. + + +## Is your feature request related to a problem? Please describe + + + +## Describe the solution you'd like + + + +## Describe alternatives you've considered + + + +## Additional context + diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 00000000000..3c93a18a5a6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,19 @@ +--- +name: Question +about: Ask what ever you want +labels: question +--- + + + +## Checklist + + + +- [ ] I have read the [tutorials](https://chirpy.cotes.info/categories/tutorial/) and know the correct effect of the functional design. +- [ ] There are no similar question on existing issues (including closed ones). +- [ ] I searched the Internet for related problems, but still couldn't solve it. +- [ ] My question is based on the latest code of `master` branch. + +## Description + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..9c1fbaf2b11 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,44 @@ +## Description + + + +e.g. Fixes #(issue) + +## Type of change + + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Documentation update + +## How has this been tested + + + +- [ ] I have run `bash ./tools/test.sh --build` (at the root of the project) locally and passed +- [ ] I have tested this feature in the browser + +### Test Configuration + +- Browerser type & version: +- Operating system: +- Bundler version: +- Ruby version: +- Jekyll version: + +### Checklist + +- [ ] My code follows the [Google style guidelines](https://google.github.io/styleguide/) +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] Any dependent changes have been merged and published in downstream modules diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000000..019fa16f413 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Clean up the stale issues + +daysUntilStale: 30 +daysUntilClose: 1 + +exemptLabels: + - in progress + - pending + +staleLabel: stale + +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. + +closeComment: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..907b905e800 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: 'Continuous Integration' +on: + push: + branches-ignore: + - 'production' + tags-ignore: + - '*' + paths-ignore: + - '.github/**' + - '!.github/workflows/ci.yml' + - '.travis.yml' + - '.gitignore' + - 'docs/**' + - 'README.md' + - 'LICENSE' + pull_request: + paths: + - '**' + +jobs: + ci: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # for posts's lastmod + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + + - name: Build Site + env: + JEKYLL_ENV: production + run: | + bundle exec jekyll b + + - name: Test Site + run: | + bash tools/test.sh diff --git a/.github/workflows/issue-pr-interceptor.yml b/.github/workflows/issue-pr-interceptor.yml new file mode 100644 index 00000000000..c46d79ba66e --- /dev/null +++ b/.github/workflows/issue-pr-interceptor.yml @@ -0,0 +1,20 @@ +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." diff --git a/.github/workflows/pages-deploy.yml.hook b/.github/workflows/pages-deploy.yml.hook new file mode 100644 index 00000000000..aa90027ff83 --- /dev/null +++ b/.github/workflows/pages-deploy.yml.hook @@ -0,0 +1,53 @@ +name: 'Automatic build' +on: + push: + branches: + - master + paths-ignore: + - .gitignore + - README.md + - LICENSE + +jobs: + continuous-delivery: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # for posts's lastmod + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + + - name: Check baseurl + run: | + baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")" + if [[ -n $baseurl ]]; then + echo "BASE_URL=$baseurl" >> $GITHUB_ENV + fi + + - name: Build Site + env: + JEKYLL_ENV: production + run: | + bundle exec jekyll b -d "_site$BASE_URL" + + - name: Test Site + run: | + bash tools/test.sh + + - name: Deploy + run: | + if [[ -n $BASE_URL ]]; then + mv _site$BASE_URL _site-rename + rm -rf _site + mv _site-rename _site + fi + + bash tools/deploy.sh diff --git a/.gitignore b/.gitignore index 6c33261ad43..05db64a29c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,15 @@ # hidden files .* +!.github -# python compiled files -*.pyc - -# jekyll debug +# bundler cache _site - -# Jeykll Gemfile.lock +vendor Gemfile.lock -# yui-compressor -*.jar +# rubygem +*.gem -# bundle cache -vendor +# npm dependencies +node_modules +package-lock.json diff --git a/_data/updates.yml b/.nojekyll similarity index 100% rename from _data/updates.yml rename to .nojekyll diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..f242a412b8f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,56 @@ +os: linux +dist: bionic + +language: minimal + +jobs: + include: + + - name: CD + language: ruby + rvm: 2.7.0 + + addons: + apt: + packages: + # required to avoid SSL error (for htmlproofer) + - libcurl4-openssl-dev + + cache: + directories: + - $TRAVIS_BUILD_DIR/vendor/bundle + + before_install: + # match the Gemfile.lock, travis' bundler is 2.1.2 + - gem install bundler:2.2.4 + - bundle config path 'vendor/bundle' + + install: + # overriding to drop the travis `--development` flag + - bundle install --jobs=3 --retry=3 + + script: + - eval "$BUILD_CMD" + + git: + depth: false # for posts' lastmod + + - name: Flush Starter + script: + - eval "$FLUSH_STARTER" + +before_script: + - git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q + +branches: + only: /.*-stable$/ + +notifications: + email: + recipients: + - secure: "fFLqX7uOzFA8RE2AUFlU1mmxMw+rdV6DnODJ/1Gl+3ecNtrv5LeH3c5a4a5ShQqYTrx9BPfD40VRN7UB+lzOdXiWLI9yDGRPPxGG26/WfrKpdQPZilc8zAOEeDnLAJeGZLsUvgmNb3KCXW6S8NPqqh34CfWcTIzjCARhRgO33wcs8X5wP5cugtNqO5Ew/pUcfWcmiuXNX0GNT6l+nL5A7yN+IO5mRHqSRmlfYd5EHhGMTIL4La+Cd1CNv1m4Dl0Ah2cDeJwi5wLnVbqAgunLhAYmDtxIOCVYMTBrP37UiNe/7QeFelyJfODsmMg1mx3WCykbXydC753WVoAlTg6nNoeeI9fmK+/tuLK+sx/KnYfTVGBXQYq39DyV/2o/IfCzEAKImlzFKGD8R13+ddu4B5UML+cby5KBvhTKIGaC5tKoe39z/31UPpy11/EHMCof2BUOzIgu5Hsv4OSNJlw3oRE31oOPn8xP4e7uWR8bRUhAgzN0Cn0ht+UfpemfGAXrp0M3IXQdc9L4azEFqxRhivMTLK/P6INay7IM+DJ30Ht2dWylGw/sxcRTqyNm3YomJQnXIO4xeqTSLulWr80FFHTys3JEDJYrcKvJmpwLFEAOZtwKsZ6ZShrOIA4LE5fgQtakH3ZLJG9a7jVSlMcNIfaSKgjdDQOe6CoRQL7KouA=" + on_success: never + +env: + global: + - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer diff --git a/404.html b/404.html index a708b68e110..d19e5c30870 100644 --- a/404.html +++ b/404.html @@ -1,19 +1,11 @@ --- -# The 404 page -# v2.0 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2017-2019 Cotes Chung -# MIT License layout: page title: "404: Page not found" permalink: /404.html -redirect_from: # part of site.sitemap_exclude +redirect_from: - /norobots/ - /assets/ - - /tabs/ - - /categories/ - - /tags/ - /posts/ dynamic_title: true @@ -21,5 +13,9 @@

Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.

-

Head back Home to try finding it again, or search for it on the Archives page.

-
\ No newline at end of file +

+ Head back Home + to try finding it again, or search for it on the + Archives page. +

+ diff --git a/Gemfile b/Gemfile index 7a2f0504e89..6438466423f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,19 @@ +# frozen_string_literal: true + source "https://rubygems.org" -gem "jekyll", ">=3.8.6" +gemspec -# Official Plugins -group :jekyll_plugins do - gem "jekyll-paginate" - gem "jekyll-redirect-from" - gem "jekyll-seo-tag", "~> 2.6.1" +group :test do + gem "html-proofer", "~> 3.18" end -group :test do - gem "html-proofer" +# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem +# and associated library. +install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do + gem "tzinfo", "~> 1.2" + gem "tzinfo-data" end + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform? diff --git a/README.md b/README.md index 3c1a32e7527..e213eb4b809 100644 --- a/README.md +++ b/README.md @@ -1,261 +1,217 @@ # Chirpy -🌏 English • [简体中文](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) +[![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, focusing on text presentation, aim to help you easily record and share your knowledge. [Live Demo »](https://chirpy.cotes.info) +A minimal, sidebar, responsive web design Jekyll theme that focuses on text presentation. Designed to help you record and share your knowledge easily. [Live Demo »](https://chirpy.cotes.info) -[![Devices Mockup](https://raw.githubusercontent.com/cotes2020/jekyll-theme-chirpy/master/assets/img/sample/devices-mockup.png)](https://chirpy.cotes.info) - -## Table of Contents - -* [Features](#features) -* [Installing](#installing) -* [Usage](#usage) -* [Contributing](#contributing) -* [Credits](#credits) -* [Support](#support) -* [License](#license) +[![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png)](https://chirpy.cotes.info) ## Features -* Pinned Posts -* Configurable theme mode -* Double-level Categories -* Last modified date for posts -* Table of Contents -* Automatically recommend related posts -* Syntax highlighting -* Mathematical expressions -* Search -* Atom Feeds -* Disqus Comments -* Google Analytics -* GA Pageviews reporting (Advanced) -* SEO and Performance Optimization +- Pinned Posts +- Configurable theme mode +- Double-level Categories +- Last modified date for posts +- Table of Contents +- Automatically recommend related posts +- Syntax highlighting +- Mathematical expressions +- Mermaid diagram & flowchart +- Search +- Atom Feeds +- Disqus Comments +- Google Analytics +- GA Pageviews reporting (Advanced) +- SEO and Performance Optimization -## Installing +## 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 basic environment (`Ruby`, `RubyGems` and `Bundler`). +## Installation -To improve the writing experience, we need to use some script tools. If your machine is running Debian or macOS, make sure that [GNU coreutils](https://www.gnu.org/software/coreutils/) is installed. Otherwise, install by: +There are two ways to get the theme: -* Debian +- **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. -```console -$ sudo apt-get install coreutils -``` +### Installing the Theme Gem -* macOS +Add this line to your Jekyll site's `Gemfile`: -```console -$ brew install coreutils +```ruby +gem "jekyll-theme-chirpy" ``` +And add this line to your Jekyll site's `_config.yml`: -### Jekyll Plugins +```yaml +theme: jekyll-theme-chirpy +``` -[Fork **Chirpy** from GitHub](https://github.com/cotes2020/jekyll-theme-chirpy/fork), then clone your forked repo to local: +And then execute: ```console -$ git clone git@github.com:USER/jekyll-theme-chirpy.git -b master +$ bundle ``` -and replace the `USER` above to your GitHub username. +Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site. -The first time you run or build the project on local machine, perform the installation of Jekyll plugins. Go to the root of repo and run: +> **Hint**: To locate the installed theme’s gem, execute: +> +> ```console +> $ bundle info --path jekyll-theme-chirpy +> ``` -```terminal -$ bundle install -``` +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! -`bundle` will automatically install all the dependent Jekyll Plugins that listed in the `Gemfile`. +### Fork on GitHub +[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub and then clone your fork to local. (Please note that the default branch code is in development. If you want the blog to be stable, please switch to the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags) and start writing.) -## Usage - +Install gem dependencies by: -### Directory Structure - -The main files and related brief introductions are listed below. - -```sh -jekyll-theme-chirpy/ -├── _data -├── _includes -├── _layouts -├── _posts # posts stay here -├── _scripts -├── .travis.yml # remove it -├── .github # remove this, too -├── assets -├── tabs -│   └── about.md # the ABOUT page -├── .gitignore -├── 404.html -├── Gemfile -├── LICENSE -├── README.md -├── _config.yml # configuration file -├── tools # script tools -├── docs -├── feed.xml -├── index.html -├── robots.txt -└── sitemap.xml +```console +$ bundle ``` +And then execute: -As mentioned above, some files or directories should be removed from your repo: - -- .travis.yml -- .github +```console +$ bash tools/init.sh +``` +> **Note**: If you don't plan to deploy your site on GitHub Pages, append parameter option `--no-gh` at the end of the above command. -### Configuration +What it does is: -Generally, go to `_config.yml` and configure the variables as needed. Some of them are typical options: +1. Remove some files or directories from your repository: + - `.travis.yml` + - files under `_posts` + - folder `docs` -* `url` - - Set to your website url and there should be no slash symbol at the tail. Format: `://`. +2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in folder `.github`. +3. Automatically create a commit to save the changes. -* `avatar` - - It defines the image file location of avatar. The sample image is `/assets/img/sample/avatar.jpg`, and should be replaced by your own one(a square image). Notice that a huge image file will increase the load time of your site, so keep your avatar image size as small as possible(may be ** will help). +## Usage -* `timezone` +### Configuration - To ensure that the posts' release date matches the city you live in, please modify the field `timezone` correctly. A list of all available values can be found on [TimezoneConverter](http://www.timezoneconverter.com/cgi-bin/findzone/findzone) or [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). +Update the variables of `_config.yml` as needed. Some of them are typical options: -* `theme_mode` - - There are three options for the theme color scheme: - - - **dual** - The default color scheme will follow the system settings, but if the system does not support dark mode, or the browser does not support `Media Queries Level 5`, the theme will be displayed as `light` mode by default. Anyway, the bottom left corner of the Sidebar will provide a button for users to switch color schemes. +- `url` +- `avatar` +- `timezone` +- `lang` - - **dark** - Always show dark mode. - - **light** - Always show light mode. +### Running Local Server +You may want to preview the site contents before publishing, so just run it by: -### Run Locally +```console +$ bundle exec jekyll s +``` -You may want to preview the site content before publishing, so just run the script tool: +Or run the site on Docker with the following command: ```terminal -$ bash tools/run.sh +$ docker run -it --rm \ + --volume="$PWD:/srv/jekyll" \ + -p 4000:4000 jekyll/jekyll \ + jekyll serve ``` -Open a modern browser and visit at . - -Few days later, you may find that the file modification(e.g. edits to a post) does not refresh in real time by using `run.sh`. Don't worry, the advanced option `-r` (or `--realtime`) will solve this problem, but it requires [**fswatch**](http://emcrisostomo.github.io/fswatch/) to be installed on your machine. Type `-h` for more information. +Open a browser and visit to __. -### Deploying to GitHub Pages +### Deployment -Before the deployment begins, checkout the file `_config.yml` and make sure that the `url` has been configured. What's more, if you prefer the [Project site on GitHub](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and also use the default domain `.github.io`, remember to change the `baseurl` to your project name that starting with a slash. For example, `/project`. +Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`. -#### Option 1: Built by GitHub Pages +Now you can choose ONE of the following methods to deploy your Jekyll site. -By deploying the site in this way, you're allowed to push the source code directly to the remote. +#### Deploy on GitHub Pages -> **Note**: If you want to use any third-party Jekyll plugins that not in [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally). +For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the GH Pages service. -**1**. Rename the repository to: +Quickly check the files needed for GitHub Actions build: -|Site Type | Repo's Name| -|:---|:---| -|User or Organization | `.github.io`| -|Project| Any one except `.github.io`, let's say `project`| +- 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 file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site. -**2**. Commit the changes of the repo first, then run the publish script: +And then rename your repoistory to `.github.io` on GitHub. -```console -$ bash tools/publish.sh -``` - -> Please note that the *Recent Update* list requires the latest git-log date of posts, thus make sure the changes in `_posts` have been committed before running this command. - -it will automatically generates the *Latest Modified Date* and *Categories / Tags* page for the posts and submit a commit, and then push to `origin/master`. Its output is similar to the following log: - -```terminal -[INFO] Success to update lastmod for 4 post(s). -[INFO] Succeed! 3 category-pages created. -[INFO] Succeed! 4 tag-pages created. -[INFO] Published successfully! -``` - -**3**. Go to GitHub website and enable GitHub Pages service for the repo. - -**4**. Check it out: - -|Site Type | Site URL | -|:---|:---| -|User or Organization | `https://.github.io/`| -|Project| `https://.github.io/project/`| +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. -#### Option 2: Build Locally +2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_: -For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any another plugins that not in the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**. + ![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/posts/20190809/gh-pages-sources.png) -**1**. Browse to GitHub website, create a brand new repo named: +3. Visit your website at the address indicated by GitHub. -|Site Type | Repo's Name| -|:---|:---| -|User or Organization | `.github.io`| -|Project| Any one except `.github.io`, let's say `project`| +#### Deploy on Other Platforms -and clone it. +On platforms other than GitHub, we cannot enjoy the convenience of **GitHub Actions**. Therefore, we should build the site locally (or on some other 3rd-party CI platform) and then put the site files on the server. -**2**. In the root of the source project, build your site by: +Go to the root of the source project, build your site by: ```console -$ bash tools/build.sh -d /path/to/local/project/ +$ JEKYLL_ENV=production bundle exec jekyll b ``` -The generated static files will be placed in the root of `/path/to/local/project`. Commit and push the changes to the `master` branch on GitHub. +Or build the site with Docker by: -**3**. Go to GitHub website and enable Pages service for the new repository. - -**4**. Visit at: - -|Site Type | Site URL | -|:---|:---| -|User or Organization | `https://.github.io/`| -|Project| `https://.github.io/project/`| - -#### Finishing work - -No matter which way you choose to deploy the website on GitHub, please enforce the `HTTPS` for it. See official docs: [Securing your GitHub Pages site with HTTPS](https://help.github.com/en/github/working-with-github-pages/securing-your-github-pages-site-with-https). +```terminal +$ docker run -it --rm \ + --env JEKYLL_ENV=production \ + --volume="$PWD:/srv/jekyll" \ + jekyll/jekyll \ + jekyll build +``` +Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server. -### Documentation +## Documentation -For more details and the better reading experience, please check out the [tutorial in 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 the better reading experience, please check out the [tutorials on demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). ## Contributing The old saying, "Two heads are better than one." Consequently, welcome to report bugs, improve code quality or submit a new feature. For more information, see [contributing guidelines](.github/CONTRIBUTING.md). - ## Credits -This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Bootstrap](https://getbootstrap.com/), [Font Awesome](https://fontawesome.com/) and some other wonderful tools(their copyright information can be found in the relevant files). +This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Bootstrap](https://getbootstrap.com/), [Font Awesome](https://fontawesome.com/) and some other wonderful tools (their copyright information can be found in the relevant files). -:tada:Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas or inspired me to write more readable documentation. +:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas or inspired me to write more readable documentation. +Also, thank [JetBrains][jb] for providing the open source license. -## Support +## Sponsoring -If you enjoy this theme or find it helpful, please consider becoming my sponsor, I'd really appreciate it! Click the button :heart:Sponsor at the top of the [Home Page](https://github.com/cotes2020/jekyll-theme-chirpy) and choose a link that suits you to donate; this will encourage and help me better maintain the project. +If you like this theme or find it helpful, please consider sponsoring me, because it will encourage and help me better maintain the project, I will be very grateful! +[![Buy Me a Coffee](https://img.shields.io/badge/-Buy%20Me%20a%20Coffee-ff813f?logo=buy-me-a-coffee&logoColor=white)](https://www.buymeacoffee.com/coteschung) +[![Wechat Pay](https://img.shields.io/badge/-Tip%20Me%20on%20WeChat-brightgreen?logo=wechat&logoColor=white)][cn-donation] +[![Alipay](https://img.shields.io/badge/-Tip%20Me%20on%20Alipay-blue?logo=alipay&logoColor=white)][cn-donation] ## License -This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License. \ No newline at end of file +This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License. + +[starter]: https://github.com/cotes2020/chirpy-starter +[use-starter]: https://github.com/cotes2020/chirpy-starter/generate +[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook + + + +[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy +[cn-donation]: https://cotes.gitee.io/alipay-wechat-donation/ diff --git a/_config.dev.yml b/_config.dev.yml index cb19ffc52b2..b32930a7f91 100644 --- a/_config.dev.yml +++ b/_config.dev.yml @@ -1,52 +1,51 @@ -# The Site Settings -# v2.0 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2017-2019 Cotes Chung -# MIT licensed +# The Site Configuration +# Import the theme +theme: jekyll-theme-chirpy -# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md -#-------------------------- +# 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: America/Los_Angeles -title: Garage Time @ The Aquarium # the main title +# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md +# -------------------------- +title: Garage Time @ The Aquarium # the main title tagline: Snippets, tutorials and mini projects. # it will display as the sub-title description: >- # used by seo meta and the atom feed - Tracking garage time projects and code snippets. + Tracking garage time projects and code snippets. -# Replace with the website url, e.g. 'https://username.github.io' +# fill in the protocol & hostname for your site, e.g., 'https://username.github.io' url: 'https://localhost:4000' -author: CYN # change to your full name - -avatar: /assets/img/sample/avatar.png # support internet resources - github: - username: ChiamYu # change to your github username + username: ChiamYu # change to your github username twitter: username: twitter_username # change to your twitter username social: - name: CYN # it will shows as the copyright owner in Footer - email: ngchiamyu@gmail.com # change to your email address + # Change to your full name. + # It will be displayed as the default author of the posts and the copyright owner in the Footer + name: CYN + email: ng.chiam.yu+git@gmail.com # change to your email address links: # The first element serves as the copyright owner's link - - https://twitter.com/username # change to your twitter homepage - - https://github.com/username # change to your github homepage + - https://twitter.com # change to your twitter homepage + - https://github.com/ChiamYu # change to your github homepage + # Uncomment below to add more social links + # - https://www.facebook.com/username + # - https://www.linkedin.com/in/username 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: America/Los_Angeles +# -------------------------- google_analytics: id: '' # Fill with your Google Analytics ID @@ -59,36 +58,44 @@ google_analytics: proxy_endpoint: '' 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, available values: +# Prefer color scheme setting. # -# dual - Follow the system prefer color by default, and a toggle will display -# in the left bottom of Sidebar, which used for switch the theme between dark and light. +# Note: Keep empty will follow the system prefer color by default, +# and there will be a toggle to switch the theme between dark and light +# on the bottom left of the sidebar. # -# light - Use the light color scheme +# Available options: # +# light - Use the light color scheme # dark - Use the dark color scheme # -theme_mode: light +theme_mode: light # [light|dark] + +# The CDN endpoint for images. +# Notice that once it is assigned, the CDN url +# will be added to all image (site avatar & posts' images) paths starting with '/' +# +# e.g. 'https://cdn.com' +img_cdn: '' + +# the avatar on sidebar, support local or CORS resources +avatar: /assets/img/sample/avatar.png -# boolean type, global switch for ToC in posts. +# boolean type, the global switch for ToC in posts. toc: true -paginate: 10 +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 -markdown: kramdown +paginate: 10 -highlighter: rouge +# ------------ The following options are not recommended to be modified ------------------ kramdown: - input: GFM syntax_highlighter: rouge - syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options - css_class: 'highlight' + syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options + css_class: highlight # default_lang: console span: line_numbers: false @@ -97,23 +104,24 @@ kramdown: start_line: 1 # 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/ +collections: + tabs: + output: true + sort_by: order + + defaults: - scope: - path: "" # An empty string here means all files in the project + path: '' # An empty string here means all files in the project type: posts values: layout: post comments: true # Enable comments in posts. toc: true # Display TOC column in posts. - location: Post - breadcrumb: - - - label: Posts - url: / - scope: path: _drafts @@ -121,77 +129,45 @@ defaults: comments: false - scope: - path: tags - values: - tab_active: Tags - location: Tag - breadcrumb: - - - label: Home - url: / - - - label: Tags - url: /tabs/tags/ - - - scope: - path: categories - values: - tab_active: Categories - location: Category - breadcrumb: - - - label: Home - url: / - - - label: Categories - url: /tabs/categories/ - - - scope: - path: tabs + path: '' + type: tabs # see `site.collections` values: layout: page + permalink: /:title/ dynamic_title: true # Hide title in mobile screens. - breadcrumb: - - - label: Home - url: / - sass: - sass_dir: /assets/css style: compressed compress_html: clippings: all - comments: [""] - endings: [html, head, body, dt, dd, rt, rp, - optgroup, option, colgroup, caption, - thead, tbody, tfoot, tr, td, th] + comments: all + endings: all profile: false blanklines: false ignore: - envs: [] + envs: [development] exclude: - - vendor # Avoid Jekyll mistakenly read the vendor directory on Travis-CI's VM . - - Gemfile.lock + - vendor - Gemfile + - Gemfile.lock + - '*.gem' + - '*.gemspec' - tools - docs - README.md - LICENSE - -sitemap_exclude: # Sitemap will exclude the following items. - fuzzy: - - /assets/ - accurate: - - /norobots/ - - /tabs/ - - /categories/ - - /tags/ - - /posts/ - - 404.html - - feed.xml - - sitemap.xml - - robots.txt - - redirects.json + - gulpfile.js + - node_modules + - package.json + - package-lock.json + +jekyll-archives: + enabled: [categories, tags] + layouts: + category: category + tag: tag + permalinks: + tag: /tags/:name/ + category: /categories/:name/ diff --git a/_config.yml b/_config.yml index 2dd23a7450f..43e2270cc1c 100644 --- a/_config.yml +++ b/_config.yml @@ -1,52 +1,51 @@ -# The Site Settings -# v2.0 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2017-2019 Cotes Chung -# MIT licensed +# The Site Configuration +# Import the theme +theme: jekyll-theme-chirpy -# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md -#-------------------------- +# 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: America/Los_Angeles -title: Garage Time @ The Aquarium # the main title +# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md +# -------------------------- +title: Garage Time @ The Aquarium # the main title tagline: Snippets, tutorials and mini projects. # it will display as the sub-title description: >- # used by seo meta and the atom feed - Tracking garage time projects and code snippets. + Tracking garage time projects and code snippets. -# Replace with the website url, e.g. 'https://username.github.io' +# fill in the protocol & hostname for your site, e.g., 'https://username.github.io' url: 'https://chiamyu.github.io' -author: CYN # change to your full name - -avatar: /assets/img/sample/avatar.png # support internet resources - github: - username: ChiamYu # change to your github username + username: ChiamYu # change to your github username twitter: username: twitter_username # change to your twitter username social: - name: CYN # it will shows as the copyright owner in Footer - email: ngchiamyu@gmail.com # change to your email address + # Change to your full name. + # It will be displayed as the default author of the posts and the copyright owner in the Footer + name: CYN + email: ng.chiam.yu+git@gmail.com # change to your email address links: # The first element serves as the copyright owner's link - - https://twitter.com/username # change to your twitter homepage - - https://github.com/username # change to your github homepage + - https://twitter.com # change to your twitter homepage + - https://github.com/ChiamYu # change to your github homepage + # Uncomment below to add more social links + # - https://www.facebook.com/username + # - https://www.linkedin.com/in/username 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: America/Los_Angeles +# -------------------------- google_analytics: id: '' # Fill with your Google Analytics ID @@ -59,36 +58,44 @@ google_analytics: proxy_endpoint: '' 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, available values: +# Prefer color scheme setting. # -# dual - Follow the system prefer color by default, and a toggle will display -# in the left bottom of Sidebar, which used for switch the theme between dark and light. +# Note: Keep empty will follow the system prefer color by default, +# and there will be a toggle to switch the theme between dark and light +# on the bottom left of the sidebar. # -# light - Use the light color scheme +# Available options: # +# light - Use the light color scheme # dark - Use the dark color scheme # -theme_mode: light +theme_mode: light # [light|dark] + +# The CDN endpoint for images. +# Notice that once it is assigned, the CDN url +# will be added to all image (site avatar & posts' images) paths starting with '/' +# +# e.g. 'https://cdn.com' +img_cdn: '' + +# the avatar on sidebar, support local or CORS resources +avatar: /assets/img/sample/avatar.png -# boolean type, global switch for ToC in posts. +# boolean type, the global switch for ToC in posts. toc: true -paginate: 10 +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 -markdown: kramdown +paginate: 10 -highlighter: rouge +# ------------ The following options are not recommended to be modified ------------------ kramdown: - input: GFM syntax_highlighter: rouge - syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options - css_class: 'highlight' + syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options + css_class: highlight # default_lang: console span: line_numbers: false @@ -97,23 +104,24 @@ kramdown: start_line: 1 # 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/ +collections: + tabs: + output: true + sort_by: order + + defaults: - scope: - path: "" # An empty string here means all files in the project + path: '' # An empty string here means all files in the project type: posts values: layout: post comments: true # Enable comments in posts. toc: true # Display TOC column in posts. - location: Post - breadcrumb: - - - label: Posts - url: / - scope: path: _drafts @@ -121,77 +129,45 @@ defaults: comments: false - scope: - path: tags - values: - tab_active: Tags - location: Tag - breadcrumb: - - - label: Home - url: / - - - label: Tags - url: /tabs/tags/ - - - scope: - path: categories - values: - tab_active: Categories - location: Category - breadcrumb: - - - label: Home - url: / - - - label: Categories - url: /tabs/categories/ - - - scope: - path: tabs + path: '' + type: tabs # see `site.collections` values: layout: page + permalink: /:title/ dynamic_title: true # Hide title in mobile screens. - breadcrumb: - - - label: Home - url: / - sass: - sass_dir: /assets/css style: compressed compress_html: clippings: all - comments: [""] - endings: [html, head, body, dt, dd, rt, rp, - optgroup, option, colgroup, caption, - thead, tbody, tfoot, tr, td, th] + comments: all + endings: all profile: false blanklines: false ignore: - envs: [] + envs: [development] exclude: - - vendor # Avoid Jekyll mistakenly read the vendor directory on Travis-CI's VM . - - Gemfile.lock + - vendor - Gemfile + - Gemfile.lock + - '*.gem' + - '*.gemspec' - tools - docs - README.md - LICENSE - -sitemap_exclude: # Sitemap will exclude the following items. - fuzzy: - - /assets/ - accurate: - - /norobots/ - - /tabs/ - - /categories/ - - /tags/ - - /posts/ - - 404.html - - feed.xml - - sitemap.xml - - robots.txt - - redirects.json + - gulpfile.js + - node_modules + - package.json + - package-lock.json + +jekyll-archives: + enabled: [categories, tags] + layouts: + category: category + tag: tag + permalinks: + tag: /tags/:name/ + category: /categories/:name/ diff --git a/_data/contact.yml b/_data/contact.yml index c6f6460173c..1cd8496442a 100644 --- a/_data/contact.yml +++ b/_data/contact.yml @@ -1,8 +1,4 @@ # The contact options. -# v2.3 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2020 Cotes Chung -# MIT Licensed - type: github @@ -21,11 +17,14 @@ # Uncomment and complete the url below to enable more contact options # - +# type: mastodon # icon: 'fab fa-mastodon' # icons powered by # url: '' # Fill with your mastodon account page # - +# type: linkedin # icon: 'fab fa-linkedin' # icons powered by # url: '' # Fill with your Linkedin homepage # - +# type: stack-overflow # icon: 'fab fa-stack-overflow' # url: '' # Fill with your stackoverflow homepage diff --git a/_data/date_format.yml b/_data/date_format.yml index 3040be7ecc0..3c7bc798d0b 100644 --- a/_data/date_format.yml +++ b/_data/date_format.yml @@ -1,9 +1,7 @@ # The date format -# v2.1 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2020 Cotes Chung -# MIT Licensed - tooltip: "%a, %b %e, %Y, %l:%M %p %z" -post: "%b %e, %Y" \ No newline at end of file + +post: + long: "%b %e, %Y" + short: "%b %e" diff --git a/_data/label.yml b/_data/label.yml index 53761bc7bd6..11cccf4262a 100644 --- a/_data/label.yml +++ b/_data/label.yml @@ -1,19 +1,19 @@ # The label text of site. -# v2.0 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2017-2019 Cotes Chung -# MIT Licensed - panel: - lastmod: "Recent Update" - trending_tags: "Trending Tags" - toc: "Contents" + lastmod: Recent Update + trending_tags: Trending Tags + toc: Contents post: - relate_posts: "Further Reading" + relate_posts: Further Reading + share: Share button: next: Newer previous: Older -search_hint: "Search" # text show on search bar \ No newline at end of file +search_hint: Search # text show on search bar + +pin_prompt: Pinned # pinned prompt + +read_time_unit: min # see posts' time to read diff --git a/_data/rights.yml b/_data/rights.yml index bedc283d9db..f6fdd428488 100644 --- a/_data/rights.yml +++ b/_data/rights.yml @@ -1,10 +1,4 @@ -# License data. -# -# v2.1 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2020 Cotes Chung -# MIT Licensed - +# License data license: name: CC BY 4.0 @@ -14,4 +8,4 @@ brief: Some rights reserved. verbose: >- Except where otherwise noted, the blog posts on this site are licensed - under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author. \ No newline at end of file + under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author. diff --git a/_data/share.yml b/_data/share.yml index 7bb7d8d3e64..ecd1b0d8d59 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -1,12 +1,5 @@ # Sharing options at the bottom of the post. # Icons from -# -# v2.1 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2020 Cotes Chung -# MIT Licensed - -label: "Share" platforms: - diff --git a/_data/tabs.yml b/_data/tabs.yml deleted file mode 100644 index 0f658410900..00000000000 --- a/_data/tabs.yml +++ /dev/null @@ -1,30 +0,0 @@ -# The tab data. -# v2.1 -# https://github.com/cotes2020/jekyll-theme-chirpy -# © 2020 Cotes Chung -# MIT Licensed - - -- - name: Home - icon: "fas fa-home" -- - name: Categories - icon: "fas fa-stream" - path: tabs - url: categories -- - name: "Tags" - icon: "fas fa-tags" - path: tabs - url: tags -- - name: "Archives" - path: tabs - url: archives - icon: "fas fa-archive" -- - name: "About" - icon: "fas fa-info" - path: tabs - url: about \ No newline at end of file diff --git a/_includes/css-selector.html b/_includes/css-selector.html index 53e53db9991..a333c3b32f8 100644 --- a/_includes/css-selector.html +++ b/_includes/css-selector.html @@ -1,54 +1,10 @@ -{% if page.layout == 'home' %} - - - -{% elsif page.layout == 'page' %} - - {% if page.type == 'categories' %} - - - - - {% elsif page.type == 'tags' %} - - - - - {% elsif page.type == 'archives' %} - - - - - {% else %} - - - - - {% endif %} - -{% elsif page.layout == 'category' or page.layout == 'tag' %} - - - - -{% elsif page.layout == 'post' %} - - - - - {% if site.toc and page.toc %} - - - - - {% endif %} + +{% if site.toc and page.toc %} + {% endif %} diff --git a/_includes/disqus.html b/_includes/disqus.html index 2aa49d349c0..0f32888c597 100644 --- a/_includes/disqus.html +++ b/_includes/disqus.html @@ -1,26 +1,25 @@ -
-

Comments powered by Disqus.

+
+

+ Comments powered by Disqus. +

- + \ No newline at end of file + diff --git a/_includes/favicons.html b/_includes/favicons.html index a72cd5317ca..437c6a11568 100644 --- a/_includes/favicons.html +++ b/_includes/favicons.html @@ -1,10 +1,6 @@ {% capture icon_url %}{{ site.baseurl }}/assets/img/favicons{% endcapture %} diff --git a/_includes/fixlinenos.html b/_includes/fixlinenos.html deleted file mode 100644 index 2f888651299..00000000000 --- a/_includes/fixlinenos.html +++ /dev/null @@ -1,9 +0,0 @@ - -{% if _content contains '
' %}
-  {% assign _content = _content | replace: '
', '' %} -{% endif %} \ No newline at end of file diff --git a/_includes/footer.html b/_includes/footer.html index da33c149196..566d273e772 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -1,9 +1,5 @@
@@ -22,9 +18,10 @@ diff --git a/_includes/google-analytics.html b/_includes/google-analytics.html index dc46c832554..e5e5119e555 100644 --- a/_includes/google-analytics.html +++ b/_includes/google-analytics.html @@ -1,16 +1,14 @@ + + diff --git a/_includes/head.html b/_includes/head.html index 66be46898e6..b8f720b7dd1 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -1,15 +1,29 @@ + {% if page.layout == 'home' or page.layout == 'post' %} + + + {% if site.google_analytics.pv.enabled %} + {% if site.google_analytics.pv.proxy_endpoint != '' + and site.google_analytics.pv.proxy_endpoint %} + + {% endif %} + + {% if site.google_analytics.pv.cache %} + + {% endif %} + + {% endif %} + {% endif %} + + {% seo title=false %} + {%- unless page.layout == "home" -%} {{ page.title | append: " | "}} @@ -17,8 +31,6 @@ {{ site.title }} - {% seo title=false %} - {% include favicons.html %} @@ -44,10 +56,6 @@ - - @@ -62,14 +70,11 @@ - - - + - + {% include js-selector.html %} - \ No newline at end of file + diff --git a/_includes/js-selector.html b/_includes/js-selector.html index 83afe3c50f6..6440f9df0da 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -1,49 +1,56 @@ -{% if page.layout == 'home' %} - - {% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %} - - {% endif %} - - - -{% elsif page.layout == 'post' %} - - {% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %} - - {% endif %} - - - - {% if page.math %} - - - - {% endif %} - -{% elsif page.layout == 'page' %} - - {% if page.type == 'categories' %} - - {% else %} - +{% if page.layout == 'home' or page.layout == 'post' %} + {% if site.google_analytics.pv.enabled %} + + + {% endif %} +{% endif %} +{% if page.layout == 'home' + or page.layout == 'post' + or page.layout == 'categories' %} + {% assign type = page.layout %} {% else %} - - - + {% assign type = "page" %} {% endif %} +{% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %} + + +{% if page.math %} + + + + +{% endif %} - {% if jekyll.environment == 'production' %} - + + + + + {% if site.google_analytics.id %} + {% include google-analytics.html %} + {% endif %} + {% endif %} diff --git a/_includes/lozad.html b/_includes/lozad.html index accfbfca239..2bc01ad59dd 100644 --- a/_includes/lozad.html +++ b/_includes/lozad.html @@ -1,8 +1,10 @@ - + \ No newline at end of file + diff --git a/_includes/mermaid.html b/_includes/mermaid.html new file mode 100644 index 00000000000..063d9508020 --- /dev/null +++ b/_includes/mermaid.html @@ -0,0 +1,29 @@ + + + + diff --git a/_includes/mode-toggle.html b/_includes/mode-toggle.html index 45099c51a08..4108c835455 100644 --- a/_includes/mode-toggle.html +++ b/_includes/mode-toggle.html @@ -1,14 +1,8 @@ - - + \ No newline at end of file + diff --git a/_includes/no-linenos.html b/_includes/no-linenos.html index 0b55105d595..85006933708 100644 --- a/_includes/no-linenos.html +++ b/_includes/no-linenos.html @@ -1,12 +1,10 @@ {% comment %} - Remove line numbers from code snippets. - v2.2 - https://github.com/cotes2020/jekyll-theme-chirpy - © 2020 Cotes Chung - Published under the MIT License + Remove the line number of the code snippet. {% endcomment %} -{% if _content contains '
' %}
-  {% assign _content = _content | replace: '
', '' %}
+{% assign content = include.content %}
+
+{% if content contains '
' %}
+  {% assign content = content | replace: '
', '' %}
 {% endif %}
diff --git a/_includes/panel.html b/_includes/panel.html
index 99b6d4cfb51..3b9fb753aa7 100644
--- a/_includes/panel.html
+++ b/_includes/panel.html
@@ -1,75 +1,57 @@
 
 
 
- {% if site.data.updates %} + {% include update-list.html %} - {% include update-list.html %} - - {% if update_list.size > 0 %} + {% if update_list.size > 0 %}
-

- {{- site.data.label.panel.lastmod -}} -

+ {{- site.data.label.panel.lastmod | default: 'Recent Update' -}}
    {% for item in update_list %} - {% assign post_url = item | split: "::" | last | prepend: "/posts/" | append: "/" %} - {% assign post = site.posts | where: "url", post_url | first %} - - {% if post %} - {% assign url = post.url | relative_url %} - -
  • {{ post.title }}
  • - - {% assign sum = sum | plus: 1 %} - {% if sum >= MAX_SIZE %} {% break %} {% endif %} - - {% endif %} - + {% assign index = item | split: "::" | last | plus: 0 %} + {% assign post = site.posts[index] %} + {% assign url = post.url | relative_url %} +
  • {{ post.title }}
  • {% endfor %}
-
- - {% endif %} +
- {% endif %} + {% endif %} {% include trending-tags.html %} {% if trending_tags.size > 0 %}
-

- {{- site.data.label.panel.trending_tags -}} -

+ {{- site.data.label.panel.trending_tags | default: 'Trending Tags' -}}
- {% for tag in trending_tags %} - {% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %} - + {% for tag_name in trending_tags %} + {% assign url = tag_name | slugify | url_encode | prepend: "/tags/" | append: "/" %} + {% endfor %} +
{% endif %}
- {% if page.layout == 'post' and site.toc and page.toc %} -
-

- {{- site.data.label.panel.toc -}} -

- -
+ {% if include.toc %} + + +
+ + {{- site.data.label.panel.toc | default: 'Contents' -}} + + +
{% endif %}
diff --git a/_includes/post-nav.html b/_includes/post-nav.html index 81a6231ffb6..c8a6f2e008e 100644 --- a/_includes/post-nav.html +++ b/_includes/post-nav.html @@ -1,31 +1,30 @@
{% if page.previous.url %} - +

{{ page.previous.title }}

{% else %} - +

-

{% endif %} {% if page.next.url %} - +

{{ page.next.title }}

{% else %} - +

-

{% endif %} -
\ No newline at end of file + diff --git a/_includes/post-paginator.html b/_includes/post-paginator.html index 238367d2327..484cde893e4 100644 --- a/_includes/post-paginator.html +++ b/_includes/post-paginator.html @@ -1,26 +1,19 @@ \ No newline at end of file + diff --git a/_includes/post-sharing.html b/_includes/post-sharing.html index 98197427a4a..c95a3073ee8 100644 --- a/_includes/post-sharing.html +++ b/_includes/post-sharing.html @@ -1,22 +1,17 @@ \ No newline at end of file + diff --git a/_includes/read-time.html b/_includes/read-time.html new file mode 100644 index 00000000000..f63bc3bf8a0 --- /dev/null +++ b/_includes/read-time.html @@ -0,0 +1,19 @@ + +{% assign words = include.content | strip_html | number_of_words: "auto" %} + + +{% assign wpm = 180 %} +{% assign min_time = 1 %} + +{% assign read_time = words | divided_by: wpm %} + +{% unless read_time > 0 %} + {% assign read_time = min_time %} +{% endunless %} + + + + {{- read_time -}}{{" "}}{{- site.data.label.read_time_unit | default: "min" -}} + diff --git a/_includes/refactor-content.html b/_includes/refactor-content.html new file mode 100644 index 00000000000..77e820b0cd9 --- /dev/null +++ b/_includes/refactor-content.html @@ -0,0 +1,66 @@ + + +{% assign _content = include.content %} + + +{% if _content contains '' %} + {% assign _content = _content + | replace: '
', '
' + | replace: '
', '' + | replace: '', '' + %} +{% endif %} + + +{% if _content contains '
' %}
+  {% assign _content = _content
+    | replace: '
', '' + %} +{% endif %} + + +{% if _content contains '
  • <' %} + {% assign _content = _content + | replace: '"task-list-item"><', '"task-list-item" hide-bullet><' + %} +{% endif %} + +{% if _content contains ' +{{ _content }} + +{% if lozad %} + {% include lozad.html %} +{% endif %} diff --git a/_includes/related-posts.html b/_includes/related-posts.html index d61f90fd641..be632797785 100644 --- a/_includes/related-posts.html +++ b/_includes/related-posts.html @@ -1,11 +1,6 @@ @@ -84,8 +79,9 @@ {% if index_list.size > 0 %} -