Deploy your own blog through hexo

Deploy your own blog through hexo

Local deployment

Download and install node.js

打开网站 nodejs.orj 下载安装即可

Operation in cmd

Check if node is installed successfully

node -v

Check whether npm is installed successfully (it is best to replace it with a domestic source (such as Ali source), otherwise the speed will be slower)

npm -v

Install hexo

npm install -g hexo-cli

Verify that the installation is successful

hexo -v
# 不报错即成功

Create a folder where the blog is located (no demo)

Enter the folder in cmd

cd blog

Initialize hexo (wait patiently for this)

hexo init

After success, these files will appear in the folder
1587608888795)(/images/1584679236566

Start hexo

hexo s

New article

hexo n "我的第一篇博文"

Generate

hexo g

Open the corresponding URL in the browser and the blog homepage will appear

github deployment

But such a blog is a local way, how do we upload the blog to the Internet?

Can be hosted on github (the operation of git is done by Baidu)

Create a warehouse named "your username.github.io" in github

First download a plugin

npm install --save hexo-deployer-git

This kind of error can be ignored

5 packages are looking for funding
  run `npm fund` for details

found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

Settings file _config.yml
Insert picture description here

Change it in the following format. The red box is the website of your own github warehouse. Note that there is a space after the colon

Deploy to remote

hexo d

Then visit the URL "your username.github.io" in your browser to open your personal blog smoothly!

ps: If you open this website and display 404, there are the following possibilities

  • github warehouse naming format error
  • There is no space after the colon in the _config.yml file
  • git problem, you can delete all the things in the blog folder and try again

Change theme

A topic recommended by codesheep

https://github.com/litten/hexo-theme-yilia

There are usage steps inside, you can also follow the operation below me

Download themes:

git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia

Modify the _config.yml file

Find the theme and change the following theme to yilia (if it is another theme, change it to the corresponding theme)

更新三部曲
hexo clean
hexo g
hexo s
然后可以在本地端生效
# 推送到远端
hexo d
可以在远端生效了(可能要稍微等一下)

Guess you like

Origin blog.csdn.net/qq_44082148/article/details/105701445