配置主题 搜索一个好看的主题,按照官网上的操作安装,更新。 我使用的是xiangming 制作的landscape-plus . 当然还是在D:\hexo
目录下,安装:1
git clone https://github.com/xiangming/landscape-plus.git themes/landscape-plus
然后修改主题的设置文件_config.yml,把theme的值设置为landscape-plus
启用指定主题: 如果你安装了多个主题的话,那么可以编辑站点的_config.yml
文件,在里面修改: theme: 你的指定主题
配置时注意有两个_config.yml
文件,一个在D:\hexo
目录下,是整个站点的配置;第二个在D:\hexo\themes\landscape-plus
目录下,是主题的配置。 修改D:\hexo\_config.yml
站点配置: 第15行:url: http://starwindy.oschina.io
1
2
3
4
5
6
7
2: Enable pagination
1: Disable pagination
0: Fully Disable
archives: 1
category: 1
tag: 1
接下来修改D:\hexo\themes\landscape-plus\_config.yml
主题配置: 按你喜欢,把menu中相应的英语改成中文。1
2
3
4
menu:
首页: /
文章列表: /archives
关于: /about
还有第11行:excerpt_link: 阅读全文
其他默认即可。
配置插件 1
2
3
$ npm install hexo-generator-feed --save
$ npm install hexo-generator-sitemap --save
然后修改D:\hexo\_config.yml
站点配置,添加:
# Extensions
Plugins:
- hexo-generator-feed
- hexo-generator-sitemap
#Feed Atom
feed:
type: atom
path: atom.xml
limit: 20
#sitemap
sitemap:
path: sitemap.xml
然后注意再修改D:\hexo\themes\landscape-plus\_config.yml
主题配置:menu:
里添加网站地图: /sitemap.xml
下面也添加rss: /atom.xml
(如果有就不用添加了)。 部署后就能看到“首页”那一栏多了个“网站地图”,点击后有内容且第一行为This XML file does not appear to have any style information associated with it. The document tree is shown below.
就说明成功了。 RSS也是一样。
另外,附一下升级和卸载的命令行:
升级插件:
npm update
卸载插件(比如卸载RSS插件):
npm uninstall hexo-generator-feed
当然,卸载插件还有更简单的办法,就是去D:\hexo\node_modules
目录下,直接删除你要卸载的插件文件夹即可。 安装插件也可以粘贴事先备份好的某个插件的文件夹。
安装多说评论系统 实际上landscape-plus主题已经集成了多说评论系统,我们只需要添加duoshuo_shortname
到两个配置文件即可。
多说shortname是什么 多说shortname
其实就是你注册多说时的用户名(账号),也就是当你使用豆瓣或微博账号注册多说时(因为多说没有邮箱注册),它要你注册一个多说域名,即 XXX.duoshuo.com,这个XXX就是你的多说shortname
.
接下来在主题配置文件和站点配置文件里都加入:
即可。注意XXX和冒号之间有个空格。
备份 平时备份时注意备份站点和主题的_config.yml
文件,还有自己写的文章(在D:\hexo\source\_posts
里)和其他一些文件。在这里贴出我的站点和主题的_config.yml
文件,也算是备份吧。
站点_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
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
108
title: 璀璨星空 ● 无垠宇宙
subtitle: 耐心 谦虚 平静
description: 璀璨星空的博客
author: 璀璨星空
email:
language: zh-CN
url: http://starwindy.oschina.io/
root: /
permalink: :year/:month/:day/:title/
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
permalink_defaults: /404.html
source_dir: source
public_dir: public
new_post_name: :title.md
default_layout: post
titlecase: false
external_link: true
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
highlight:
enable : true
line_number: true
tab_replace:
default_category: uncategorized
category_map:
tag_map:
archive: 1
category: 1
tag: 1
per_page: 100
pagination_dir: page
port: 4000
server_ip: localhost
logger: false
logger_format: dev
date_format: YYYY/MM/DD
time_format: HH:mm:ss
disqus_shortname:
Plugins:
- hexo-generator-feed
- hexo-generator-sitemap
feed:
type : atom
path: atom.xml
limit : 20
sitemap:
path: sitemap.xml
theme: landscape-plus
exclude_generator:
duoshuo_shortname: starsky001
deploy:
type : git
repository: https://gitcafe.com/starsky/starsky.git
branch: gitcafe-pages
主题_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
menu:
首页: /
文章列表: /archives
关于: /about
联系: /contact
rss: /atom.xml
excerpt_link: 阅读全文
fancybox: false
mathjax: false
sidebar: right
widgets:
- category
- recent_posts
- archive
- tagcloud
- tag
- links
links:
主题作者: http://xiguabaobao.com
热前端: http://reqianduan.com
google_analytics:
favicon: /favicon.png
twitter:
google_plus:
fb_admins:
fb_app_id:
switch_banner: true
banner_count: 6
tinysou: true
参考: