FastComments.com


自訂與設定

背景

在此您將找到關於評論小工具支援的每項功能與設定的深入文件。

本文件將涵蓋核心概念,並深入探討各功能領域,包含操作說明與常見陷阱。

將提供程式碼範例並以重點標示相關行;在適用情況下也會提供設定頁面的截圖。

程式碼範例將使用我們的原生 JavaScript 函式庫;然而,設定選項在所有版本的評論小工具(React、Vue 等)中使用完全相同的名稱。

本指南中概述的大多數設定與功能都不需要撰寫任何程式碼。


在不同頁面呈現相同評論 Internal Link


由於 urlId 參數允許我們定義留言綁定到哪個頁面或 id,我們只需在那些頁面上將 urlId 設為相同的值即可。

The Same Comments on Multiple Pages
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "urlId": "https://example.com/source-page"
8}];
9</script>
10

自訂字型 Internal Link

FastComments 設計上可供客製化,我們小工具使用的字型也不例外。

預設情況下,FastComments 使用 system font stack,以在各種裝置上呈現最佳外觀。

若要定義您自己的字型,請參閱 自訂 CSS 文件

在該處您會找到定義自訂 CSS 的方法,從而讓您能指定所需的字型。

如何定義字型

要覆寫字型,我們建議使用 .fast-comments, textarea 選擇器來定義您的 CSS。範例如下:

自訂外部字型範例
Copy CopyRun External Link
1
2@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap');
3.fast-comments, textarea {
4 font-family: 'Roboto', sans-serif;
5}
6

支援深色背景(深色模式) Internal Link

預設情況下,FastComments 的留言小工具會在大多數網站上自動偵測深色模式。

當偵測到深色模式時,FastComments 會將原本白底黑字的顯示切換為黑底白字。圖片也會相應變化。

在頁面載入時,小工具會嘗試判斷留言小工具背後頁面背景的明暗程度。這表示頁面可能是白色背景,但如果你將留言小工具放在一個黑色背景的容器內,仍應自動啟用深色模式以確保留言可讀。

然而,這個依賴判定「亮度」的偵測機制,有時可能不會在你想要的情況下啟用深色模式。若要強制啟用,請將 hasDarkBackground 標記設為 true,如下所示:

Force Dark Background Mode
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "hasDarkBackground": true
8}];
9</script>
10

從評論連結到頁面 Internal Link

當傳送通知電子郵件,或在像審核頁面這類的使用者介面中呈現留言時,能夠從留言連結回其所在的頁面會很有幫助。

如果 URL ID 並不總是實際的識別碼,我們就必須在其他地方儲存 URL。這就是 "url" 屬性的用途,定義如下。

Defining a Custom URL
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "url": "https://example.com/article-5"
8}];
9</script>
10

一個常見的使用情境是將留言串綁定到一個識別碼(例如文章),然後再連回特定頁面,例如:

Defining Custom URL and URL IDs together
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "url": "https://example.com/article-5",
8 "urlId": "article-5"
9}];
10</script>
11

URL 不會移除常見的行銷參數。預設情況下,會以當前頁面的 URL 作為與留言一起儲存的 URL。


決定要呈現的頁面 Internal Link


在擷取與呈現評論時,評論小工具需要知道要從哪一頁開始。預設情況下,它會從 第一頁開始,只呈現該頁。

如有需要,可將要呈現的確切頁面作為設定 startingPage 傳給評論小工具。

Specifying The Page to Render
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "startingPage": 1
8}];
9</script>
10

請注意,頁碼從零開始,因此上述範例會呈現第二頁。


切換評論串而不重新載入頁面 Internal Link

我們已說明 urlId 是評論所綁定的頁面或文章識別碼。

再說一次,如果未定義,urlId 將預設為當前頁面的 URL。

那麼對於 SPA(單頁應用程式),當評論所綁定的頁面或內容在沒有重新載入整頁的情況下動態變更時該怎麼辦?

Angular、React、Vue 等

使用我們的函式庫(例如 Angular 與 React),只要更新傳入 widget 的 urlId 屬性,評論元件就會重新整理。你可以在 React 範例中看到這個行為,例如 這裡

VanillaJS

如果你使用 VanillaJS 函式庫,情況會比較複雜,因為沒有像 Angular 或 React 這類的框架來處理資料綁定或狀態傳播。

當你實例化 VanillaJS widget 時,它會回傳一些函式,可藉由呼叫這些函式來更新元件。

下面是一個實用範例,示範如何更改頁面 hash 並更新評論元件:

