Set up a blog locally with Hexo

Required environment nodeJS

  1. Install nodeJS. Select the version on your PC to download and install nodeJS

  2. Install Git fool-install

  3. Install Hexo’s scaffolding tool Hexo – CLI using NPM

 npm install -g hexo-cli
Copy the code

Quick start

  1. Open a terminal in any folder and type
Hexo I blog // Init Blog is the name of the projectcdBlog // Switch to the site root directory hexo g // Generetor abbreviation hexo s //server abbreviationCopy the code

Open your browser and enter localhost:4000 to view:

This is hexo’s default blog theme. Now you can blog about this topic.

Of course, I don’t like this, but fortunately, github has a huge selection of themes to choose from, so I chose to use the nexT theme here.

Select the theme – nexT

  1. In the root directoryblogThe input
git clone https://github.com/iissnan/hexo-theme-next
Copy the code
  1. When this is done, this means that the theme has been installed, and you only need to customize the theme, go to _config.yml under thems/ Next, and this is the theme configuration file

Then customize your own content, find the thems field and set it to Next;

  1. Input at terminal
Hexo clean // Clean the cache hexo g // regenerate the code hexo S // deploy it locallyCopy the code

// Then open a browser and go to localhost:4000 to see the effect

There are three options for the nexT theme, and this is just the simplest one. Let’s choose the one that looks best.

Muse - The default Scheme, this was the original NexT version, with a black and white accent and a compact version of Mist - Muse with plenty of white space. The neat, single-column look of Pisces - Double-column Scheme, the freshness of a small houseCopy the code
  1. Configuration next

Of course, you can do a lot of customization and even modify the source code to customize your own theme. For more information, please refer to the official documentation

http://theme-next.iissnan.com/getting-started.html

Upload a local blog to Github without saying much, and get started.

Deploy your blog to Github

  1. Create a Github account address: Github

  2. Create a new repository called yourname.github. IO, where yourname is your Github name

  1. Enter the project name in format

  1. Click Settings to create a page

  1. Set the dead simple pages

Next we deploy our Hexo code to Github.

  1. Modify the configuration file of the Hexo site

I’ll do it like this. Save it.

Attention!! There must, must be a space after the colon!!

  1. Just deploy it to Github

NPM install hexo-deployer-git –save

To publish your first blog post, type in the root directory:

hexo new "postName"// Hexo n can also // your own blog name, a file named postname. md will be built in the directory // directory /blog/source/ _posts.Copy the code

After the article is edited, the terminal runs the following command in the root folder to publish the article:

Hexo g // Generate static page hexo d // publishCopy the code

Now check it out: your personal blog has been created

It’s already posted.

Refer to the link

  1. https://geeksblog.cc/hexo-theme.html;
  2. https://blog.csdn.net/Hoshea_chx/article/details/78826689
Note: Images are partly from the Internet