FastComments.com

為 LearnWorlds 課程與頁面新增留言

FastComments 可以新增到 LearnWorlds 的兩個地方:

  • 課程內容,在課程大綱中使用 Embed 學習活動。LearnWorlds 列出 Embed 學習活動適用於 Trial、Starter、Pro Trainer、Learning Center 以及 High Volume & Corporate 方案。
  • 使用 LearnWorlds Site Builder 建立的網站頁面,透過 Embed 區塊。

本教學需要一個 FastComments 帳號。請先登入再複製程式碼片段,以確保其中包含您帳號的 tenant ID。您可以在此建立帳號。

步驟 1:建立嵌入學習活動 Internal Link

課程中的每個留言區都是一個獨立的 Embed 學習活動。在學習者應能留言的任何地方新增一個:

  1. 開啟 Course Manager,找到該課程,並前往 Course outline。
  2. 點擊 Add activity 並選擇 Embed。
  3. 為該活動輸入一個標題。
  4. 點擊 Save and Edit。

如果您改為點擊了 Save,請將滑鼠懸停在新的活動上並點擊 Settings 以開啟程式碼欄位。

步驟 2:貼上 FastComments 課程代碼 Internal Link

複製以下程式碼片段。如果 tenantId 是 demo,請登入您的 FastComments 帳號並重新載入此頁面,讓程式碼片段包含您的租戶 ID。

FastComments LearnWorlds 課程程式碼片段
Copy Copy
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5 (function fcLoad() {
6 // 為每個 Embed 學習活動更改此值。每個值都是一個獨立的留言串。
7 var threadId = 'my-course-activity-1';
8
9 function getPageWindow() {
10 try {
11 if (window.top.location.href) {
12 return window.top;
13 }
14 } catch (e) {}
15 return window;
16 }
17
18 function tryLoad() {
19 var container = document.getElementById('fastcomments-widget');
20 if (!container || !window.FastCommentsUI) {
21 return setTimeout(tryLoad, 500);
22 }
23 if (container.fastCommentsSetup) {
24 return;
25 }
26 var pageWindow = getPageWindow();
27 window.FastCommentsUI(container, {
28 tenantId: 'demo',
29 urlId: threadId,
30 url: pageWindow.location.href,
31 pageTitle: pageWindow.document.title
32 });
33 container.fastCommentsSetup = true;
34 }
35
36 tryLoad();
37 })();
38</script>
39

在貼上之前,請先更改 threadId 的值。threadId 的值會以 urlId 的形式傳遞給小工具,用於識別留言串。請為每個 Embed 學習活動使用不同的值,例如 intro-course-lesson-1。兩個使用相同值的活動會顯示相同的留言。詳情請參閱 URL ID。

將程式碼片段貼到 Embed 學習活動的程式碼欄位中,然後點擊 Save。

程式碼片段會在可行時從頂層瀏覽器視窗讀取頁面網址和標題,否則從其自身的視窗讀取。這些值會與每則留言一起儲存,並用於通知和審核儀表板中的連結。

步驟 3:隱藏原生課程討論分頁 Internal Link

LearnWorlds 課程可以在課程播放器中顯示原生的「討論」分頁。若要在課程中僅顯示 FastComments,請為該課程關閉「討論」分頁:

  1. 前往 Courses & Programs,然後前往 Courses。
  2. 選擇該課程。
  3. 前往 Course settings 並開啟 Course Player。
  4. 停用 Show the course Discussion tab 設定。

課程播放器設定僅適用於單一課程。全校層級的課程討論設定位於 Settings、School settings、Community access 中的 Course Discussion 區段。

此步驟為選填。FastComments 不依賴原生「討論」分頁的顯示或隱藏。

步驟 1:新增嵌入區塊 Internal Link

若要在使用 LearnWorlds Site Builder 建置的頁面上新增留言:

  1. 前往 Website,然後前往 Design,再前往 Edit Website。
  2. 在 Page Manager 中選擇要編輯的頁面。
  3. 將滑鼠懸停在頁面上,然後點擊 (+) 圖示以新增區塊。
  4. 選擇 Embed 類別並點擊 Add。
  5. 點擊新元素以在側邊表單中開啟其設定。

步驟 2:貼上 FastComments 頁面代碼 Internal Link

複製以下程式碼片段。如果 tenantId 是 demo,請登入您的 FastComments 帳號並重新載入此頁面,這樣程式碼片段就會包含您的租戶 ID。

FastComments LearnWorlds 頁面程式碼片段
Copy Copy
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5 (function fcLoad() {
6 function getPageWindow() {
7 try {
8 if (window.top.location.href) {
9 return window.top;
10 }
11 } catch (e) {}
12 return window;
13 }
14
15 function tryLoad() {
16 var container = document.getElementById('fastcomments-widget');
17 if (!container || !window.FastCommentsUI) {
18 return setTimeout(tryLoad, 500);
19 }
20 if (container.fastCommentsSetup) {
21 return;
22 }
23 var pageWindow = getPageWindow();
24 window.FastCommentsUI(container, {
25 tenantId: 'demo',
26 urlId: pageWindow.location.pathname,
27 url: pageWindow.location.href,
28 pageTitle: pageWindow.document.title
29 });
30 container.fastCommentsSetup = true;
31 }
32
33 tryLoad();
34 })();
35</script>
36

然後:

  1. 將程式碼片段貼到側邊表單中的 Embeddable script 方框內。
  2. 點擊 Update。
  3. 點擊 Save 以儲存頁面。

LearnWorlds 只會在頁面更新後或預覽時才會渲染嵌入內容,因此在此之前留言區可能不會出現在編輯器中。

此程式碼片段使用頁面路徑作為 urlId,因此同一個程式碼片段可以貼到多個頁面上,而每個頁面都會擁有自己的留言串。

自訂設定 Internal Link

小工具的樣式與行為可以透過自訂 CSS 和組態選項來變更。

請參閱自訂文件以了解可用的選項。