Use Hexo to build a personal blog under Mac

Source: Internet
Author: User
Tags install node homebrew cask

Hexo Introduction

  • Using the original author's sentence: A fast,simple&powerful blog framework,powered by node. js
  • Hexo is a node. JS-based blogging platform, Hexo is a static HTML file that is deployed to each hosted platform to complete the release, with its official address: https://hexo.io/zh-cn/

Environment preparation

Note: If not FQ, may download the speed will be slower, personal use smarthost pressure-free building or Baidu use SS paper aircraft, about how to use the Smarthost link can be found in my blog

Install the MAC Package Manager homebrew, enter the instructions through the terminal

Install another Package Manager homebrew Cask, which automatically configures the environment variables to use the Package Manager that you just installed

Install node. JS through Package Manager

Install Git

Review the installed version to verify that the installation is correct

Installing Hexo

Install Hexo, execute the following command

Create a directory to place your Hexo blog, then enter the directory you created through the terminal, initialize the site

After initializing the site, you will be prompted to execute the NPM install to complete all configurations

When the above operation is complete, the installation and initialization of the Hexo is completed, and the next step is to test the

Test Hexo

After the entire configuration is complete, open the terminal and enter the following command to run the local service test

Enter Http://localhost:4000/to open the default page

Hexo Folder directory structure

  • Source: Blog Resource folder
  • Source/_drafts: Drafts folder
  • Source/_posts: Article folder
  • Themes: the folder where the theme is stored
  • Themes/landscape: The default theme
  • _CONFIG.YML: Global configuration file

Deploy to GitHub Pages

Blogs are posted on GitHub pages for extranet access, and of course you can deploy to other servers, using the Github pages service:

  • Open a GitHub account, such as my account name Csdnhensen, which will be used later
  • Create a repository with the same name as the account name, and then end with. Github.io

  • Modify configuration file: _config.yml, the entire site configuration is here, open the _config.yml file
  • Locate the following statement, and then modify your information, repository can be duplicated in the GitHub repository

  • If you want to modify a theme, simply clone the theme file to the themes directory and modify the _CONFIG.YML configuration file to

For example, enter Hexo's themes directory and execute the following command

Then modify the configuration file's theme parameter to Jacman, about more topics Https://github.com/hexojs/hexo/wiki/Themes

New Blog

Site is ready, the next is to create a blog, publish a blog There are two ways, one through the command to generate a blog template, the other is to direct the markdown document to use

  • Command line Generation

The newly generated article will be saved in the/source/_posts directory, open the generated template, the content is as follows

This is the default format for generating documents, and below the split line, you can write in the normal markdown format.

  • Document copy: You can also copy the markdown to the/source/_posts directory

Build Blog

Added blog post, need to submit to server, Old man costume enter the following instructions to complete the blog generated static HTML file

Publish Blog to server

Installing the Hexo-deployer-git tool, entering instructions

Submit to the server, you will also need to enter the GitHub account and password during the submission process

At this point you can open your GitHub, go to Repository's setting page, and slide down to see where your profile page will appear

Shortcut commands

Hexo Common Commands

Start these commands have shortcut commands

All the operation is over here, thanks for watching.

Use Hexo to build a personal blog under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.