切換頁面 Hash 範例
Copy CopyRun External Link
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<button id="change-page"></button>
4<div id="fastcomments-widget"></div>
5<script>
6 (function fastCommentsMain() {
7 let config = {
8 tenantId: 'demo'
9 };
10 let instance = window.FastCommentsUI(document.getElementById('fastcomments-widget'), config);
11
12 let page = '#page-1';
13 function getNextPage() {
14 if (page === '#page-1') {
15 return '#page-2';
16 } else {
17 return '#page-1';
18 }
19 }
20
21 let button = document.getElementById('change-page');
22 function nextPage() {
23 page = getNextPage();
24 button.innerText = 'Go to ' + getNextPage();
25 window.location.hash = page;
26 let locationString = window.location.toString();
27
28 config.url = locationString; // We update url, too, so notifications can link back to the right page
29 config.urlId = locationString;
30
31 instance.update(config);
32 }
33 nextPage();
34 button.addEventListener('click', nextPage);
35 })();
36</script>
37

停用圖片重新導向 Internal Link

預設情況下,FastComments 允許使用者上傳圖片。當使用者點擊該圖片時,FastComments 預設會, 在新分頁中開啟並完整顯示該圖片。將此旗標設為 true 可停用此行為:

Disable Image Redirect
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "disableImageRedirect": true
8}];
9</script>
10

如果您不打算自行攔截圖片點擊事件(參見 onImageClicked),我們建議將此設定與一些樣式結合使用 以移除圖片可被點擊的外觀。

標示新評論 Internal Link

FastComments 提供幾種方法來突顯新的留言。

首先,預設情況下,會觸發應用內通知的留言(回覆、同一討論串的回覆,或你訂閱的頁面 上的留言),會自動以使用者頭像略微發光的方式突顯。顏色可以透過 CSS 使用 is-unread 類別自訂。

過去 24 小時內發佈的留言會被套用 24hr 類別,可用於樣式設定。

最後,任何在使用者工作階段中即時出現的新留言會透過動畫突顯數秒鐘。這是透過 is-live CSS 類別實現的,也可以進行自訂。

電子郵件範本 Internal Link

FastComments 寄給您客戶的電子郵件可以自訂。範本、邏輯與翻譯都可以更改。文字可以針對每個語系自訂,樣式甚至可以針對每個網域更改。 在此了解有關自訂電子郵件範本的更多資訊。

新即時評論顯示在底部 Internal Link

預設情況下,新即時評論會在發佈時即時顯示於評論列表的最上方。

啟用此選項後,新即時評論會改為加入列表底部。這會影響使用者在瀏覽評論串時,即時發佈的評論顯示方式。

New Live Comments to Bottom
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "newCommentsToBottom": true
8}];
9</script>
10

啟用此設定後:

  • 其他使用者發表的新即時評論會顯示在評論列表的底部
  • 使用者會即時看到新評論出現在現有評論的下方
  • 這只會影響即時評論更新 - 不會影響初始頁面載入時的排序
  • 當使用者在追蹤討論時,這有助於維持閱讀流程

請注意,此設定僅影響新即時評論在即時到達時的放置位置。它不會影響頁面載入時的初始排序。

啟用無限滾動 Internal Link

預設情況下,FastComments 小工具會自動在垂直方向調整大小以容納所有可見評論。分頁是透過在目前頁面末端的「檢視下一頁」 按鈕來實現,因為我們發現這種互動對大多數使用者來說是最舒服的。

然而,有些情況會偏好使用無限滾動。例如,我們在 Stream Chat 產品中使用此功能。

我們可以透過將 enableInfiniteScrolling 標誌設為 true 來隱藏「檢視下一頁」按鈕並改用無限滾動:

Enabling Infinite Scrolling
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "enableInfiniteScrolling": true
8}];
9</script>
10

這還需要加入自定義 CSS。為 .comments 選擇器新增自定義 CSS 以啟用捲動,例如:

啟用無限滾動
Copy CopyRun External Link
1
2.comments {
3 max-height: 500px;
4 overflow-y: auto;
5}
6

完整的可運作範例如下:

Enabling Infinite Scrolling
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "enableInfiniteScrolling": true,
8 "customCSS": ".comments { max-height: 500px; overflow-y: auto; }"
9}];
10</script>
11

在上述範例中我們使用 customCSS 屬性,但建議改為使用 Widget Configuration UI 以提升效能。請參閱自定義 CSS 文件。 See the Custom CSS documentation.

一次呈現所有評論 — 停用分頁 Internal Link


