0%

Hexo博客搭建的一些经验

基于Hexo博客搭建的一些经验

评论系统

评论系统的选择比较担心的什么时候会失效,所以这里选用valine,用免费的云数据库搭建。

参考

添加备案信息

添加备案信息

删除不想要的东西

部署

我的博客是同时部署在Github和又拍云上的。主要是考虑国内访问Github速度慢,又拍云有CDN速度快。

部署的配置如下:

1
2
3
4
5
6
7
8
9
10
11
deploy:
- type: git
repo: git@github.com:iponkan/iponkan.github.io.git
branch: master
message: message
- type: upyun
serviceName: xxx
operatorName: xxx
operatorPassword: xxx
path: /
cacheUrl: https://yrc.vlooktech.com

GitHub部署是有延迟的,一般会有几分钟。

又拍云的部署使用了插件 hexo-deployer-upyun-purge

又拍云联盟logo添加

参考这个commit

加入又拍云联盟可以每个月获取10G免费空间和15G CDN流量,对于博客是够用的。

添加音乐播放功能

如网易云音乐的外链功能,在markdown相应位置加上就行

1
2
3
4
5
{% raw %}

<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=409931437&auto=1&height=66"></iframe>

{% endraw %}

添加视频播放功能

视频可以直接引用b站视频

1
2
3
4
5
{% raw %}

<iframe src="//player.bilibili.com/player.html?isOutside=true&aid=525706795&bvid=BV1zM411s7gn&cid=1042721891&p=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>

{% endraw %}

添加图片

方法一

和博客放在一起

1
post_asset_folder: true

这个会在每次hexo new 文章标题的时候生成一个文件夹,图片放在里面。这种方法的缺点是图片如果越来越多会占用Github仓库资源,且访问速度不理想

方法一

OSS对象存储+PicGo搭建图床,我采用的是这种方式

  1. 下载PicGo

    下载地址:Releases · Molunerfinn/PicGo (github.com)

  2. 配置PicGo

image-20241008100101937

  1. 配置Typora

image-20241008100208782