Hexo-next主题优化篇

注:下面说到的主题配置文件站点配置文件分别在你的博客目录下的themes/next/_config.yml和_config.yml
更多详细的内容可以访问我的个人博客时莫如初

1. 主题设定

next 集成了4种内置主题,可在主题配置文件中搜索scheme

# Schemes
scheme: Muse
#scheme: Mist
#scheme: Pisces
#scheme: Gemini

想使用那种主题去掉前面的#号即可,可自行尝试更换
每次更改完都需要执行hexo cleanhexo g, hexo s 即可在本地观察效果。

2. 设置语言

站点配置文件中将language设置成为对应的语言

  • 英文是en
  • 简体中文是zh-CN

3. 设置菜单并添加页面

  • 主题配置文件中找到menu想添加什么页面去掉相应的注释即可
menu:
  home: / || home
  #about: /about/ || user
  tags: /tags/ || tags
  categories: /categories/ || th
  archives: /archives/ || archive
  #schedule: /schedule/ || calendar
  #sitemap: /sitemap.xml || sitemap
  #commonweal: /404/ || heartbeat

上面去掉哪行的注释就需要添加那个页面,执行下面的命令即可添加页面。

hexo n page tags
hexo n page categorie
hexo n page archives

4. 设置头像

  • 主题配置文件中搜索Avatar找到如下配置
avatar:
  # 图片的路径 如果是在本地的话 是以主题目录下source开始的 比如我的在themes/next/source/images/head2.jpg  
  url: /images/head2.jpg  
  # If true, the avatar will be dispalyed in circle.
  rounded: true
  # If true, the avatar will be rotated with the cursor.
  rotated: true

5. 添加侧边栏社交链接

  • 主题配置文件中搜索social找到你需要显示的社交链接,去掉注释,b并修改为你的链接。(#为注释)
social:
  GitHub: https://github.com/sudo-li || fab fa-github
  Gitee: https://gitee.com/sudo-li || fab fa-git
  #GitHub: https://github.com/yourname || github
  #E-Mail: mailto:yourname@gmail.com || envelope
  #Weibo: https://weibo.com/yourname || weibo
  #Google: https://plus.google.com/yourname || google
  #Twitter: https://twitter.com/yourname || twitter
  #FB Page: https://www.facebook.com/yourname || facebook
  #StackOverflow: https://stackoverflow.com/yourname || stack-overflow
  #YouTube: https://youtube.com/yourname || youtube
  #Instagram: https://instagram.com/yourname || instagram
  #Skype: skype:yourname?call|chat || skype
  #RSS: /atom.xml || rss

6. 添加友情链接

  1. 主题配置文件中搜索linksTitle后面添加你的友情链接

7. 开启文章打赏功能

  1. 主题配置文件中搜索Reward 去掉前面相应的注释 然后添加你的二维码路径 路径同头像路径一样,是以主题目录下source开始的.

8. 添加fork github

9. 修改文章内连接样式

  • 在/themes/next/source/css/_common/components/post.styl 最后添加 如下代码
// 文章内链接文本样式
.post-body p a{
  color: #0593d3;
  border-bottom: none;
  border-bottom: 1px solid #0593d3;
  &:hover {
    color: #fc6423;
    border-bottom: none;
    border-bottom: 1px solid #fc6423;
  }
}

10. 修改文章标签的小图标

11. 添加评论系统

  • 主题配置文件中找到Valine
valine:
  enable: true
  appid: SSB0Uv6SphdWF73z************ # Your leancloud application appid
  appkey: 1wlBhfILAIsNU********** # Your leancloud application appkey
  • enable 改为true
  • appid 和 appkey 可在https://www.leancloud.cn/这里获取
  • 点击上面链接前往leancloud注册一个账号,然后随便注册一个应用
  • 在设置中打开应用key,就可以找到appid和appkey,填入配置文件即可。

12. 添加搜索服务

  • 站点配置文件最后添加如下配置
search:
  path: search.xml
  field: post
  format: html
  limit: 10000
  • 然后在主题配置文件中开启
local_search:
  enable: true
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

时莫如初

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值