若要停用分頁,並一次呈現所有評論,將 startingPage 設為 -1。

Render All Comments
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "startingPage": -1
8}];
9</script>
10

禁止新增頂層評論 Internal Link

noNewRootComments 設為 true 會使小工具隱藏根回覆區域,但仍允許使用者回覆 子評論。舉例來說,您可以在頁面載入時有條件地設定此項,以僅允許部分使用者發表頂層評論。

Prevent New Root Comments
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "noNewRootComments": true
8}];
9</script>
10

最大回覆深度 Internal Link

預設情況下,FastComments 允許無限制的回覆層級,會建立一個討論串結構,使用者可以無限地對回覆再進行回覆。

The maxReplyDepth option allows you to limit how deep reply threads can go. When the maximum depth is reached, users will no longer see a reply button on comments at that level.

Limiting Reply Depth to 2 Levels
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "maxReplyDepth": 2
8}];
9</script>
10

當 maxReplyDepth 設為 2:

  • 使用者可以在頂層發表評論(深度 0)
  • 使用者可以回覆頂層評論(深度 1)
  • 使用者可以回覆那些回覆(深度 2)
  • 深度超過 2 不允許再有進一步回覆

Setting to 1 would only allow replies to top-level comments, creating a flatter discussion structure.

Setting maxReplyDepth to 0 would disable all replies, allowing only top-level comments. If not specified, replies can be nested without limit.

單一登入 (SSO) 概覽 Internal Link

SSO,或稱單一登入,是一套慣例,用來讓您或您的使用者在不需建立另一組帳號的情況下使用 FastComments。

假設您不允許匿名留言,則需有帳號才能在 FastComments 留言。我們讓這個註冊流程非常簡單——使用者只要在留言時留下一個電子郵件地址即可。 不過,我們理解連這一點對某些網站來說也是額外摩擦。

我們可以透過為整個網站只使用一個登入流程來減少這種摩擦。

How do I get it?

所有帳號類型目前都可使用 SSO。不過,SSO 使用者的最大數量會依您購買的方案而有所不同。與其他功能一樣,Pro 計畫及以上方案提供直接的開發支援。

讓我們比較各個選項,然後深入說明每個選項的細節。

User and Comment Migrations

當從像 Disqus 這類具有 SSO 的平台遷移時,您原本就會有使用者及其留言。

留言會作為遷移的一部分被匯入,無論是透過 API、我們的匯入介面 (Import UI),或是客服支援。如果匯入介面支援您要遷移的來源平台,則建議使用匯入介面,因為它包含錯誤處理、頭像與媒體的擷取與上傳,以及批次工作監控系統。

使用者本身會在第一次檢視留言串時自動加入。或是,他們也可以透過 API 事先加入,但這樣做沒有太多優勢。

如果留言已被匯入,而 SSO 使用者並未透過 API 手動新增,則當使用者在第一次檢視任何留言串時,留言會自動被遷移到該使用者的帳戶。之後他們就能管理、編輯和刪除自己原本所發表的留言。

自動遷移是透過電子郵件或使用者名稱進行。有些平台在匯出時不提供電子郵件,例如 Disqus,因此在這種情況下我們會退而求其次使用使用者名稱。

  • 只要您在 SSO payload 中傳遞相符的使用者名稱及電子郵件,我們就會將電子郵件加入到個別的留言物件中,以便通知和提及功能能正常運作。

如果您希望同時匯入留言和使用者,請與支援團隊合作,在透過 API 匯入使用者後,將留言遷移到對應的使用者帳戶。

總結來說,遷移的最簡單路徑是:

  1. 匯入留言。
    1. 如果在 Manage Data -> Imports 使用匯入介面,頭像和其他媒體會自動被遷移。
  2. 設定 Secure 或 Simple SSO。
  3. 讓遷移在使用者首次登入時自動發生。
    1. 如果使用者的留言數少於 50k,這通常只會增加不到一秒的頁面載入時間。

WordPress Users

如果您使用我們的 WordPress 外掛,就不需要撰寫任何程式碼!只要前往外掛的管理頁面,點選 SSO 設定,然後啟用即可。

這會帶您進入一個單按鈕的精靈,該精靈會為您建立 API 金鑰、將金鑰傳送到您的 WordPress 安裝並啟用 SSO。我們已將這些步驟整合為單一按鈕點擊以簡化流程。

請注意,如果您是第一次安裝該外掛,必須完成設定流程,才能看到包含 SSO 設定按鈕的管理頁面。

WordPress SSO - Moderators

