Hexo + NexT (a): Hexo + NexT install and set up blog on Windows

Sense and Simplicity

Read this before, it assumes that the reader has been Node.jsbased, such as the need to add Node.jsknowledge, your own Baidu.

HexoIs Node.jsa project under the framework, the use of Node.jsthe power supplied to convert from Markdown to static pages.

NexT theme is a plug-in Hexo project to provide highly customized appearance of the page.

Hexo blog index page topic

1. What we need to do

  1. Set up Node.js environment
  2. Download Hexo project
  3. Download NexT theme plugin
  4. Run blog

2. Install the Windows systemNode.js

Under Windows, Node.jsthe core is a command-line executable file Node.exe. Whether or install version green version, as long as the following two basic conditions are met, Hexoyou can run.

  1. node.exeIn the command line console of the current folder, or the system environment variables can pathbe found.
  2. Node.jsRelated toolkits (such as npm, in fact, Windows script files npm.cmd) on the command line console of the current folder or system environment variables can be pathfound.

Note : npma Node.jsbuilt-in module package management tool, with node.exethe same folder. HexoThe project also provides a command-line tool hexo.cmd. This project is shared by all instances, Hexoshould generally be installed globally. It's hexo.cmdwhere the folder should be placed in the system pathvariable.

Install Node.js

The above information is sufficient for Windows old drivers. Old drivers, please skip the rest of this.

  1. Download from http://nodejs.cn/download/ 32 or 64 zip archive version, it is recommended to install long-term support version.

  2. Unzip the download package you want to install the folder, for example D:\DevelopTools\Nodejs\.

  3. Optionally one embodiment following the Node.exepath into the system pathvariable. Modify paththe variables, only take effect in the new command window that opens.

    • Use setxthe command

      setx PATH "%PATH%;D:\DevelopTools\Nodejs\;" /M

    • Modify the registry directly

      Use Registry Editor opens HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environmentin pathan additional after variable ;D:\DevelopTools\Nodejs\;.

    • In 我的电脑the right click and select Properties, selection 高级系统设置, selection 高级, select 系统变量, in pathadding the route variables.

  4. In any manner provided the following global package mounting position, which position is assumed d:\node_global.
    • With the npmcommand npm config set prefix ="d:\node_global".
    • Directly open C:\Users\Administrator\.npmrcfiles, add or modify them prefix=d:\node_global.
  5. Referring to the embodiment 3 of the installation path Node.js global packet d:\node_globalinto the system pathvariable.

  6. Run node -vand npm -vshow the normal version of the installation is complete.

Supplementary : domestic environment to package a remote server as Taobao mirror to speed up the download speed.

  • Use the command line to run npm config set registry=https://registry.npm.taobao.org/.
  • Or, just modify the C:\Users\Administrator\.npmrcfile, add a line registry=https://registry.npm.taobao.org/.

3. Install or download Hexo project

The official recommended npmfor installation.

npm install hexo-cli -g

The above command will hexo.cmdinstall the package to the global repository, as the repository folder in the Windows system pathin. So you can perform at any position hexocommands.

Execute the following command to confirm hexoinstallation intact.

hexo -v

This command displays the hexoversion and dependent packages.

4. Install or download NexT theme plugin

By gitinstructions to download NexTthe latest theme file.

git clone https://github.com/iissnan/hexo-theme-next themes/next

Or directly from the publisher page https://github.com/iissnan/hexo-theme-next/releases download the source specified version of the source code.

Assets 2

Source code(zip)

Source code(tar.gz)

After the download, unzip the theme theme file and put it in themesthe theme file

+---public
|   +---about
|   +---archives
|   +---categories
|   +---css
|   +---images
|   +---js
|   +---lib
|   +---page
|   +---post
|   \---tags
+---scaffolds
+---source
|   +---about
|   +---categories
|   +---images
|   +---tags
|   +---_drafts
|   \---_posts
\---themes
    \---next
        +---languages
        +---layout
        +---scripts
        +---source
        |   +---css
        |   +---fonts
        |   +---images
        |   +---js

In the site configuration file _config.ymlinside, find it

# 原来的值是landscape
theme: next

5. Create and run blog

  1. Create an empty folder, as the blog root directory, in the root directory, blog initialization

    hexo init
  2. The theme files are copied to the blog file themebelow

  3. Execute Hexoserver commands provided.

    hexo serve

The console displays:

INFO  Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

In the browser address bar enter inside http://localhost:4000, you can access the blog.

Important information

This article used version of the project

hexo:3.8.0
NexT:5.1.2

Guess you like

Origin www.cnblogs.com/guide2it/p/11111457.html
Recommended