hexo使用笔记
source link: https://popwalker.github.io/article/d6ed9cc7/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
添加阅读次数统计
参考next主题文档,使用leanCloud来统计
1.注册leancloud账号,获取appId
和appKey
,具体细节可以参考这里
2.编辑主题配置文件
,修改配项leancloud_visitors
leancloud_visitors:
enable: true
app_id: <your_app_id>
app_key: <your_app_key>
security: true
betterPerformance: false
然后重新部署hexo博客,列表页已经有了阅读次数,但是详情页报错:阅读次数: Counter not initialized! See more at console err msg.
查看控制台报错,有两种方式解决:
- 使用
hexo-leancloud-counter-security
插件 - 设置
leancloud_visitors.security = false
我这里选择第二种。设置以后重新部署hexo,即可看到阅读次数的统计。
添加音乐很简单,只需要在markdown文件中加入iframe标签即可,示例:
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="http://music.163.com/outchain/player?type=2&id=34578162&auto=0&height=66"></iframe>
然后需要做的就是将上面链接中的id的值替换成目标歌曲的id即可,可以去网易云音乐搜索音乐,从链接中获取id。更多玩法参考这里
开启图片点击预览
1.NexT主题是支持图片预览的,使用的是fancyBox这个js库,要做的就是开启这个功能即可。
2.打开主题配置文件,找到fancybox: false
这个配置项,修改为true
即可。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK