Hexo Construction

1. Personal blog in 5 minutes – Hexo

www.jianshu.com/p/390f202c5…

Rumor has it that a programmer without a personal website is not a good front-end developer, but! Strong ash fly annihilation! For their own health, or less masturbation is better! No 998, no 98, totally free, Hexo you take straight home. Hexo allows you to quickly build a personal blog and upload it to Github for others to access. Here we go!

1. Create a warehouse

If you don’t even have a warehouse, isn’t that unreasonable? Go to github and create a new repository. The repository name must be

.github. IO, where

is your github nickname. Don’t ask me why, ask me I don’t want to answer you.

2. Install Hexo globally

If you don’t even know what NPM is, sorry, our fate is over, you go. . No, no, no. Just kidding. Leave a message if you have any questions. Open the command line and enter the following command to install hexo globally.

npm install -g hexo
Copy the code

3. Initialize the project

The Just one command, hexo init, will automatically build a hexo project, then execute hexo s, and visit localhost:4000 to see the effect. The process must be fast, cold will not taste good!

Hexo init // Run hexo s locallyCopy the code

4. Deploy to Github

Although there is only one copy of Hello World, I also want to let the World see it and become the most shining cub. What can I do? Don’t panic, quickly find _congif.yml in the project root directory, find the deploy field and complete it, and start doing what you did best in school: copying!

# Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repo: < your warehouse address > # https://github.com/TJ-XiaJiaHao/TJ-XiaJiaHao.github.io branch: masterCopy the code

Copy over! But! We need an extra tool to help us push up to the warehouse, that is! It is! That’s hexo-deployer-git. Make it!

npm install hexo-deployer-git --save
Copy the code

All we need is a southeasterly wind! To automatically deploy your project to Github, execute the following two commands.

hexo clean
​
hexo deploy
Copy the code

5. Check the effect

Every serial killer likes to stay after a murder because he likes to admire his work!

Visit https://tj-xiajiahao.github.io/ to see the effect.Copy the code

Now that your personal blog is complete and accessible in your browser, here are some common wilderness survival skills.

How do I create a new article

The sun is shining, a cup of coffee is warm, a beam of sunlight is slanting, a sip of coffee is agreeable, I’m going to start a blog!

// [layout] indicates the layout. The options are 'post', 'page', and 'draft', which determine the file path of the article. // Hexo New Post <title> hexo new [layout] <title>Copy the code

Change the theme skin

Don’t like style? In another.

Change the theme process: Download theme -> Configure theme, using XOXo as an example (don’t get the wrong idea!)

# download to the themes folder git clone https://github.com/KevinOfNeu/hexo-theme-xoxo. Xoxo # modified _config yml configuration theme: the xoxoCopy the code

Deployment optimization

Instead of executing Hexo Clean and Hexo deploy every time, write a new script

// package.json
"dev": "hexo s",
"build": "hexo clean & hexo deploy"
Copy the code

The deployment command

npm run build
Copy the code

Access the review system. – Valine

Valine.js.org/quickstart….

Author: But his links: www.jianshu.com/p/390f202c5… The copyright of the book belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.

Reference article:

1. Build hexo’s personal blog

Mx142. Cn / 2021/01/14 /…

2. Personal blog in 5 minutes – Hexo

www.jianshu.com/p/390f202c5…

\