請注意,目前要在使用者透過 FastComments WordPress 外掛留言時,讓「Moderator」徽章顯示在您的版主旁邊, 他們也必須在 FastComments 儀表板中被新增為版主,並且其電子郵件需經過驗證。

Custom Integrations

對於自訂整合,有兩種選項。

Option One - Secure SSO

使用 Secure SSO 時,FastComments 可以確認正在留言、投票與閱讀留言的使用者確實是您網站上的真實使用者。

只要您建立一個有效的 payload,使用者就會獲得無縫的留言體驗。

在 Secure SSO 中,SSO payload 是在伺服器端使用 HMAC 驗證建立,然後傳遞到客戶端的小工具(widget)。

使用 Secure SSO 時,使用者帳戶與其他 FastComments 使用者群是完全分離的。這表示如果我們有兩個合作夥伴 Company A 與 Company B,兩者都可以擁有使用者名稱為 "Bob" 的 SSO 使用者。

Requirements

  • 基本的後端開發知識。
  • 基本的祕密 API 金鑰處理知識。
  • 基本的 API 開發或伺服器端渲染知識。

Pros

  • 安全。
  • 無縫的留言體驗。

Cons

  • 需要後端開發。

Updating User Data

使用 Secure SSO 時,每次您傳遞 sso user payload,我們都會使用最新的資訊來更新該使用者。例如,如果 使用者原本的使用者名稱是 X,而您在 SSO payload 中傳入 Y,則他們的使用者名稱會變更為 Y

如果您想用此方法移除某些值,請將它們設定為 null(不是 undefined)。

Secure SSO API

我們也提供與 SSO 使用者互動的 API。請參閱 the docs

請注意,使用 Secure SSO 時,使用者會在頁面載入時自動在背景建立。您不需要批次匯入使用者。

Option Two - Simple SSO

Simple SSO 的替代方案是直接把使用者資訊傳給留言小工具。

使用 Simple SSO 時並不需要提供電子郵件,但若沒有電子郵件,他們的留言將顯示為「未驗證」。

注意! 截至 2022 年初,使用 Simple SSO 的使用者名稱不需要在整個 FastComments.com 上保持唯一。

理想上,只有在您開發的平台無法提供後端存取時,才應選用 Simple SSO。

Requirements

  • 基本的前端(client-side)開發知識。
  • 至少需要知道使用者的電子郵件。

Pros

  • 簡單。
  • 所有活動仍會被驗證。
  • 使用者不需輸入他們的使用者名稱或電子郵件。

Cons

  • 比 Secure SSO 安全性較低,因為客戶端的 payload 可能被構造為任意使用者。

Simple SSO API

透過 Simple SSO 流程自動建立的使用者會以 SSOUser 物件儲存。它們可以透過 SSOUser API 存取與管理。請參閱 the docs

自訂整合 - 簡易單一登入 (SSO) Internal Link

With Simple SSO, we can provide the commenting widget with information about the user so that they don't have to enter their username or email to comment.

We can configure Simple SSO as follows:

Simple SSO
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "simpleSSO": {
8 "username": "Bob",
9 "email": "bob@example.com",
10 "avatar": "https://example.com/bob.png",
11 "websiteUrl": "https://example.com/profiles/bob",
12 "displayName": "Bob's Name",
13 "displayLabel": "VIP User",
14 "loginURL": "https://example.com/login",
15 "logoutURL": "https://example.com/logout",
16 "badgeConfig": {
17 "badgeIds": [
18 "badge-id-1",
19 "badge-id-2"
20 ],
21 "override": false
22 }
23 }
24}];
25</script>
26

The user will be logged in, and will create an SSO User behind the scenes. The user will have createdFromSimpleSSO set to true if fetched from the API.

Notes:

  • Email is the unique identifier for Simple SSO.
  • Providing an email with Simple SSO is not required, however by default their comments will show as "Unverified". If no email is provided, the user cannot be fully authenticated.
  • NEW Since Jan 2022: Usernames do not have to be unique across all of fastcomments.com
  • Simple SSO can automatically create and update SSO users, if an email is provided, and the user was not originally created from Secure SSO.
  • You can specify badges for the user with the badgeConfig property. The badgeIds array contains the IDs of badges to associate with the user. If override is set to true, it will replace all existing badges displayed on comments; if false it will add to existing badges.

自訂整合 - 從 Disqus SSO 遷移 Internal Link

Disqus 與 FastComments Secure SSO 之間最大的差異是 Disqus 使用 SHA1 進行加密,而我們使用 SHA256。

