Personal blog to build a specific operation

A. Prepare the environment

1. Install node.js

Brief introduction

Because hexo is based on node.js, it is necessary to node.js installed, the installation is particularly simple, go to the official website to download their own windows version. The installation process has been the next step on the line, did not choose, in the online information when there are said to see this step in the Custom Setup remember selected the Add to the PATH , but when I installed this option is selected by default, and do not move it, maybe the version of the reasons it is recommended to look at the time of installation, configuration environment variable after all he is still a bit of trouble.

After installation, open the CMD command window and enter npm -v, if the version number appears, that the installation was successful and the environment variables configured, if it is unknown command to configure the environment variable.

Detailed Operation: https://www.cnblogs.com/pythonywy/p/11402636.html

2.git installation

https://www.cnblogs.com/pythonywy/p/11402645.html

3.hexo installation

  1. Installation Hexo, the command line (ie Git Bash) Run the following command:

    npm install -g hexo-cli 或者 npm i -g hexo

  2. Initialization Hexo, the command line (ie Git Bash) Run the following command in order to:

    Or less, that the initialization file storage path Hexo that site directory.

    $ hexo init 项目名称
    
    $ cd 项目名称
    
    $ npm install

    After the completion of the new, in the path, it will produce these files and folders:

    - node_modules:是依赖包
    - public:存放的是生成的页面
    - scaffolds:命令生成文章等的模板
    - source:用命令创建的各种文章
    - themes:主题
    - _config.yml:整个博客的配置
    - db.json:source解析所得到的
    - package.json:项目所需模块项目的配置信息

    Note :

    • hexo related commands are in the site directory under with Git Bash run.

    • Site Profile: Site directory under _config.yml.

      Pathhexo项目路径\_config.yml

    • Theme configuration file: in the site directory themesfolder under the theme folder _config.yml.

      Pathhexo项目路径\themes\<主题文件夹>\_config.yml

  3. Start the server. : In the path, the command line (ie Git Bash) Enter the following command can be run
    content hexo clean # clean up before

hexo g # to re-render html

hexo s # turn on the server

  1. Browser to access the web site: http://localhost:4000/

At this point, your Hexo blog has been set up locally.

II. Common Operation Operation

1. Replace the theme

Change theme

$ cd <博客存放的目录>
$ cd themes
$ git clone hexo中主题的Github的地址

Configuration: _config.yml the theme: Theme name

2. blog post operation

Articles placed path hexo project> source> _posts

Header: Add text at the top of the article on the basis of

---   #头尾用---分开

title: httpclent调用webservice   #文章标题

date: #文章日期格式:2018-05-30 15:20:36

tags: #文章标签

categories: #文章分类

 top:#置顶,填写阿拉伯数字按照数字进行置顶顺序排序

    
    #这里尽量空三行区分正文
---

Creating Articles

$ hexo new [layout] <title>
  • [Layout] may be the following three:
parameter name Features Article path
post New blog source/_posts
page New page (such as 404, classification) source
draft draft source/_drafts

Drafts can be published through the following command:

$ hexo publish [layout] <title>
  • title Note:

    Bowen is not a title,

    Bowen markdown is the name of the file,

    Bowen also link suffix

Article Templates

  • Create a template

    When creating a new article, Hexo based scaffoldsto create files within the folder that corresponds to the file, for example:

$ hexo new blog “simon”

When executing this line instruction, Hexo will attempt to scaffoldsfind the folder blog.md, and the establishment of the article based on its content.

  • Change parameters

    The following are variables that you can use in a template:

variable description
layout layout
title title
date File creation date

Front-matter

Bowen is at the top of ---that portion separated.

Default Front-matter can be used:

parameter description Defaults
layout layout
title title
date Creation Date File creation date
updated Updated Updated file
comments Open article Comments true
tags Label (does not apply to paging)
categories Classification (does not apply to paging)
permalink Cover article URL

Guess you like

Origin www.cnblogs.com/pythonywy/p/11402664.html