1.4-为Melody主题的HEXO博客添加gitalk评论区
2023.9.1 更新:不如直接利用github discussion部署Giscus,效果更好还更方便
担心博客有错误无法及时改正,所以在博客中加入评论区,gitalk评论区模块好处非常多,首先当然是免费,其次必须登录GitHub账号才能评论,有一定防灌水的作用。本人使用的HEXO主题是hexo-theme-melody,这个主题自带功能比较多,界面也比较简洁,也集成了gitalk模块,用户只需要注册应用并编辑配置文件即可加入gitalk模块
创建存放评论的仓库
gitalk的原理是将博客中的评论存放在github仓库的issues中。
最好不要用自己的主页仓库(即xxx.github.io)作为存放评论的仓库,后续可能会出现一些问题,所以专门创建一个public仓库来存放评论。
创建github OAuth application
应用快捷注册地址
按照下图中填写
点击绿色的注册按钮,在新页面中点击"Generate a new client secret",生成客户端密码,然后记录下"Client ID"和"Clien ...
1.3-为HEXO博客添加类别和标签
Blog添加分类(categories)和标签(tags) 文章内容来源
创建“分类”选项
生成“分类”页并添加tpye属性
打开命令行,进入博客所在文件夹。执行命令
1$ hexo new page categories
成功后会提示:
1INFO Created: ~/Documents/blog/source/categories/index.md
根据上面的路径,找到index.md这个文件,打开后默认内容是这样的:
1234---title: 文章分类date: 2018-10-31 13:47:40---
添加type: "categories"到内容中,添加后是这样的:
12345---title: 文章分类date: 2018-10-31 13:47:40type: "categories"---
保存并关闭文件。
给文章添加“categories”属性
打开需要添加分类的文章,为其添加categories属性。下方的categories: web前端表示添加这篇文章到“web前端”这个分类。注意:hexo一篇文章只能属 ...
1.2-HEXO常用命令
bash命令
命令
功能
备注
hexo serve
在本机4000端口上运行博客web服务
测试用
hexo clean
清除本地缓存
推送到远程仓库前清理缓存
hexo g
生成本地静态网页
hexo algolia
调用api生成 algolia 索引
hexo d
推送更改到远程地址
hexo new page categories
创建新类别
每篇文章只能处于一个类别中或者一个类别的子类别中
hexo new page tags
创建新标签
每篇文章可以有多个标签
插件
生成站点地图:
12npm install hexo-generator-sitemap --savenpm install hexo-generator-baidu-sitemap --save
站点地图位置:
12https://blog.magicconch.top/sitemap.xmlhttps://blog.magicconch.top/baidusitemap.xml
1.1-hello-world
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
1$ hexo new "My New Post"
More info: Writing
Run server
1$ hexo server
More info: Server
Generate static files
1$ hexo generate
More info: Generating
Deploy to remote sites
1$ hexo deploy
More info: Deployment