FastComments.com

Add Live Commenting to Drupal Sites

安装 Internal Link


FastComments Drupal 模块将 Drupal 内置的评论替换为一个快速、实时的评论系统。该模块已在 drupal.org 发布,并适用于 Drupal 10 和 11。

有两种安装方式。

使用 Composer 安装

composer require drupal/fcom
drush en fastcomments

手动安装

drupal.org/project/fcom 下载该模块,并将其放到站点的 modules/custom/fastcomments/ 目录下。然后使用 drush en fastcomments 启用,或从管理界面的 Extend/admin/modules)中启用。

注意! 该模块仅依赖于 Drupal 核心(userfield)。不需要其他 Drupal 模块或库。

启用模块后,前往 Configuration 部分以设置您的 Tenant ID 和 API Secret。


小部件区块 Internal Link

该模块包含多个可放置的区块,可从 Structure > Block layout/admin/structure/block)中添加。

  • FastComments Widget - 主要的评论小部件。会自动检测当前实体。对于已经附加了 FastComments 字段的实体,它会跳过,因此在同一页面上不会出现重复的小部件。
  • FastComments Live Chat - 实时流式聊天。可以与同一页面上的评论字段并排放置。
  • FastComments Collab Chat - 文本选择注释与讨论。
  • FastComments Image Chat - 基于坐标的图片注释。访客点击图片以在特定位置留下评论。
  • FastComments Recent Comments - 显示站点上的最新评论。数量可在区块中配置。
  • FastComments Top Pages - 显示站点中评论最多的页面。

以内容为中心的区块(Live Chat、Collab Chat、Image Chat)会自动检测当前实体,在非实体页面上则回退到基于路径的标识符。这意味着它们在分类页面、视图和自定义路由上都能正常工作,无需额外设置。

内容类型字段 Internal Link

对于大多数网站,添加评论的最简单方法是将 FastComments 字段附加到你的内容类型。转到 Structure > Content types > [type] > Manage fields 并添加该字段。

每个拥有此字段的实体将获得:

  • 一个 状态切换,使编辑者可以为每个实体单独打开或关闭评论。
  • 一个可选的 自定义标识符,以便你可以使用不与 Drupal 实体路径绑定的稳定 ID。

FastComments Widget 区块会识别此字段,并会跳过已经附加了该字段的实体。这样你可以将按实体的评论与该区块混合使用,而不会在同一页面看到小部件出现两次。


权限 Internal Link

该模块添加了三个 Drupal 权限,您可以在 People > Permissions 下按角色分配它们。

  • Administer FastComments - 可访问位于 /admin/config/content/fastcomments 的 FastComments 设置表单。
  • View FastComments - 查看评论小部件所需的权限。没有此权限,小部件不会渲染。
  • Toggle FastComments - 允许用户使用字段小部件在每个实体级别启用或禁用评论。

默认情况下,只有具有 administer site configuration 权限的用户可以更改 FastComments 设置。如果您希望访客看到该小部件,请将 View FastComments 授予匿名和已验证用户。

多语言 Internal Link


该模块会自动将当前 Drupal 站点的语言传递给每个 FastComments 小部件。如果您的 Drupal 站点配置了多语言,评论界面将无需额外配置即可以相应语言呈现。

这适用于所有小部件类型:Live Comments、Streaming Chat、Collab Chat、Image Chat、Recent Comments 和 Top Pages。


欧盟数据驻留 Internal Link


如果您的 FastComments 帐户托管在欧盟,请在 Administration > Configuration > Content > FastComments 更新两项设置:

  • CDN URL - https://cdn-eu.fastcomments.com
  • Site URL - https://eu.fastcomments.com

您还需要从欧盟控制面板 eu.fastcomments.com/auth/my-account/api 获取您的 Tenant ID 和 API Secret,而不是默认的 US 控制面板。模块中的其他所有内容保持不变。


自定义 Internal Link

FastComments 旨在根据您的站点进行定制。

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