由于本人的博客使用的主题是matery,所以关于hexo主题的相关设置都是基于该主题,当然其他的主题的设置也都相差不多。
这是我的个人博客链接,欢迎大家参观:http://101.132.119.152/
一、熟悉博客的配置文件
首先我们需要了解的是根目录下的配置文件_config.yml
和主题目录下的配置文件_config.yml
1、根目录配置文件详解
site:网站个性化描述
# Site
title: My Blog #网站标题
subtitle: Welcome To My Blog #网站副标题
description: #网站描述
keywords: #网站关键字
author: JinJinHuang #网站作者
language: zh-Hans #网站语言。默认的是en代表英文,zh-Hans是中文
timezone: #使用的是去,默认是跟随系统,不需要设置
url:博客文章的url设置
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://101.132.119.152/ #网站的网址
root: / #网站的根目录
permalink: :year/:month/:day/:title/ #文章的连接各式
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing index.html from permalinks
如果你的博客是按照我的上一篇博客来做的话,我们只需要修改url
这个属性,将其改为你博客主页面的地址就可以了。
个人建议:在用hexo写博客时,常用到中文,建议配置一个组件:hexo-permalink-pinyin
,可以将中文转换为拼音,防止乱码。
安装命令如下(cnpm
和npm
效果相同):
cnpm i hexo-permalink-pinyin --save
在 Hexo 根目录下的 _config.yml
文件中,新增以下的配置项:
#将中文连接进行转换
permalink_pinyin:
enable: true
separator: '-' # default: '-'
Extensions:设置主题类型和插件
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: matery #修改主题,我使用的主题是matery
Deployment:关于网站部署的配置
上一篇博客中已经介绍
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
message: update
repo: root@101.132.119.152:/www/blog.git,master
branch: master
其余更加详细的配置参数的作用可以参考:
https://blog.csdn.net/wsmrzx/article/details/81477926
2、主题配置文件
如果想要下载额外的主题(以matery主题为例,主题需要放在themes文件下):
git clone https://github.com/blinkfox/hexo-theme-matery.git /www/myblog/themes/matery/
主题文件都放在主题文件夹中,例如我的文件就在/www/myblog/themes/matery/
下。
每一个发布在github
上的主题的详细配置在github
上都有详细的配置介绍。
所以具体的配置信息我将不再介绍,作为一个搬运工,链接已经贴在下面:
https://github.com/blinkfox/hexo-theme-matery
其他的主题我更推荐Next
,因为这些主题较为成熟,其中的插件已经内置,使用起来更加方便;使用的人也相对较多,问题都可以在网络上得到解决。
针对matery
主题,我会再写一篇关于gittalk
插件的配置问题。其他的配置大部分都是可以通过打开开关来打开。
欢迎大家访问的博客:
http://101.132.119.152/