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
+20-9Lines changed: 20 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,6 @@
1
1
---
2
2
title: Writing a New Post
3
-
author:
4
-
name: Cotes Chung
5
-
link: https://github.com/cotes2020
3
+
author: cotes
6
4
date: 2019-08-08 14:10:00 +0800
7
5
categories: [Blogging, Tutorial]
8
6
tags: [writing]
@@ -50,14 +48,27 @@ tags: [bee]
50
48
51
49
The author information of the post usually does not need to be filled in the _Front Matter_ , they will be obtained from variables `social.name` and the first entry of `social.links` of the configuration file by default. But you can also override it as follows:
52
50
51
+
Add author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one.)
52
+
53
+
```yaml
54
+
<author_id>:
55
+
name: <full name>
56
+
twitter: <twitter_of_author>
57
+
url: <homepage_of_author>
58
+
```
59
+
{: file="_data/authors.yml" }
60
+
61
+
And then set up the custom author in the post's YAML block:
62
+
53
63
```yaml
54
64
---
55
-
author:
56
-
name: Full Name
57
-
link: https://example.com
65
+
author: <author_id>
58
66
---
59
67
```
60
68
69
+
> Another benefit of reading the author information from the file `_data/authors.yml`{: .filepath } is that the page will have the meta tag `twitter:creator`, which enriches the [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started#card-and-content-attribution) and is good for SEO.
70
+
{: .prompt-info }
71
+
61
72
## Table of Contents
62
73
63
74
By default, the **T**able **o**f **C**ontents (TOC) is displayed on the right panel of the post. If you want to turn it off globally, go to `_config.yml`{: .filepath} and set the value of variable `toc` to `false`. If you want to turn off TOC for a specific post, add the following to the post's [Front Matter](https://jekyllrb.com/docs/front-matter/):
@@ -221,12 +232,12 @@ The output will be:
221
232
222
233
### Preview Image
223
234
224
-
If you want to add an image to the top of the post contents, specify the attribute `src`, `width`, `height`, and `alt` for the image:
235
+
If you want to add an image to the top of the post contents, specify the attribute `path`, `width`, `height`, and `alt` for the image:
225
236
226
237
```yaml
227
238
---
228
239
image:
229
-
src: /path/to/image/file
240
+
path: /path/to/image/file
230
241
width: 1000 # in pixels
231
242
height: 400 # in pixels
232
243
alt: image alternative text
@@ -235,7 +246,7 @@ image:
235
246
236
247
Except for `alt`, all other options are necessary, especially the `width` and `height`, which are related to user experience and web page loading performance. The above section "[Size](#size)" also mentions this.
237
248
238
-
Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height`→ `h`, `width` → `w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `src` only needs the image file name.
249
+
Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height`→ `h`, `width` → `w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name.
0 commit comments