After treading trails and reviewing various documentation, I built Hexo, which I downloaded with the latest versions of Node and Hexo.


What is a Hexo?

Hexo is a fast, concise and efficient Node.js-based static blogging framework that uses Markdown to parse articles and generate static pages with beautiful themes in seconds.


The environment

  • Node.js(for generating static pages) official website
  • Git(for submitting local hexo content to Github
  • Github official website (remote repository, domain, server, etc.

Create a local folder, such as blog, as the root directory of Hexo, with a set of configuration files, where all operations will be performed. Then right-click to open GitBash in the blog and install Hexo.

1. Install Hexo

$ npm install -g hexo-cli
Copy the code

2. Initialize Hexo

$ hexo init
Copy the code

At this point, the installation is complete!


Run the following command (usually abbreviated) to test the blog locally: 1. Generate static pages

$ hexo generate
Copy the code

2. Start the local server

$ hexo service
Copy the code

Browser access. By default, the url is:

http://localhost:4000/
Copy the code

Deployment to making

1. Create a new Repositiry repository name that must be “username.github. IO”, the sole remaining one I trod, and if inconsistent the last domain name appears on page 404 ** when visited by browsers

2. Set GitHub Pages


3. Upload the local file to the GitHub account

Edit the _comfig. Yml file at the root of your local blog, open it, drag it to the back and add the following code. Repo is the address, there are two protocols, depending on your mood, which one you prefer. Message can be left out. The most important thing to note is !!!! You need to leave a space behind every colon in your yML file (otherwise you’ll end up with all sorts of weird bugs like I did, this is my second hole), such as type: git (always leave a space after the colon and add git).

deploy:
  type: git repo: https://github.com/NIIT123456/NIIT123456.github.io.git branch: master message: one for the record on pit filling holes and the journey of lifeCopy the code

4. Submit the command to install the dependency package

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

Fsevent is a MAC osx operating system that is running on Windows or Linux, so there will be warnings.

Then execute the deploy website command (abbreviation in parentheses)

$ hexo deploy
Copy the code

Then type in your browserniit123456.github.io/Just change my niIT123456 to your Github account name

Each deployment Step

Three steps:

$ hexo clean
Copy the code
$ hexo generate
Copy the code
$ hexo deploy
Copy the code

//(^v^)\~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~~ ~~