Contents
  1. 1. Readme
    1. 1.1. License

Readme

Git clone

1
$ git clone xxx

Installation:

1
2
3
4
$ npm install hexo -g #-g表示全局安装, npm默认为当前项目安装
$ cd serclenet #进入blog根目录
$ npm install #安装npm插件
$ hexo new postName #新建博文,其中postName是博文题目

博文会自动生成在博客目录下source/_posts\postName.md

1
2
3
4
5
6
#文件自动生成格式:
title: "postName" #博文题目(若有空格用""括起来)
date: {{ date }} #生成时间
author: #作者名称
tags: hexo #标签, 多个标签使用格式[Paper1, Paper2, Paper3,…]
—-

新建post之后会生成同名文件夹

1
2
3
#文件夹:
|-postName/
-postName.md

post文件夹为同名文件,作为assert folder使用
添加图片:

  1. 复制图片文件到postName/下
  2. 在post中插入代码
    1
    2
    3
    4
    5
    6
    {% asset_img git.png %}

    or more
    {% asset_path slug %}
    {% asset_img slug %}
    {% asset_link slug [title] %}

执行hexo g 后生成文件在public/下,可以部署到服务器

其他命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ hexo [option]
clean Removed generated files and cache.
config Get or set configurations.
deploy Deploy your website.
generate Generate static files.
help Get help on a command.
init Create a new Hexo folder.
list List the information of the site
migrate Migrate your site from other system to Hexo.
new Create a new post.
publish Moves a draft post from _drafts to _posts folder.
render Render files with renderer plugins.
server Start the server.
version Display version information.

如果出现如下问题:

1
2
3
{ [Error: Cannot find module./build/Release/DTraceProviderBindings’] code: ‘MODULE_NOT_FOUND’ }
{ [Error: Cannot find module./build/default/DTraceProviderBindings’] code: ‘MODULE_NOT_FOUND’ }
{ [Error: Cannot find module./build/Debug/DTraceProviderBindings’] code: ‘MODULE_NOT_FOUND’ }

Try to install with —no-optional option.

1
$ npm install hexo —no-optional

License

MIT

Contents
  1. 1. Readme
    1. 1.1. License