The basic operation of writing articles in Hexo

Write articles with [hexo]

step 1

Open the [root directory] of hexo , which is the one with _config.yml, source, themes, etc. For me, I call him myblog

Step 2

Open git bash in this directory, execute the code, and open it in the browser to http://localhost:4000/view your website in real time. (Note: At this time [, the external network] cannot access the local modifications, and can only be accessed after submitting.)

hexo server

Step 3 (At this time, perform the following operations in the root directory)

Create a new post page

After executing the \myblog\source\_postsfollowing create a new one a.mdwith the title “a”. At this time, refresh and http://localhost:4000/you can see that the article with the title a has been updated locally.

hexo new a

New draft (draft page)

After executing the \myblog\source\_draftsfollowing create a new one b.mdwith the title “b”. At this time, refreshing the http://localhost:4000/local does not update this article.

hexo new draft b

Post draft

Drafts can be turned into published articles through commands, but you still need to execute the following commands in the root directory

hexo publish b

At this time, you will find that in _drafts is gone, and it goes to _posts, which means that your draft has been published successfully.

normal page

This form is similar to articles like “About”, “Know Us”, etc.

hexo new page c

Create a page titled c

Different from the first two, this command will create a c folder in the source folder, side by side with _posts, _drafts. Inside the folder is an file.

Note: After refreshing the page, c does not appear in the page, but needs to be accessed http://localhost:4000/c/to see it.

Generate and deploy articles

hexo generateAs the name suggests, to generate static articles, you can use the hexo gabbreviation

hexo deployDeploy articles, you can use hexo dabbreviations

After writing the article or modifying the configuration, although http://localhost:4000/the content can be accessed after the service is turned on, it cannot be accessed through the external network https://{GitHubUserName} a custom URL. Only through the above two commands can it be accessed on the external network.

Shorthand (generally writing essay commands)

# Start the service 
hexo  server 

# Create a new article 
hexo  new a 

# Create a new draft 
hexo  new draft b 

# Publish a draft as an article 
hexo  publish b 

# Publish about 
hexo  new page c 

# Generate a static article 
hexo  generate or hexo g 
# Deploy an article 
hexo  deploy or hexo d

complete version:

title:  I am the title 
date:  2021 -09 -25  23 :32:04 
comments:  true #Can  you comment 
layout:  post  # Public article 
toc:  true #Whether  to display the article directory 
tags: #Tags    - I am new Tab 1 - Lao Tzu is the new Tab 2 ---

Simplified version:

comments:  true #Whether  you can comment 
layout:  post  # Public article 
toc:  true #Whether  to display the article directory 
tags: #Tags    - I am the new tag 1 - Lao Tzu is the new tag 2 ---

Reference for this article:
/article/details/40684575 ?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-5.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-5.no_search_link

<!-- more --> 
After this tag is placed in the article, only the first half will be displayed if you don't click it.

Leave a Comment

Your email address will not be published. Required fields are marked *