
語言 🇹🇼 繁體中文
重點摘要
Drupal 安裝
Add Live Commenting to Drupal Sites
快速開始 
這是 Drupal 說明的「太長不看」版本。
- 使用
composer require drupal/fcom安裝模組,或將其放入modules/custom/fastcomments/。 - 使用
drush en fastcomments啟用,或在管理介面/admin/modules中啟用。 - 前往
Administration > Configuration > Content > FastComments(/admin/config/content/fastcomments)。 - 在 Settings > API/SSO(EU)中輸入您的 Tenant ID 與 API Secret。
- 透過
Structure > Content types > [type] > Manage fields將FastComments欄位新增到任一內容類型。
該模組已發佈於 drupal.org/project/fcom。
安裝 
FastComments 的 Drupal 模組用快速、即時的留言系統取代 Drupal 內建的留言功能。該模組已在 已在 drupal.org 發佈,支援 Drupal 10 與 11。
有兩種安裝方式。
Install with Composer
composer require drupal/fcom
drush en fastcommentsInstall manually
從 drupal.org/project/fcom 下載模組,並將它放到你網站的 modules/custom/fastcomments/ 目錄。然後使用 drush en fastcomments 啟用,或從管理介面的 Extend (/admin/modules) 啟用。
注意! 模組只依賴 Drupal 核心(user 和 field)。不需要其他 Drupal 模組或函式庫。
啟用模組後,前往 Configuration 區段以設定你的 Tenant ID 和 API Secret。
設定 
All settings live under Administration > Configuration > Content > FastComments (/admin/config/content/fastcomments).
必填
- 租戶 ID - 您的 FastComments Tenant ID。可在 Settings > API/SSO(EU)中找到。
- API Secret - 用於安全 SSO、Webhook 驗證與頁面同步。可在 Settings > API/SSO(EU)中找到。
留言樣式
選擇與您網站互動方式相符的小工具。
- Live Comments - 即時的分線留言。
- Streaming Chat - 即時聊天介面,適用於活動與直播。
- Collab Chat - 在主要內容區進行文字選取註解。訪客選取文字並在該處開始討論。
- Collab Chat + Comments - 在同一頁面同時顯示 collab chat 與標準留言。
SSO 模式
- 無 - 不使用 SSO。使用者以訪客身份留言或建立 FastComments 帳號。
- 簡易 - 將 Drupal 使用者資訊(名稱、電子郵件、頭像)傳給 FastComments,無需伺服器端驗證。
- 安全 - 使用 HMAC-SHA256 與 FastComments 驗證 Drupal 使用者。當您已設定 API Secret 時建議使用。
See the Single Sign-On (SSO) section for details.
其他設定
- CDN URL - 預設為
https://cdn.fastcomments.com。 - Site URL - 預設為
https://fastcomments.com。 - Email notifications - 當新的留言發表於其內容時,寄送電子郵件給內容作者。
For EU data residency, see the EU Data Residency section.
小工具區塊 
此模組提供數個區塊,可以從 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)會自動偵測當前實體,並在非實體頁面時退回使用基於路徑的識別符。這表示它們可在分類法頁面、Views 與自訂路由上運作,無需任何額外設定。
內容類型欄位 
對於大多數網站,新增評論最簡單的方法是將 FastComments 欄位附加到您的內容類型。前往 Structure > Content types > [type] > Manage fields 並新增該欄位。
Each entity that has the field gets:
- 一個 狀態切換,讓編輯可以對每個實體啟用或停用評論。
- 一個可選的 自訂識別符,讓您可以使用不綁定於 Drupal 實體路徑的穩定 ID。
The main FastComments Widget block knows about this field, and will skip entities that already have it attached. That way you can mix per-entity comments with the block without seeing the widget twice on the same page.
單一登入 (SSO) 
FastComments 透過 SSO(單一登入)與 Drupal 的使用者系統整合。使用者登入您的 Drupal 網站後,模組會自動將他們的身分傳送到 FastComments。無需建立額外帳號,也不需要執行初始同步。
The module supports three SSO modes, set under Administration > Configuration > Content > FastComments.
無
No SSO。使用者可以訪客身份留言或建立 FastComments 帳號。若您的網站公開且不需要將留言綁定到 Drupal 使用者,請使用此模式。
簡易
在沒有伺服器端驗證的情況下,將 Drupal 使用者的名稱、電子郵件與大頭照傳給 FastComments。無需 API Secret。適用於內部或低風險網站。
安全(建議)
使用 HMAC-SHA256 來向 FastComments 驗證每個使用者的身分。若您已設定 API Secret,此模式即為您所需,且它是唯一能防止訪客冒充其他使用者的模式。
User identity is passed to FastComments each time a user views a comment thread. There is no initial or continuous sync that needs to run.
(Optional) 將您的管理員加入 Users & Administrators,並將版主加入 Comment Moderators,以改善他們的使用體驗並啟用版主的統計追蹤。
如要深入了解 SSO 的運作方式,請參閱自訂文件的 SSO 章節。
權限 
此模組新增三個 Drupal 權限,可在 People > Permissions 下為每個角色分配。
- Administer FastComments - 可存取位於
/admin/config/content/fastcomments的 FastComments 設定表單。 - View FastComments - 需要此權限才能看到留言小工具。沒有此權限時小工具不會渲染。
- Toggle FastComments - 允許使用者使用欄位小工具針對每個實體啟用或停用評論。
預設只有擁有 administer site configuration 權限的使用者可以變更 FastComments 設定。若您希望訪客能看到小工具,請將 View FastComments 權限授予匿名及已驗證的使用者。
多語系 
此模組會自動將目前 Drupal 站點的語言傳遞給每一個 FastComments 小工具。如果您的 Drupal 站點設定為多種語言,留言介面將在對應語言中呈現,無需任何額外設定。
這適用於所有小工具類型:Live Comments, Streaming Chat, Collab Chat, Image Chat, Recent Comments, and Top Pages.
歐盟資料駐留 
如果您的 FastComments 帳戶託管在歐盟 (EU),請在 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,而不是從預設的美國儀表板。模組的其他部分則相同。
系統需求 
- Drupal 10 或 11
- PHP 8.1 或更新版本
- 一個 FastComments 帳戶
此模組不需要任何其他 Drupal 模組或第三方函式庫。它僅依賴 Drupal 核心 (user, field)。
一個 <noscript> 回退會為未啟用 JavaScript 的訪客提供伺服器端渲染的留言,因此在停用腳本的瀏覽器中,Live Comments 和 Streaming Chat 仍然可以運作。