hexo博客配置-主题管理与配置

使用git管理主题

更新远程代码到本地仓库

1
2
3
4
git fetch origin master:temp //从远程的origin仓库的master分支下载到本地并新建一个分支temp
git diff temp//比较master分支和temp分支的不同
git merge temp//合并temp分支到master分支
git branch -d temp//删除temp

如果git diff和git log没反应

1
2
3
4
git config --global core.pager 'less'
## or
git --no-pager diff
git --no-pager log

对主题进行配置的基本思路

先将主题目录结构调整如下:

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
调整前
hexo-theme-next/
layout/
_custom/
head.swig
header.swig
sidebar.swig
scripts/
source/
css/*/custom.styl

调整后:
hexo-theme-next/
layout/
_scripts/
pages/
post-details.swig (该文件已存在,但可添加对your.swig的调用)
_custom/
head.swig
header.swig
sidebar.swig
your.swig (新建,可以用来调用your.js,同时被例如post-details.swig等调用,需要去相应文件配置)
scripts/
custom/ (新建,这里的所有js会在网页生成前被自动调用,写就成,不用关心怎么调用)
yourauto.js
source/
css/*/custom.styl
custom/ (新建,这里的所有js会在网页生成后被调用,但是需要手动修改调用它的文件your.swig,添加调用)
your.js

然后来个具体案例,请看:hexo博客配置-代码块折叠

Donate comment here
xiaotiandi 微信支付

微信支付

xiaotiandi 支付宝

支付宝

xiaotiandi

公益(commonweal)微信