Skip to content

Commit 209b175

Browse files
committed
Merge branch 'feature/docs'
1 parent aeb2d57 commit 209b175

File tree

4 files changed

+79
-434
lines changed

4 files changed

+79
-434
lines changed

.github/CONTRIBUTING.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,42 @@
11
# How to Contribute
22

3-
I want to thank you for sparing time to improve this project! Here are some guidelines for contributing:
3+
We want to thank you for sparing time to improve this project! Here are some guidelines for contributing:
44

5-
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.
5+
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.
6+
7+
## Basic Process
68

79
Generally, contribute to the project by:
810

911
1. Fork this project on GitHub and clone it locally.
10-
2. Create a new branch from `master` and give it a descriptive name (e.g., `my-new-feature`, `fix-a-bug`).
11-
3. After completing the development, commit and push to remote.
12-
4. Submit a new pull request.
12+
2. Create a new branch from the default branch and give it a descriptive name (e.g., `my-new-feature`, `fix-a-bug`).
13+
3. After completing the development, submit a new _Pull Request_.
14+
15+
## Modifying JavaScript
16+
17+
If your contribution involves JS modification, please read the following sections.
18+
19+
### Inline Scripts
20+
21+
If you need to add comments to the inline JS (the JS code between the tags `<script>` and `</script>`), please use `/**/` instead of two slashes `//`. Because the HTML will be compressed by [jekyll-compress-html](https://github.com/penibelst/jekyll-compress-html) during deployment, but it cannot handle the `//` properly. And this will disrupt the structure of the compressed HTML.
22+
23+
### External Scripts
24+
25+
If you need to add or modify JavaScripts in the directory `_javascript`, you need to install [Gulp.js](https://gulpjs.com/docs/en/getting-started/quick-start).
26+
27+
During development, real-time debugging can be performed through the following commands:
28+
29+
```console
30+
$ bash tools/run.sh
31+
```
32+
33+
Open another terminal tab and run:
34+
35+
```console
36+
$ gulp dev # Type 'Ctrl + C' to stop
37+
```
38+
39+
After debugging, run the command `gulp` (without any argument) will automatically output the compressed files to the directory `assests/js/dist/`.
1340

1441
---
1542

README.md

Lines changed: 14 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
<div align="right">
2-
3-
EN / [中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md)
4-
5-
</div>
6-
71
<div align="center">
82

93
# Chirpy Jekyll Theme
@@ -25,99 +19,48 @@
2519
## Features
2620

2721
- Localized Layout
28-
- Configurable Theme Mode
22+
- Dark/Light Theme Mode
2923
- Pinned Posts
3024
- Hierarchical Categories
3125
- Last Modified Date for Posts
3226
- Table of Contents
33-
- Automatically Recommend Related Posts
27+
- Auto-generated Related Posts
3428
- Syntax Highlighting
3529
- Mathematical Expressions
3630
- Mermaid Diagram & Flowchart
31+
- Disqus/Utterances Comments
3732
- Search
3833
- Atom Feeds
39-
- Disqus Comments
4034
- Google Analytics
41-
- GA Pageviews Reporting (Advanced)
35+
- GA Pageviews Reporting
4236
- SEO & Performance Optimization
4337

44-
## Prerequisites
45-
46-
Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`.
47-
48-
## Installation
49-
50-
### Creating a New Site
51-
52-
There are two ways to create a new repository for this theme:
53-
54-
- [**Using the Chirpy Starter**](#option-1-using-the-chirpy-starter) - Easy to upgrade, isolates irrelevant project files so you can focus on writing.
55-
- [**Forking on GitHub**](#option-2-forking-on-github) - Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended.
56-
57-
#### Option 1. Using the Chirpy Starter
58-
59-
Create a new repository from the [**Chirpy Starter**][use-starter] and name it `<GH_USERNAME>.github.io`, where `GH_USERNAME` represents your GitHub username.
60-
61-
#### Option 2. Forking on GitHub
62-
63-
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub and rename it to `<GH_USERNAME>.github.io`. Please note that the default branch code is in development. If you want the site to be stable, please switch to the [latest tag][latest-tag] and start writing.
64-
65-
And then execute:
66-
67-
```console
68-
$ bash tools/init.sh
69-
```
7038

71-
> **Note**: If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command.
39+
## Quick Start
7240

73-
The above command will:
41+
Before starting, please follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`.
7442

75-
1. Removes some files or directories from your repository:
43+
### Step 1. Creating a New Site
7644

77-
- `.travis.yml`
78-
- files under `_posts`
79-
- folder `docs`
45+
Create a new repository from the [**Chirpy Starter**](https://github.com/cotes2020/chirpy-starter/generate) and name it `<GH_USERNAME>.github.io`, where `GH_USERNAME` represents your GitHub username.
8046

81-
2. If the option `--no-gh` is provided, the directory `.github` will be deleted. Otherwise, set up the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`.
82-
83-
3. Removes item `Gemfile.lock` from `.gitignore`.
84-
85-
4. Creates a new commit to save the changes automatically.
86-
87-
### Installing Dependencies
47+
### Step 2. Installing Dependencies
8848

8949
Before running for the first time, go to the root directory of your site, and install dependencies as follows:
9050

9151
```console
9252
$ bundle
9353
```
9454

95-
## Usage
96-
97-
### Configuration
98-
99-
Update the variables of `_config.yml` as needed. Some of them are typical options:
100-
101-
- `url`
102-
- `avatar`
103-
- `timezone`
104-
- `lang`
105-
106-
### Customing Stylesheet
107-
108-
If you need to customize the stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file.
55+
### Step 3. Running Local Server
10956

110-
Starting from [`v4.1.0`][chirpy-4.1.0], if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it.
111-
112-
### Running Local Server
113-
114-
You may want to preview the site contents before publishing, so just run it by:
57+
Run the following command in the root directory of the site:
11558

11659
```console
11760
$ bundle exec jekyll s
11861
```
11962

120-
Or run the site on Docker with the following command:
63+
Or run with Docker:
12164

12265
```console
12366
$ docker run -it --rm \
@@ -128,91 +71,13 @@ $ docker run -it --rm \
12871

12972
After a while, the local service will be published at _<http://127.0.0.1:4000>_.
13073

131-
### Deployment
132-
133-
Before the deployment begins, check out 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 starts with a slash, e.g, `/project-name`.
134-
135-
Now you can choose ONE of the following methods to deploy your Jekyll site.
136-
137-
#### Deploy by Using Github Actions
138-
139-
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 GitHub Pages service.
140-
141-
Quickly check the files needed for GitHub Actions build:
142-
143-
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
144-
145-
- Ensure your Jekyll site has file `tools/deploy.sh`. Otherwise, copy it from here to your Jekyll site.
146-
147-
- Furthermore, if you have committed `Gemfile.lock` to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lock file:
148-
149-
```console
150-
$ bundle lock --add-platform x86_64-linux
151-
```
152-
153-
After the above steps, rename your repository to `<GH_USERNAME>.github.io` on GitHub.
154-
155-
Now publish your Jekyll site by:
156-
157-
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.
158-
159-
2. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar, and then in the section **Source** of _GitHub Pages_, select the `/(root)` directory of branch `gh-pages` as the [publishing source][pages-src]. Remember to click <kbd>Save</kbd> before leaving.
160-
161-
![gh-pages-sources](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images@f4e0354b674f65a53b8917f0f786ed2956898cc1/posts/20190809/gh-pages-sources.png)
162-
163-
3. Visit your website at the address indicated by GitHub.
164-
165-
#### Manually Build and Deploy
166-
167-
On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server.
168-
169-
Go to the root of the source project, and build your site as follows:
170-
171-
```console
172-
$ JEKYLL_ENV=production bundle exec jekyll b
173-
```
174-
175-
Or build the site on Docker:
176-
177-
```console
178-
$ docker run -it --rm \
179-
--env JEKYLL_ENV=production \
180-
--volume="$PWD:/srv/jekyll" \
181-
jekyll/jekyll \
182-
jekyll build
183-
```
184-
185-
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 the target server.
186-
187-
### Upgrading
188-
189-
It depends on how you use the theme:
190-
191-
- If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`), editing the `Gemfile` and update the version number of the theme gem, for example:
192-
193-
```diff
194-
- gem "jekyll-theme-chirpy", "~> 3.2", ">= 3.2.1"
195-
+ gem "jekyll-theme-chirpy", "~> 3.3", ">= 3.3.0"
196-
```
197-
198-
And then execute the following command:
199-
200-
```console
201-
$ bundle update jekyll-theme-chirpy
202-
```
203-
204-
As the version upgrades, the critical files (for details, see the [Startup Template][starter]) and configuration options will change. Please refer to the [Upgrade Guide](https://github.com/cotes2020/jekyll-theme-chirpy/wiki/Upgrade-Guide) to keep your repo's files in sync with the latest version of the theme.
205-
206-
- If you forked from the source project (there will be `gemspec` in the `Gemfile` of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade.
207-
The merge is likely to conflict with your local modifications. Please be patient and careful to resolve these conflicts.
208-
20974
## Documentation
21075

211-
For more details and a better reading experience, please check out the [tutorials on the demo site](https://cotes2020.github.io/chirpy-demo/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Please note that the tutorials on the demo website or Wiki are based on the latest release, and the features of `master` branch are usually ahead of the documentation.
76+
For more details on usage, please refer to the tutorial on the [demo website](https://cotes2020.github.io/chirpy-demo/). At the same time, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Please note that the tutorial is based on the [latest release](https://github.com/cotes2020/jekyll-theme-chirpy/releases), and the features of the default branch are usually ahead of the documentation.
21277

21378
## Contributing
21479

215-
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).
80+
Welcome to report bugs, improve code quality or submit a new feature. For more information, see [contributing guidelines](.github/CONTRIBUTING.md).
21681

21782
## Credits
21883

@@ -234,13 +99,6 @@ If you like this theme or find it helpful, please consider sponsoring me, becaus
23499

235100
This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License.
236101

237-
[starter]: https://github.com/cotes2020/chirpy-starter
238-
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
239-
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
240-
[chirpy-4.1.0]: https://github.com/cotes2020/jekyll-theme-chirpy/releases/tag/v4.1.0
241-
[pages-src]: https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site
242-
[latest-tag]: https://github.com/cotes2020/jekyll-theme-chirpy/tags
243-
244102
<!-- ReadMe links -->
245103

246104
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy

0 commit comments

Comments
 (0)