惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
Y
Y Combinator Blog
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
T
Tor Project blog
I
Intezer
T
Threat Research - Cisco Blogs
L
LINUX DO - 热门话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Last Watchdog
The Last Watchdog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Privacy & Cybersecurity Law Blog
N
News | PayPal Newsroom
N
News and Events Feed by Topic
C
CERT Recently Published Vulnerability Notes
T
Tenable Blog
K
Kaspersky official blog
V
Visual Studio Blog
T
Troy Hunt's Blog
Project Zero
Project Zero
博客园_首页
The Register - Security
The Register - Security
O
OpenAI News
G
Google Developers Blog
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
D
DataBreaches.Net
F
Full Disclosure
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security Affairs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
腾讯CDC
有赞技术团队
有赞技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
阮一峰的网络日志
阮一峰的网络日志
C
Cisco Blogs
Vercel News
Vercel News
V
Vulnerabilities – Threatpost
月光博客
月光博客
Hacker News: Ask HN
Hacker News: Ask HN
B
Blog RSS Feed
P
Palo Alto Networks Blog
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
G
GRAHAM CLULEY

梦魇小栈

《羊了个羊》程序员过关攻略 WebRTC 入门指南 将你的博客升级为 PWA 渐进式Web离线应用 什么? 微信没有年度账单? 前端 nodejs 撸起来~ [接口实现] Hexo 博客美化代码块 记一下 pm2 常用配置及命令 (译)NPM vs Yarn 备忘手册 用 MySQL 导入 SQL 文件 解决 ubuntu 服务器中文乱码 面试分享:2018阿里巴巴前端面试总结(题目+答案) crontab 踩坑之绝对路径 SED 命令简明教程 使用 JavaScript 实现简单的拖拽 Merry Christmas JAVASCRIPT生成图形验证码 笔记:NPM版本号自增,自动化发布NPM包 不可不知的Mac OS X专用命令行工具(持续更新中) 继多说、网易关停之后该何去何从(网易云跟帖宣布2017年8月1日停止服务) 重新介绍 JavaScript(JS全面系列教程)
在Hexo博客 NexT主题中部署Wildfire评论系统
Ihoey 心,若没有栖息的地方,到哪里都是流浪...... · 2018-01-30 · via 梦魇小栈

发表于 | 更新于 | 分类于 Linux | 评论数: | 阅读次数:

前一段时间,发现了一个评论系统很好用,果断把这个评论系统换到自己的博客里了。

所以本文主要讲在 HexoNexT 主题中如何使用 Wildfire ,至于其他的博客以及其他的主题中如何使用的问题,我就不多说了。有需求的朋友可以去项目主页提问,或者在这里提问也可以。如果我懂得话一定会回答的。

修改 NexT 评论模板

在你的博客项目中,打开./themes/next/layout/_partials/comments.swig 这个文件。
将文件尾部的内容:

1
2
3
4
5
6
7
8
9
10
{% if page.comments %}
<div class="comments" id="comments">
...
...
{% elseif theme.livere_uid %}
<div id="lv-container" data-id="city" data-uid="{{ theme.livere_uid }}"></div>
<!-- 添加内容的位置在这里 -->
{% endif %}
</div>
{% endif %}

修改为成下面的内容:

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
{% if page.comments %}
<div class="comments" id="comments">
...
...
{% elseif theme.livere_uid %}
<div id="lv-container" data-id="city" data-uid="{{ theme.livere_uid }}"></div>
{% elseif theme.wildfire.enable %}
<style type="text/css">
.wildfire_thread a {border-bottom: none}
</style>
<div class="wildfire_thread"></div>
<script type="text/javascript">
var wildfireConfig = () => ({
databaseProvider: '{{ theme.wildfire.database_provider }}',
databaseConfig: {
{% if (theme.wildfire.database_provider) === 'wilddog' %}
siteId: '{{ theme.wildfire.site_id }}'
{% elseif (theme.wildfire.database_provider) === 'firebase' %}
apiKey: '{{ theme.wildfire.api_key }}',
authDomain: '{{ theme.wildfire.auth_domain }}',
databaseURL: '{{ theme.wildfire.database_url }}',
projectId: '{{ theme.wildfire.project_id }}',
storageBucket: '{{theme.wildfire.storage_bucket}}',
messagingSenderId: '{{theme.wildfire.messaging_sender_id}}'
{% endif %}
},
theme: '{{theme.wildfire.theme}}',
locale: '{{theme.wildfire.locale}}'
})
</script>
<script src='https://unpkg.com/wildfire/dist/wildfire.auto.js'></script>
{% endif %}
</div>
{% endif %}

然后保存。

增加设置内容

打开主题设置文件 ./themes/next/_config.yml,注意:不是站点设置文件。
将下面的代码复制到合适的位置(包含全部注释):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Wildfire Support
wildfire:
## 开启Wildfire支持
enable: true
## 主题颜色,目前可选值为light/dark两种,默认为light
theme: light
## 系统语言,目前可选值为en/zh-CN两种,默认为en
locale: zh-CN
## Wilddog配置
database_provider: wilddog
site_id: site_id
avatarURL: https://image.flaticon.com/icons/svg/621/621863.svg
## Firebase配置
# database_provider: firebase
# api_key: apiKey
# auth_domain: authDomain
# database_url: databaseURL
# project_id: projectId
# storage_bucket: storageBucket
# messaging_sender_id: messagingSenderId

需要注意的是,复制的时候不要修改这个配置的缩进关系。另外 WilddogFirebase 两者的配置只能选择其一。比如要使用 Wilddog 的话,配置内容就如下:

1
2
3
4
5
6
wildfire:
enable: true
theme: light
locale: zh-CN
database_provider: wilddog
site_id: wdg_my_site_id

如果要使用 Firebase 则配置选择为如下:

1
2
3
4
5
6
7
8
9
10
11
wildfire:
enable: true
theme: light
locale: zh-CN
database_provider: firebase
api_key: your_apiKey
auth_domain: your_authDomain
database_url: your_databaseURL
project_id: your_projectId
storage_bucket: your_storageBucket
messaging_sender_id: your_messagingSenderId

上面的值呢,就需要大家从自己建好的 APP 应用中拷贝过来了。

完成部署

下面就可以直接 hexo generate 生成就可以了。很简单吧~
当然如果还有什么问题,欢迎在这里提问哦。

满分是10分的话,这篇文章你给几分,您的支持将鼓励我继续创作!

0%