个人博客搭建hexo+github(2):配置hexo

hexo_logo.png

目录介绍

hexo directory tree
1
2
3
4
5
6
7
8
9
10
11
12
13
hexo
├── .deploy_git #hexo deploy命令部署到Github Pages上的内容
├── node_modules #hexo支持的node命令
├── public #hexo generate命令生成的静态网页内容
├── scaffolds #layout模板目录,其中的md文件可以添加或者修改
├── source #文章源码存放目录,包括markdown和html
| ├── _drafts #草稿文章
| └── _posts #发布文章
├── themes #主题文件目录
| └── next
| └── _config.yml #next主题配置文件
├── _config.yml #全局配置文件
└── package.json #应用程序数据,版本等信息

配置hexo(3.1.1)

编辑hexo目录下的_config.yml文件

Note:修改配置前,做好备份;修改后执行以下命令,验证配置。

1
2
3
$ hexo clean #一定要先清除,否则可能在生成的网页中出现乱码等奇怪的现象
$ hexo g
$ hexo s
hexo/_config.yml
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Hexo Configuration
## Docs: http://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
title: 每天进步一点点 #网页的标题
subtitle: #网页的子标题
description: #网页的描述
author: WuChenxu #作者
language: zh #语言,使用[2-lettter ISO-639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes),默认en,查看thems/yourtheme/languages下支持的语言,如next主题zh-Hans表示简体中文
timezone: Asia/Shanghai #[时区列表](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones),如Asia/Shanghai,Japan,或者UTC.
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://WuChenxu.githu.io
root: / #如果网站在子目录下,如htttp://example.org/blog,设置root: /blog/
permalink: :year/:i_month/:i_day/:title/ #The [permalink](https://hexo.io/docs/permalinks.html) format of articles, default::year/:month/:day/:title/. i_day去掉开头的0
permalink_defaults:
# Directory
source_dir: source #内容存储目录
public_dir: public #生成的静态网页存放目录
tag_dir: tags #tag存放目录
archive_dir: archives #archive目录
category_dir: categories #category目录
code_dir: downloads/code #包含的code目录,for tag plugin include_code
i18n_dir: :lang
skip_render: #不需要提交的目录,可以使用glob表达式进行路径匹配
# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0 #1-low case;2-upper case;default:0-keep as it is
render_drafts: false #显示drafts吗?
post_asset_folder: true #使用asset文件夹吗?asset指图片,pdf等插入到文章的文件,default:false
relative_link: false #make links relative to the root folder?default:false
future: true #显示future post吗?
highlight: #code block设置
enable: true
line_number: true
auto_detect: true
tab_replace:
# Category & Tag
default_category: uncategorized
category_map:
tag_map:
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
# Pagination #页码标注
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page
# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme: hexo-theme-next #选择主题
# Deployment
## Docs: http://hexo.io/docs/deployment.html
## 提交到多个repo
- type: git
repository: https://github.com/WuChenxu/WuChenxu.github.io.git
branch: master
- type: git
repository: https://git.coding.net/altawu/altawu.git
branch: master

reference

  1. Hexo doc
  2. asset_folder管理图片等资源
  3. hexo基本用法
  4. asset用法