Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。
这是一篇关于Hexo博客系统如何使用的文章,最基本的操作指令。

Hexo基本指令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Usage: hexo <command>

Commands:
clean Remove generated files and cache.
config Get or set configurations.
deploy Deploy your website.
douban Generate pages from douban
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.

Global Options:
--config Specify config file instead of using _config.yml
--cwd Specify the CWD
--debug Display all verbose messages in the terminal
--draft Display draft posts
--safe Disable all plugins and scripts
--silent Hide output on console

编译博客

在项目根目录执行命令

1
2
3
hexo generate
或者
hexo g

本地运行博客

在项目根目录执行命令

1
2
3
hexo server
或者
hexo s

发布博客

在项目根目录执行命令

1
2
3
hexo deploy
或者
hexo d

发布新页面

  1. 项目根目录下执行

    1
    hexo new page xxx
  2. 在项目source目录下会产生xxx页面的文件夹,在xxx文件夹下的index.md文档中编辑页面配置

  3. 页面头部信息

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ---
    title:
    date:
    updated:
    type:
    comments:
    description:
    keywords:
    top_img:
    mathjax:
    katex:
    aside:
    aplayer:
    highlight_shrink:
    ---
    写法 解释
    title 【必需】页面标题
    date 【必需】页面创建日期
    type 【必需】标籤、分类和友情链接三个页面需要配置
    updated 【可选】页面更新日期
    description 【可选】文章描述
    keywords 【可选】文章关键字
    comments 【可选】显示页面评论模块(默认 true)
    top_img 【可选】页面顶部图片
    comments 【可选】显示文章评论模块(默认 true)
    mathjax 【可选】显示mathjax(当设置mathjax的per_page: false时,才需要配置,默认 false)轉載請註明出處。
    katex 【可选】显示katex(当设置katex的per_page: false时,才需要配置,默认 false)
    aside 【可选】显示侧边栏 (默认 true)
    aplayer 【可选】在需要的页面加载aplayer的js和css,请参考文章下面的音乐 配置
    highlight_shrink 【可选】配置代码框是否展开(true/false)(默认为设置中highlight_shrink的配置)

发布新文章

  1. 项目根目录下执行

    1
    hexo new post xxx
  2. 在项目source/_posts目录下会产生xxx.md文档,在文档头部中编辑文章配置

  3. 文章头部信息

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    ---
    title:
    date:
    updated:
    tags:
    categories:
    keywords:
    description:
    top_img:
    comments:
    cover:
    toc:
    toc_number:
    auto_open:
    copyright:
    mathjax:
    katex:
    aplayer:
    highlight_shrink:
    ---
    写法 解释
    title 【必需】文章标题
    date 【必需】文章创建日期
    updated 【可选】文章更新日期
    tags 【可选】文章标籤
    categories 【可选】文章分类
    keywords 【可选】文章关键字
    description 【可选】文章描述
    top_img 【可选】文章顶部图片
    cover 【可选】文章缩略图(如果没有设置top_img,文章页顶部将显示缩略图,可设为false/图片地址/留空)
    comments 【可选】显示文章评论模块(默认 true)
    toc 【可选】显示文章TOC(默认为设置中toc的enable配置)
    toc_number 【可选】显示toc_number(默认为设置中toc的number配置)
    auto_open 【可选】是否自动打开TOC(默认为设置中toc的auto_open配置)
    copyright 【可选】显示文章版权模块(默认为设置中post_copyright的enable配置)
    mathjax 【可选】显示mathjax(当设置mathjax的per_page: false时,才需要配置,默认 false)轉載請註明出處。
    katex 【可选】显示katex(当设置katex的per_page: false时,才需要配置,默认 false)
    aplayer 【可选】在需要的页面加载aplayer的js和css,请参考文章下面的音乐 配置
    highlight_shrink 【可选】配置代码框是否展开(true/false)(默认为设置中highlight_shrink的配置)

更详细博客配置请参考Hexo
更详细主题配置请参考Butterfly