Install the NodeJS environment

After the installation is complete, run the following command to check whether the environment variable is successfully installed:

Lambda node - v#Output version number
v12.13.1
Copy the code

Enter the correct version number.

Install CNPM

CNPM is a taobao mirror, which can speed up the installation of dependencies

npm install cnpm -g --registry=https://registry.npm.taobao.org

#The outputC:\Users\ XXXXX \AppData\Roaming\ NPM \ CNPM -> C:\Users\ XXXXX \AppData\Roaming\ NPM \node_modules\ CNPM \bin\ CNPM + [email protected] Added 680 packages from 933 polymorphism in 24.882sCopy the code

other

Git and GitHub won’t go into details

Install Hexo

cnpm install -g hexo-cli
Copy the code

You can run the following command to check whether the installation is successful

λ hexo -v "node" "C:\Users\ XXXXXX \AppData\Roaming\ NPM \node_modules\hexo-cli\bin\hexo" -v hexo-cli: 3.1.0 OS: Windows_NT 10.0.18362 win32 x64 node: 12.13.1 V8:7.7.299.13-node.16 UV: 1.33.1 zlib: 1.2.11 brotli: 1.0.7 ares: 1.15.0 modules: 72 nGHttp2:1.39.2 nAPI: 5 LLHTTP: 1.1.4 http_parser: 2.8.0 OpenSSL: 1.1.1d CLDR: 35.1 ICU: 64.2 TZ: 2019 c unicode: 12.1Copy the code

Create a local blog

hexo init gitpage
Copy the code

If the following message is displayed, initialization is successful

The contents of the directory after execution

Go to the gitPage directory and run the following command

cd gitpage
cnpm install
Copy the code

This completes the Hexo installation.

The basic usage of Hexo

Start the

hexo server 
# or
hexo s
Copy the code

To view the results, visit http://localhost:4000 via your browser:

A new blog

hexo new "My First Post"
Copy the code

Under source_posts, there will be a my-first-post.md file. Edit the file and save it.

Go back to the command line and type

hexo g

Copy the code

Creating a static file

Start the server and view the result

hexo server

Copy the code

After you launch, you can see your newly created article.

Deployment to making

Create a repository on GitHub called ”

.github. Copy warehouse address. Open the _config.yml file in the gitPage directory, find #Deployment and fill in the following:

deploy:  
	  type: git  
	  repository: https://github.com/Happy4Java/happy4java.github.io.git
	  branch: master

Copy the code

Save, then execute the following statement on the command line:

cnpm install hexo-deployer-git --save

Copy the code

After executing, you can execute the deployment command:

hexo d

Copy the code

You may need to enter the Github account password to complete the deployment.

See the effect

Visit https://happy4java.github.io to see the effect.

Using the Next theme

Go to the Themes folder under the gitPage folder and run

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

Copy the code

In this way, the files for the theme are all cloned under gitPage \themes\ Next.

Modify the blog profile

  • Open the _config.yml configuration file
  • findtheme:
  • Change Hexo’s default lanscape to hexo-theme-next.
  • find# Site, add blog name, author name, etc.
  • inlanguageType en or zh-cn after it. Choose English or Chinese.
  • find# URL, fill in the URL. Such asurl: https://happy4java.github.io

Rebuild the deployment

hexo g
hexo d

Copy the code

Visit https://happy4java.github.io to view results

Original statement

This article is [Happyjava] original, welcome to reprint, but need to cite the source