Column to review
Create a new article
Open the command line in the root directory of the website and create a new article using the following command:
hexo new <title>
Copy the code
Using this command, Hexo creates a new post in the /source/_posts directory:
The next step in this article is to write the article using MarkDown syntax.
Front-matter
If you open the article created by Hexo, you can see the following paragraph at the beginning of the article:
This use – the inclusion of what is called front-matter – is used to render the MD document for Hexo. In addition to these three, there are a number of configuration items you can add yourself:
Configuration items | meaning |
---|---|
title | Web article title |
date | Article creation on schedule |
comments | Whether the article comment function is enabled |
tags | The article label |
categories | The article classification |
keywords | Article keywords |
Here’s a diagram to illustrate how to use it:
MarkDown content
Hexo supports most of the MD syntax. If you’re not familiar with MD syntax, check out this tutorial:
Here I write some simple things to use as tests:
\ 'py print("Hello") \' Picture test:! [](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/9a9905261e2948f1a8a4ba59eb43f798~tplv-k3u1fbpfcp-zoom-1.image) This is an unordered list test for ## secondary headings: -ha-ha-he-ho-ho ## tertiary headings #### tertiary headingsCopy the code
Generate the article
After the article is written, first remove the old data:
hexo clean
Copy the code
This command clears the previously generated page, the public folder in the root directory of the site:
Then use the following command to generate a new page:
hexo g
Copy the code
This command will render all the MD files in the source folder to generate HTML pages and store them in the public folder:
Note: Each time you modify the article, execute these two commands to clean up the old data, and then regenerate the page.
Preview the article
After regenerating the page, we can start the server locally and preview the article to see if we are satisfied:
hexo s
Copy the code
Ok, that’s all for today’s tutorial, go and try it
For more exciting articles and resources, please pay attention to my wechat official number: “McUlover666”.