Skip to content

Commit 89b93bc

Browse files
committed
Update tutorial.
1 parent d1adf95 commit 89b93bc

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

_posts/2019-08-08-write-a-new-post.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tags: [writing]
77

88
## Naming and Path
99

10-
Create a new file name with the format `YYYY-MM-DD-title.md` then put it into `_post` of the root directory.
10+
Create a new file named with the format `YYYY-MM-DD-title.md` then put it into `_post` of the root directory.
1111

1212
## Front Matter
1313

@@ -18,15 +18,57 @@ Basically, you need to fill the [Front Matter](https://jekyllrb.com/docs/front-m
1818
title: TITLE
1919
date: YYYY-MM-DD HH:MM:SS +/-TTTT
2020
categories: [TOP_CATEGORIE, SUB_CATEGORIE]
21-
tags: [TAG]
21+
tags: [TAG] # TAG names should always be lowercase
2222
---
2323
```
2424

2525
> **Note**: The posts' ***layout*** has been set to `post` by default, so there is no need to add the variable ***layout*** in Front Matter block.
2626
27+
- **Timezone of date**
28+
29+
In order to accurately record the release date of a post, you should not only setup the `timezone` of `_config.yml` but also provide the the post's timezone in field `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`.
30+
2731
- **Categories and Tags**
2832

29-
The `categories` of each post is designed to contain up to two elements, and the number of elements in `tag` can be zero or infinite.
33+
The `categories` of each post is designed to contain up to two elements, and the number of elements in `tags` can be zero to infinity.
34+
35+
The list of posts belonging to the same category/tag is recorded on a separate page. The number of such *category*/*tag* type pages is equal to the number of `categories`/`tags` for all posts, they must match perfectly.
36+
37+
let's say there is a post with front matter:
38+
```yaml
39+
categories: [Animal, Insect]
40+
tags: bee
41+
```
42+
43+
then we should have two *category* type pages placed in folder `categories` of root and one *tag* type page placed in folder `tags` of root:
44+
```terminal
45+
jekyll-theme-chirpy
46+
├── categories
47+
│   ├── animal.html
48+
│   └── tutorial.html
49+
├── tags
50+
│  └── bee.html
51+
```
52+
53+
and the content of a *category* type page is
54+
```yaml
55+
---
56+
layout: category
57+
title: CATEGORY_NAME # e.g. Insect
58+
category: CATEGORY_NAME # e.g. Insect
59+
---
60+
```
61+
62+
the content of a *tag* type page is
63+
```yaml
64+
---
65+
layout: tag
66+
title: TAG_NAME # e.g. bee
67+
category: TAG_NAME # e.g. bee
68+
---
69+
```
70+
71+
With the increasing number of posts, the number of categories and tags will increase several times! If we still manually create these *category*/*tag* type files, it will obviously be a super time-consuming job, and it is very likely to miss some of them(i.e. when you click on the missing `category` or `tag` link from a post or somewhere, it will complain to you '404'). The good news is that we got a lovely script tool to finish the pages creation stuff: `tools/init.sh`. See its usage [here]({{ "/posts/getting-started/#option-1-built-by-github-pages" | relative_url }}).
3072

3173
## Table of Contents
3274

0 commit comments

Comments
 (0)