這表示從 Disqus 遷移很容易 - 將使用的雜湊演算法從 SHA1 改為 SHA256,並更新傳遞給 UI 的屬性名稱。

自訂整合 - 從 Commento SSO 遷移 Internal Link


Commento 使用截然不同的 SSO 方式 - 他們要求你有一個端點,他們會呼叫該端點來驗證使用者。FastComments 則相反 - 只需使用你的密鑰對使用者的資訊進行編碼並雜湊,然後傳遞即可。

回呼 (Callbacks) Internal Link

所有評論元件的函式庫(目前支援 Angular、React、Vue)都支援回呼。

回呼在設定物件中指定,各函式庫使用相同的簽章。

支援的回呼有:

  • onInit
  • onAuthenticationChange
  • onRender
  • commentCountUpdated
  • onReplySuccess
  • onVoteSuccess
  • onImageClicked
  • onOpenProfile
  • onCommentSubmitStart
  • onCommentsRendered

確切的簽章可以在 TypeScript definitions 找到。

以下為使用所有回呼的範例:

回呼範例
Copy CopyRun External Link
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5 window.FastCommentsUI(document.getElementById('fastcomments-widget'), {
6 tenantId: 'demo',
7 onInit: function () {
8 console.log('Library started to fetch comments!');
9 },
10 onAuthenticationChange: function (eventName, userObj) {
11 console.log('User authenticated!', eventName, userObj);
12 },
13 onRender: function () {
14 console.log('Render event happened!');
15 },
16 commentCountUpdated: function (newCount) {
17 console.log('New comment count:', newCount);
18 },
19 onReplySuccess: function (comment) {
20 console.log('New comment saved!', comment);
21 },
22 onVoteSuccess: function (comment, voteId, direction, status) {
23 console.log('New vote saved!', comment, voteId, direction, status);
24 },
25 onImageClicked: function (src) {
26 console.log('Image clicked!', src);
27 },
28 onOpenProfile: function (userId) {
29 console.log('User tried to open profile', userId);
30 // return true; // 傳回 true 可阻止預設行為(開啟 fastcomments.com 的使用者個人頁)。
31 },
32 onCommentSubmitStart: function(comment, continueSubmitFn, cancelFn) {
33 console.log('Trying to submit comment', comment);
34 setTimeout(function() { // 模擬非同步行為(呼叫 API 等)。
35 if(confirm('Should submit?')) {
36 continueSubmitFn();
37 } else {
38 cancelFn('Some optional error message');
39 }
40 }, 1000);
41 },
42 onCommentsRendered: function(comments) {
43 // comments 會根據頁面上的預設排序進行排序,該排序可能是 Most Relevant(例如:最多被按讚等)或 Newest First
44 const topCommentInList = comments[0];
45 console.log('First Comment Rendered:', topCommentInList.avatarSrc, topCommentInList.commenterName, topCommentInList.commentHTML);
46 }
47 });
48</script>
49

頁面標題 Internal Link


目前的頁面標題會與指定的 urlId 關聯,並儲存以供審核工具使用。

預設情況下,此值會從 document.title 擷取。

如有需要,可指定自訂的頁面標題,如下所示:

Specifying The Page Title
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "pageTitle": "Article 42"
8}];
9</script>
10

評論數量與計算所有巢狀回覆 Internal Link

評論小工具頂部顯示的評論數可以只顯示所有「頂層」評論,也就是那些回覆 是直接回覆頁面或文章本身的,或者它可以是 all 巢狀評論的計數。

預設情況下,這個設定為 true - 它是後者的計數 - 全部評論。在舊版本的評論小工具中, 預設值為 false

我們可以更改此行為,透過將 countAll 標記設為 true,讓它計算 所有 巢狀評論。

Counting All Comments
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "countAll": true
8}];
9</script>
10

如果我們希望計數只反映頂層評論,則將標記設為 false。

Counting Top Level Comments
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "countAll": false
8}];
9</script>
10

目前無法在不更改程式碼的情況下自訂此行為。


提及群組 ID Internal Link

一個用於 @mentions 自動完成的 ID 列表。當你想要防止在沒有交集群組的使用者被標註時,這會很有用。

指定時,輸入 @ 字元後,自動完成只會提供其他群組的使用者。

Limit Groups for Mentions
Copy CopyRun External Link
1
2<script async src="https://cdn.fastcomments.com/js/embed-v2-async.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5window.fcConfigs = [{
6 "tenantId": "demo",
7 "mentionGroupIds": [
8 "yxZAhjzda",
9 "QT19nXbqB"
10 ]
11}];
12</script>
13