You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2019-08-08-write-a-new-post.md
+45-3Lines changed: 45 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ tags: [writing]
7
7
8
8
## Naming and Path
9
9
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.
11
11
12
12
## Front Matter
13
13
@@ -18,15 +18,57 @@ Basically, you need to fill the [Front Matter](https://jekyllrb.com/docs/front-m
18
18
title: TITLE
19
19
date: YYYY-MM-DD HH:MM:SS +/-TTTT
20
20
categories: [TOP_CATEGORIE, SUB_CATEGORIE]
21
-
tags: [TAG]
21
+
tags: [TAG]# TAG names should always be lowercase
22
22
---
23
23
```
24
24
25
25
> **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.
26
26
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
+
27
31
-**Categories and Tags**
28
32
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 }}).
0 commit comments