docs: update demo posts
This commit is contained in:
@ -11,31 +11,37 @@ tags:
|
||||
pin: True
|
||||
---
|
||||
|
||||
> **NOTE:** This tutorial is not fully migrated from the Jekyll version -- please reference with caution.
|
||||
{ .prompt-warning }
|
||||
|
||||
This tutorial will guide you how to write a post in the _Chirpy_ template, and it's worth reading even if you've used Jekyll before, as many features require specific variables to be set.
|
||||
|
||||
## Naming and Path
|
||||
|
||||
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION`{: .filepath} and put it in the `_posts`{: .filepath} of the root directory. Please note that the `EXTENSION`{: .filepath} must be one of `md`{: .filepath} and `markdown`{: .filepath}. If you want to save time of creating files, please consider using the plugin [`Jekyll-Compose`](https://github.com/jekyll/jekyll-compose) to accomplish this.
|
||||
Create a new file using `hugo new content/post/YYYY-MM-DD-TITLE.md`. You can change the path as you like, but note that all the posts should be placed in {{< markdown/filepath src="content/post" >}} of the root directory.
|
||||
|
||||
## Front Matter
|
||||
|
||||
Basically, you need to fill the [Front Matter](https://jekyllrb.com/docs/front-matter/) as below at the top of the post:
|
||||
Basically, the [Front Matter](https://jekyllrb.com/docs/front-matter/) is initialized by hugo as below at the top of the post:
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: TITLE
|
||||
date: YYYY-MM-DD HH:MM:SS +/-TTTT
|
||||
categories: [TOP_CATEGORY, SUB_CATEGORY]
|
||||
tags: [TAG] # TAG names should always be lowercase
|
||||
draft: true
|
||||
---
|
||||
```
|
||||
|
||||
You can add the following fields as needed:
|
||||
```yaml
|
||||
categories: [TOP_CATEGORY, SUB_CATEGORY] # only two categories are supported
|
||||
tags: [TAG] # TAG names should always be lowercase
|
||||
pin: true # it means this post will show at the top of the home page.
|
||||
description: Hello, World! # description of this post
|
||||
```
|
||||
|
||||
> The posts' _layout_ has been set to `post` by default, so there is no need to add the variable _layout_ in the Front Matter block.
|
||||
{: .prompt-tip }
|
||||
|
||||
### Timezone of Date
|
||||
|
||||
To accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`.
|
||||
{ .prompt-tip }
|
||||
|
||||
### Categories and Tags
|
||||
|
||||
@ -50,32 +56,7 @@ tags: [bee]
|
||||
|
||||
### Author Information
|
||||
|
||||
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:
|
||||
|
||||
Adding author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one).
|
||||
|
||||
```yaml
|
||||
<author_id>:
|
||||
name: <full name>
|
||||
twitter: <twitter_of_author>
|
||||
url: <homepage_of_author>
|
||||
```
|
||||
{: file="_data/authors.yml" }
|
||||
|
||||
And then use `author` to specify a single entry or `authors` to specify multiple entries:
|
||||
|
||||
```yaml
|
||||
---
|
||||
author: <author_id> # for single entry
|
||||
# or
|
||||
authors: [<author1_id>, <author2_id>] # for multiple entries
|
||||
---
|
||||
```
|
||||
|
||||
Having said that, the key `author` can also identify multiple entries.
|
||||
|
||||
> The 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.
|
||||
{: .prompt-info }
|
||||
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 in the configuration.
|
||||
|
||||
### Post Description
|
||||
|
||||
|
Reference in New Issue
Block a user