Hexo 搭建备忘

这里记载了我这几天搭建Hexo的一些重要备忘信息。


Hexo 代码

Hexo deploy 身份验证

git config --global user.name "erofish"
git config --global user.email "zhaishiba@gmail.com"

设定目录为Hexo

cd d:\Hexo

清理

hexo clean

搭建

hexo g

本地预览(debug)

hexo s

当自己比较胸有成竹的时候,也可以清理搭建预览一步到位:

hexo clean && hexo g && hexo s

上传Github

hexo d

同样,也可以清理搭建上传一步到位:

hexo clean && hexo g && hexo d

Hexo主题

主题文件是Next,安装及配置方法详见:NexT 使用文档

配置文件

站点配置文件:

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
103
104
105
106
107
# Site
title: 十八仙僧の理想国
subtitle: 思考 整理 分享
description: 基因决定人, 环境决定成长, 平台决定层次, 机遇决定成就.
author: 十八仙僧
email: zhaishiba@gmail.com
language: zh-Hans

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.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: false
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: 100
pagination_dir: page

# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme: Next

# ===================================================================================
#主题配置段开始
#====================================================================================

avatar: http://ww4.sinaimg.cn/large/84262938gw1ewzxb252mwj20go0gomxh.jpg

# 多说评论系统
#duoshuo_shortname: erofish

# 多说热评文章 true 或者 false
#duoshuo_hotartical: true

# DISQUS 帐号 (如果已经设置 多说 帐号,此选项将被跳过)
disqus_shortname: erofish

# 百度分析ID
baidu_analytics: 3e0f7bc4a598dfd178c5e45a195ba929

# 百度分享服务
baidushare: true

# Swiftype Search Key
swiftype_key: uBCMvYTzRxi2_CRLzt2g

# 站点起始时间
since: 2015


# 社交链接,将在侧栏中显示
social:
GitHub: https://github.com/erofish
Weibo: http://weibo.com/erofish
ZhiHu: http://www.zhihu.com/people/erofish

# ===================================================================================
#主题配置段结束
# ===================================================================================

# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type: git
repository: git@github.com:EroFish/erofish.github.io.git
branch: master

主题配置文件

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
# when running hexo in a subdirectory (e.g. domain.tld/blog), remove leading slashes ( "/archives" -> "archives" )
menu:
home: /
categories: /categories
#about: /about
archives: /archives
tags: /tags
#commonweal: /404.html

# Place your favicon.ico to /source directory.
favicon: /favicon.ico

# Set default keywords (Use a comma to separate)
keywords: "Hexo,next"

# Set rss to false to disable feed link.
# Leave rss as empty to use site's feed link.
# Set rss to specific value if you have burned your feed already.
rss:

# Icon fonts
# Place your font into next/source/fonts, specify directory-name and font-name here
# Avialable: default | linecons | fifty-shades | feather
icon_font: default
#icon_font: fifty-shades
#icon_font: feather
#icon_font: linecons

# Code Highlight theme
# Available value: normal | night | night eighties | night blue | night bright
# https://github.com/chriskempson/tomorrow-theme
highlight_theme: normal


# MathJax Support
mathjax: true


# Schemes
scheme: Mist


# Sidebar, available value:
# - post expand on posts automatically. Default.
# - always expand for all pages automatically
# - hide expand only when click on the sidebar toggle icon.
#sidebar: post
#sidebar: always
sidebar: hide


# Automatically scroll page to section which is under <!-- more --> mark.
scroll_to_more: true


# Automatically add list number to toc.
toc_list_number: true

# Automatically Excerpt
auto_excerpt:
enable: false
length: 150

# Use Lato font
# Note: this option is avialable only when the language is not `zh-Hans`
use_font_lato: true

# Make duoshuo show UA
# user_id must NOT be null when admin_enable is true!
# you can visit http://dev.duoshuo.com get duoshuo user id.
duoshuo_info:
ua_enable: true
admin_enable: false
user_id: 0
#admin_nickname: ROOT

## DO NOT EDIT THE FOLLOWING SETTINGS
## UNLESS YOU KNOW WHAT YOU ARE DOING

# Use velocity to animate everything.
use_motion: true

# Fancybox
fancybox: true

# Static files
vendors: vendors
css: css
js: js
images: images

# Theme version
version: 0.4.5.1

小书匠新建文章模板

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---
title: 新建文件
date: <% print((new Date()).getFullYear().toString()+ '-'+ ((new Date()).getMonth() + 1).toString() + '-'+ (new Date()).getDate().toString())
; %>

tags: [生活, 学习]
categories: 默认
toc: true
---

![][4]

这里是文章的封面、引言(摘要)。

<!--more-->

----------

图床

使用的新浪微博图床

记录工具与习惯

工具推荐使用小书匠 + CMD MarkDown。对于一些日常功能,小书匠足以应对。但是碰到一些需要书写数学公式的场合,小书匠自带的MathJax插件显得有点难以适用.这时候推荐使用CMD Markdown。