本文主要是对config的配置,默认已经配置好本地博客。采用的是Volantis主题,可以在上方更多->主题源码中获得源码。
1.hexo命令
在blog文件夹打开git bush。
1.1本地构建
- 启动服务器。 默认情况下,访问网址为:
http://localhost:4000/。
1.2发布github
如果遇到报错问题,首先查看是否有语法问题。其次查看报错原因,如果配置在github会因为网络原因失败,可以选择科学上网方式多试几次。
2._config_volantis.yml
2.1官方文档
查看官方发布的文档,基本上可以解决很多的问题页面配置 - Volantis。主要分为页面布局,导航栏,侧边栏,插件,页脚几个部分。
2.2页面布局
下面是当前页面的布局配置。其中layout_scheme推荐选择是search,默认的是dock。title则是页面标题,background是页面背景,可以选择自行上传图片,需要用到图床工具。这部分比较简单,不在赘述。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
cover: height_scheme: full layout_scheme: search display: home: true archive: true others: false background: https://gcore.jsdelivr.net/gh/MHG-LAB/cron@gh-pages/bing/bing.jpg logo: title: 'Cbus' subtitle: 'Hi~ 你好,这是属于我自己的博客网站' search: search you want features: - name: 首页 icon: img: url: / - name: 帮助 icon: img: url: /help/ - name: 博客 icon: img: url: /archives/ - name: 网盘 icon: img: url: /wangpan/ - name: 关于 icon: img: url: /aboutme/
|
整体效果参考:cbus。
2.3导航栏布局
官方文档配置如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
navbar: visiable: auto logo: img: volantis-static/media/org.volantis/blog/Logo-NavBar@3x.png icon: title: menu: - name: 博客 icon: fa-solid fa-rss url: / - name: 分类 icon: fa-solid fa-folder-open url: categories/ - name: 标签 icon: fa-solid fa-tags url: tags/ - name: 归档 icon: fa-solid fa-archive url: archives/ - name: 友链 icon: fa-solid fa-link url: friends/ - name: 关于 icon: fa-solid fa-info-circle url: about/ search: Search...
|
可以看到,分类,标签,归档,友链,关于这几个界面的url都是有个新界面。所以需要创建新的界面。使用如下命令:
1
| hexo new page “categories”
|
1
| hexo new page “archives”
|
创建好的文件位于source文件夹下。其中原有的_posts文件夹保存着博客。
2.4页脚
这里主要注意layout,想要显示的标签写入里面。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| site_footer: layout: [aplayer, social, license, info, copyright] social: - icon: fas fa-rss url: atom.xml - icon: fas fa-envelope url: mailto:me@xaoxuu.com - icon: fab fa-github url: https://github.com/xaoxuu - icon: fas fa-headphones-alt url: https://music.163.com/#/user/home?id=63035382 copyright: '[Copyright © 2017-2021 XXX](/)' br: '<br>'
|
2.5插件
2.5.1评论系统
可以看到官方配置文档支持很多评论系统。博主本人实验了giscus和Twikoo两个评论系统,各有好处。giscus需要创建一个github仓库,免费,评论需要登录github账户。twikoo可以使用QQ登录,管理也比较方便。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| comments: title: <i class='fa-solid fa-comments'></i> 评论 subtitle: service: twikoo .... giscus: repo: repo-id: category: category-id: mapping: "pathname" reactions-enabled: "1" emit-metadata: "0" lang: "zh-CN" theme: light: "light" dark: "dark"
.....
twikoo: js: https://unpkg.com/twikoo@latest path: envId: placeholder:
....
|
首先在github里面创建一个public仓库,然后开启commment。然后在giscus页面输入用户/仓库名,验证是否可以当做仓库。然后就可以在下面看到所对应的字符串,填入到config文件就可以了。

本文主要使用的就是Twikoo | 一个简洁、安全、免费的静态网站评论系统。
主要看这篇文档就可以了。云函数部署 | Twikoo 文档。B站也有视频教程,可以看一下。本人比较懒,没时间说的那么详细。
问题1.如果收不到邮箱消息:请查看常见问题 | Twikoo 文档。
问题2.评论0,无法获取评论:主要是网络问题,可以更换部署,或者科学上网,不过建议直接购买域名,新人首购1元。
问题3.Twikoo忘记密码:打开mongodb,打开数据库,选择Browes Collections。找到config,里面就会有密码显示。
2.5.2访客统计
将原本的analytics改为如下代码:
1 2 3 4 5
| analytics: > <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script> <span id="busuanzi_container_site_pv">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span> <span id="busuanzi_container_site_uv">访客数为<span id="busuanzi_value_site_uv"></span>次</span>
|
然后,添加busuanzi
1 2 3 4 5 6 7 8
| sitesjs: enable: true friendsjs: enable: true contributorsjs: enable: true busuanzi: enable: true
|
Analytics修改为:
1 2 3 4 5 6 7 8 9
| analytics: busuanzi: https://npm.elemecdn.com/penndu@1.0.0/bsz.js show_category_count: true leancloud: app_id: app_key: custom_api_server:
|
3.图床
图床主要是存放图片,将图片放在网上,生成url,然后通过url访问。图床软件下载PicGo is Here | PicGo。
获取gitee的takon。然后在PicGo的插件管理页面搜索gitee,下载后点击设置,填入信息。然后上传图片,浏览器查看url是否上传成功。