搭建Github博客:hexo配置
记录hexo配置过程
我的做法是,加上中文注释,方便以后修改
前言
hexo配置文件,称“站点配置文件”,本人路径:D:\CODE\blog\_config.yml
用文本编辑器打开配置文件_config.yml(注意:.yml类型的文件内容,冒号之后都是有一个半角空格)
- hexo配置:https://hexo.io/zh-cn/docs/configuration
- Next主题主题设定:http://theme-next.iissnan.com/getting-started.html#theme-settings
- Next主题主题配置:http://theme-next.iissnan.com/theme-settings.html
- Next主题第三方服务集成:http://theme-next.iissnan.com/third-party-services.html#comment-system
- Next主题常见问题:http://theme-next.iissnan.com/faqs.html
基础配置
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
# 网站信息
# 网站标题
title: RUBG
# 网站副标题
subtitle:
# 网站描述
description: 记录生活
# 关键字
keywords:
# 您的名字
author: ioufev
# 网站语言,默认英语,设置简体汉语
language: zh-CN
# 网站时区,CN
timezone: Asia/Shanghai
# URL
# 网址信息
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
# 网址
url: http://ious.ml
# 网站根目录
root: /
# 文章的 永久链接 格式
permalink: :year/:month/:day/:title/
# 永久链接中各部分的默认值
permalink_defaults:
# Directory
# 目录信息
# 资源文件夹,用来存放内容,里面的文件会上传到github中
source_dir: source
# 公共文件夹,用于存放生成的站点文件,存放生成的静态文件
public_dir: public
# 标签文件夹
tag_dir: tags
# 归档文件夹
archive_dir: archives
# 分类文件夹,实际存放在source/categories中
category_dir: categories
# 代码文件夹
code_dir: downloads/code
# 国际化(i18n)文件夹,默认跟language相同
i18n_dir: :lang
# 跳过指定文件的渲染,默认没有
# 不需要渲染的文件夹或文件夹,放在[]中
# 这两个文件是百度和google的站长验证文件,不能渲染,否则会改变内容,不能验证过
skip_render: [baidu_verify_R9MZjdMkXT.html, google0f8fac7da2b48ef8.html, README.md, 模板.md]
# 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
# 把文件名称转换为 (1) 小写或 (2) 大写
filename_case: 0
# 显示草稿,是否渲染草稿
render_drafts: false
# 启动 Asset 文件夹
post_asset_folder: false
# 把链接改为与根目录的相对位址
relative_link: false
# 显示未来的文章
future: true
# 代码块的设置
highlight:
enable: true # 使用代码高亮
line_number: true # 显示行号
auto_detect: true # 自动检测语言,默认false
tab_replace:
# Home page setting
# 首页设置
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
# 首页的分页设置
index_generator:
path: ''
per_page: 10
order_by: -date
# Category & Tag
# 分类 & 标签
# 默认分类
default_category: uncategorized
# 分类别名
category_map:
# 标签别名
tag_map:
# Date / Time format
# 日期 / 时间格式
## Hexo uses Moment.js to parse and display date
# Hexo 使用 Moment.js 来解析和显示时间
## 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
# 每页显示的文章量 (0 = 关闭分页功能)
per_page: 10
# 分页目录,在public中可以看到
pagination_dir: page
# Extensions
# 扩展部分:插件和主题
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
# 当前主题名称,值为false时禁用主题
# theme: landscape # 默认主题
# next主题
theme: next
# Next主题还有4种风格供我们选择,打开主题配置文件找到Scheme Settings
# Schemes
# scheme: Muse
# scheme: Mist
# scheme: Pisces
# scheme: Gemini
# Deployment
# 部署配置
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: git@github.com:ioufev/ioufev.github.io.git
branch: master
额外配置
额外配置,需要安装插件实现的功能
# 分页配置:后添加的
# 归档页的分页设置
archive_generator:
per_page: 30
yearly: true
monthly: true
# 标签页的分页设置
tag_generator:
per_page: 20
# 站内搜索
# 需要安装插件:npm install hexo-generator-searchdb --save
search:
path: search.xml
field: post
format: html
limit: 100
# 中文链接转拼音:后添加的
# https://github.com/viko16/hexo-permalink-pinyin
# npm i hexo-permalink-pinyin --save
permalink_pinyin:
enable: true #是否启用插件
separator: '-' # default: '-' #词自己的间隔符
配置记录
上传到Github
先配置好ssh key
第一种写法:
deploy:
type: git
repository: git@github.com:ioufev/ioufev.github.io.git
branch: master
第二种写法:
deploy:
type: git
repo: https://github.com/ioufev/ioufev.github.io.git
branch: master
测试证明都可以,但是都需要安装插件hexo-deployer-git,否则会提示
Deployer not found: github 或者 Deployer not found: git
安装插件命令:
npm install hexo-deployer-git --save

浙公网安备 33010602011771号