博客折腾故事
Page content
自从搭建个人博客之后,一直使用的nexT主题。今天看到一款更加简洁的主题:Maupassant,果断的更换之….(折腾ing)
Maupassant最初是由Cho大神为Typecho平台设计开发的一套响应式模板,体积只有20KB,在各种尺寸的设备上表现出色。 主题地址:https://github.com/tufu9441/maupassant-hexo
主题安装
安装主题和渲染器
cd 'hexo博客目录'
git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant
npm install hexo-renderer-jade --save // 渲染器
npm install hexo-renderer-sass --save
npm install hexo-generator-feed --save // rss支持
安装完后打开hexo的_config.yml,将theme修改为maupassant:
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: maupassant
中文支持
进入hexo的目录,打开_config.yml,修改language为zh-CN,目前该主题支持简体中文(zh-CN),繁体中文(zh-TW),英语(en),法语(fr-FR),德语(de-DE),韩语(ko)和西班牙语(es-ES)
language: zh-CN
添加站内搜索
首先,安装hexo插件:
npm install hexo-generator-search --save
然后,编辑theme/maupassant目录下的_config.yml(注意此处是主题下的配置文件,非hexo的配置文件)
// 添加如下字段
search:
- path: search.xml
- field: post
添加评论系统
- 先去disqus或多说网站上创建个站点,得到个相应的二级域名,如wisedream.duoshuo.com
- 在themes/maupassant/_config.yml文件中duoshuo:或disqus:后面输入二级域名的名称,如zeecoder。
添加友情链接
在themes/maupassant下打开_config.yml文件,默认links如下:
links:
- title: site-name1
url: http://www.example1.com/
- title: site-name2
url: http://www.example2.com/
- title: site-name3
url: http://www.example3.com/
按格式修改名称和网址即可
更多配置
fancybox:是否启用Fancybox图片灯箱效果
google_search:默认使用Google搜索引擎
baidu_search:若想使用百度搜索,将其设定为true
swiftype:Swiftype 站内搜索key
tinysou:微搜索 key
google_analytics:Google Analytics 跟踪ID
baidu_analytics:百度统计 跟踪ID
show_category_count:是否显示侧边栏分类数目
busuanzi:是否使用不蒜子页面访问计数
menu:自定义页面及菜单,依照已有格式填写。填写后请在source目录下建立相应名称的文件夹
widgets:选择和排列希望使用的侧边栏小工具
links: 友情链接,请依照格式填写。
静态文件目录:静态文件存储路径,方便设置CDN缓存
version:主题版本,便于静态文件更新后刷新CDN缓存
在文章侧边增加文章目录
在post文章的front_matter增加toc字段,如下:
---
title: ChangedBlogThemes
toc: true // 添加此字段
date: 2016-11-23 21:16:14
tags: Themes
categories: Hexo
---
修改到这,主题也基本成型了,感谢tufu9441给我们提供这么好的主题。
end。
2018.9.15 Update
2018.9.15 切换到hugo,Leaveit主题
老老实实关注内容吧,主题看久了都会觉得不咋地。