FastComments.com

Add Comments to Ionos Sites


使用 FastComments,我们可以轻松为任何使用 Ionos 构建的网站添加实时评论。

请注意,本教程需要一个 FastComments 帐户。建议您先注册,然后再返回此处。您可以在此创建一个帐户。


步骤 1:添加联系表单 Internal Link

首先,我们将添加一个联系表单,FastComments 会替换该表单。

为此,打开站点编辑器,并在目标页面上点击 Add Section

然后,在左侧转到 Content -> Contact -> Contact Form,如图所示:

添加联系表单
Add Contact Form

接下来,我们需要告诉 FastComments 替换我们的表单。点击默认的表单标题:

设置表单标题
Set Form Title

我们会将标题设置为 FastComments Goes Here。大小写和空格必须完全一致,否则无法生效,因此建议您复制此文本并粘贴。

完成后,应如下所示:

完成设置标题
Done Setting Title

第一步到此完成!


步骤 2:添加 FastComments.com 代码 Internal Link

接下来我们将把 FastComments 小部件代码添加到你的网站。该代码将搜索所有标题为 FastComments Goes Here 的表单,并将其替换为 FastComments。

所以现在在站点编辑器的左下角进入 Settings

打开设置
打开设置

打开 Custom Head Code 部分:

打开自定义头部代码
打开自定义头部代码

对于 Ionos,我们需要 FastComments 小部件代码的 特殊版本。来自 其他教程 的代码片段 将无法使用。

现在复制以下代码:

Ionos FastComments 代码片段
Copy Copy
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<script>
4 (function () {
5 let loaded = false;
6 let interval = null;
7
8 function attemptLoad() {
9 const nodes = document.querySelectorAll('h2');
10
11 nodes.forEach(function (node) {
12 if (node.innerText && node.innerText.trim() === 'FastComments Goes Here') {
13 // 获取非全宽的元素
14 const target = node.parentNode.parentNode.parentNode.parentNode.parentNode;
15 target.innerHTML = '';
16 FastCommentsUI(target, {
17 tenantId: "demo"
18 });
19 interval && clearInterval(interval);
20 loaded = true;
21 }
22 });
23 }
24
25 attemptLoad();
26 if (!loaded) {
27 interval = setInterval(attemptLoad, 300);
28 }
29 })();
30</script>
31

...并按如下所示粘贴:

粘贴并保存
粘贴并保存

步骤 3:发布 Internal Link


现在我们只需发布网站,就完成了。

通过点击左上角的 Content 返回内容编辑器:

返回内容编辑器
返回内容编辑器

然后我们就可以发布了!

发布!
发布!

就是这样!FastComments 应该已在您的网站上线。您应该会看到类似如下内容:

完成!
完成!

成功 Internal Link


干得好!您已将实时评论添加到您的 Ionos 站点。

如果您遇到“permission denied”错误,或想自定义 FastComments,请继续阅读。


自定义 Internal Link

FastComments 旨在可定制,以匹配您的网站。

如果您想添加自定义样式或调整配置,请查看我们的自定义与配置文档以了解如何操作。