Use Hexo to build a GitHub blog under Linux

Source: Internet
Author: User

Find a reliable blog, back up:

---------the following original------------------

Nodejs Installation

Because Hexo is based on Nodejs applications, it is only possible to install Nodejs first. I'm taking Ubuntu as an example, because I've been using Ubuntu myself. You can use the following command:

    1. sudo apt-get install nodejs
    2. sudo apt-get install npm

Hexo Installation

Hexo is a powerful static website generation system, fast, concise and efficient. Hexo supports all the features of GitHub flavored Markdown, and can even integrate most of the octopress plugins. You can deploy to GitHub with a single click, plus a wide range of plugins and themes, as well as support for hot deployment. Execute the following command to install.

    1. sudo npm install hexo-cli -g

Quick Start

After installing Hexo Ancheng, use the following command to quickly create a new blog system, and then run it:

    1. hexo init blog
    2. cd blog
    3. npm install
    4. hexo server

If the NPM installation fails, use sudo to install it. After running successfully, visit Http://0.0.0.0:4000/can see the appearance of the blog, right is my current blog this look, O (∩∩) o ... Ha ha.

Now let's look at the directory structure of the Hexo build blog:

  1. .
  2. ├── _config<span class="class">.yml</span>
  3. ├── db<span class="class">.json</span>
  4. ├── node_modules
  5. ├──package<span class="class">.json</span>
  6. ├──public
  7. ├── scaffolds
  8. ├── source
  9. └── themes

Where _config.yml is the file that configures the site, public is the static site folder that Hexo generates, scaffolds is the template folder, source is the folder where the user resource exists, and themes is the theme folder.

Site Configuration

Locate the Title,subtitle,author parameter configuration, configure the site's title, subtitle, and author separately, for example, I am here:

    1. title:飞雪无情的博客
    2. subtitle:专注于Android、Java、移动互联网、项目管理、软件架构
    3. description:
    4. author:飞雪无情
    5. language: zh-CN

Then configure the site URL and permalink, which are the URL of your site host address and the article's permanent connection, I here are:

    1. url: http://www.flysnow.org
    2. root:/
    3. permalink::year/:month/:day/:title.html
    4. permalink_defaults:

Permalink I configured is month day and title, suffix is html, easy to search ingest. Permalink details see: http://hexo.io/zh-cn/docs/permalinks.html

A new article

Use the following command to add an article in MD format:

    1. hexo new‘github-page-with-hexo‘

A markdown file named Github-page-with-hexo.md is then generated in sources/_posts. Edit the file to write a blog. Here are some front-matter need to be introduced, you can configure the template used in the article, the classification and tag belong to.

Front-matter is the area at the top of the file, separated by--to specify the variables for the individual file, for example:

  1. title:"使用Hexo在Github上搭建自己的博客"
  2. date:2015-03-1022:30:04
  3. tags:
  4. -Hexo
  5. -Github
  6. categories:
  7. -Hexo
  8. ---

Note that the current categories can only have one level classification, and if you fill in more than one, the second one will be resolved to a level two classification, and so on. Tags can be allowed to have multiple. For more information about Front-matter please refer to http://hexo.io/zh-cn/docs/front-matter.html.

Publish to GitHub page

First you have created your GitHub page corresponding to the GIT library, not created by Google related blogs. Then create a new Hexo branch that holds all the files you hexo now. Then execute the following command to clean up and generate the published static site files.

    1. hexo clean
    2. hexo generate

Then put the files in the generated public directory under your master branch. Git commits to push these two branches onto your GitHub. GIT library structure can be found in my GitHub page library Https://github.com/rujews/rujews.github.io.

At last

Then wait a few minutes and visit your domain to see your website. such as http://www.flysnow.org/. For more hexo Please refer to the Official document Http://hexo.io/zh-cn/docs/.

This article permanently updates the link address : http://www.linuxidc.com/Linux/2015-07/120846.htm

Use Hexo to build a GitHub blog under Linux

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.