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

目录介绍

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.8.0)

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

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

1
2
3
$ hexo clean #一定要先清除,否则可能在生成的网页中出现乱码等奇怪的现象
$ hexo g
$ hexo s
hexo-configview raw
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Hexo Configuration
## Docs: http://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: 玉汝于成,功不唐捐
subtitle: 记录点滴
description: 一切都会成为过去
author: WU Chenxu
language: zh-CN
timezone: Asia/Shanghai

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://www.wuchenxu.com
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# 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
render_drafts: false
post_asset_folder: true
relative_link: false
future: true
highlight:
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: next

# Feed npm install hexo-generator-feed –-save
feed:
type: atom #atom or rss2
path: atom.xml
limit: 20

#sitemap
sitemap:
path: sitemap.xml
baidusitemap:
path: baidusitemap.xml

# Local search
# npm install hexo-generator-searchdb --save
search:
path: search.xml
field: post
format: raw
limit: 10000

# npm i hexo-symbols-count-time --save
symbols_count_time:
symbols: true
time: true
total_symbols: true
total_time: true
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
- type: git
repository: https://git.coding.net/altawu/altawu.git
branch: master
- type: git
repository: https://github.com/WuChenxu/WuChenxu.github.io.git
branch: master

reference

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