Hexo 修改

_config.yml

文件路径

./_config.yml

标题

参数: title

副标题

参数: subtitle

描述

参数: description

关键词

参数: keywords

作者

参数: author

网址

参数: url

永久链接

参数: permalink
默认值: :year/:month/:day/:title/

_config.yml

文件路径

./themes/landscape/_config.yml

摘要链接

参数: excerpt_link

Valine 配置

参数: valine

导航栏修改为中文

文件路径: ./themes/landscape/_config.yml
参数: menu
注:用 Windows 系统自带的记事本(其他工具就看运气了)编辑会出现中文乱码的情况,需要将文件另存为 UTF-8 编码替换同名文件。

启用 RSS

安装 hexo-generator-feed 插件:

1
npm install hexo-generator-feed --save

注:需要配置 url 参数为自己的网址。

更多信息: https://github.com/hexojs/hexo-generator-feed

更换 banner 图片

使用新 banner 图片替换 ./themes/landscape/source/css/images/banner.jpg 图片。

修改 jQuery 源

文件路径: ./themes/landscape/layout/_partial/after-footer.ejs
修改:
//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
改为
https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js

更多信息: https://jquery.com/download/

Google 搜索修改为百度搜索

文件路径: ./node_modules/hexo/lib/plugins/helper/search_form.js
form 表单:

  • action 属性: //google.com/search -> http://zhannei.baidu.com/cse/site
  • name 属性: sitesearch -> cc
  • value 属性: ${config.url} -> example.com,value 值为网站的主域,不能带 https://

文章链接结构优化

安装 hexo-abbrlink 插件:

1
npm install hexo-abbrlink --save

修改文章永久链接为: permalink: posts/:abbrlink/

更多信息: https://github.com/rozbo/hexo-abbrlink

创建404页面

新建名为 404.html 的网页文件,移动到 ./themes/landscape/source/ 路径下。

安装 hexo admin

安装 hexo admin 插件:

1
npm install --save hexo-admin

访问网址 http://localhost:4000/admin/

更多信息: https://github.com/jaredly/hexo-admin

提交网址

登录百度搜索资源平台 https://ziyuan.baidu.com/ 添加网站。输入要添加的网站,验证网站选择“HTML标签验证”方式,这需要按照如下配置 _config.ymlhead.ejs 文件。
文件路径: ./themes/landscape/_config.yml

1
baidu_site_verification: true

如提交到 Google,则配置为:

1
google_site_verification: true

文件路径: ./themes/landscape/layout/_partial/head.ejs

1
2
3
<% if (theme.baidu_site_verification){ %>
<meta name="baidu-site-verification" content="xxx" />
<% } %>

配置完成后,发布网站:

1
2
3
hexo clean
hexo generate
hexo deploy

最后点击完成验证。