FastComments.com

Add Live Discussions to Super.So Sites


FastComments Collab Chat は Super.so サイトにライブのインラインディスカッションを追加して、次のレベルへ引き上げます。ユーザーはテキストの一部をハイライトしてコメントを付け合い、 共同で、一緒に — ライブでやり取りできます!

ここでは、数分で完了するインストール手順について説明します。


ステップ 1:設定を開く Internal Link

まずコードエディタを開く必要があります。FastCommentsをすべてのページに追加する場合は、左下のCodeを選択してください:

コード設定を開く
コード設定を開く

特定のページに追加したい場合は、そのページの設定でEdit Custom Codeを選択します。

次にBodyタブを選択しましょう。これは重要です!Headにコードスニペットをインストールしても機能しません

Bodyを選択
Bodyを選択

これでステップ2の準備が整いました。


ステップ 2:事前に作成されたコードを追加する Internal Link


次の手順では、以下の既成ウィジェットコードをコピーする必要があります。

FastComments.com にログインしている限り、以下のコードスニペットには既にアカウント情報が含まれています。コピーしましょう:

Super.so FastComments コラボチャットのコード
Copy Copy
1
2<script src="https://cdn.fastcomments.com/js/embed-collab-chat.min.js"></script>
3<script>
4 (function () {
5 let currentPathname = window.location.pathname;
6 let currentWidget = null;
7 let currentTopBar = null;
8
9 function load() {
10 if (!window.FastCommentsCollabChat) {
11 console.log('...no script, trying again...');
12 return setTimeout(load, 100);
13 }
14
15 const target = document.querySelector('.super-content');
16 if (!target || !target.innerHTML || target.innerHTML.length < 100) {
17 console.log('...no content, trying again...');
18 return setTimeout(load, 100);
19 }
20
21 // 既存のインスタンスをクリーンアップ
22 if (target.fastCommentsInstance) {
23 target.fastCommentsInstance.destroy();
24 }
25
26 // 既存のトップバーが存在する場合はクリーンアップ
27 if (currentTopBar && currentTopBar.parentNode) {
28 currentTopBar.parentNode.removeChild(currentTopBar);
29 }
30
31 // 新しいトップバーを作成
32 const topBarTarget = document.createElement('div');
33 target.parentNode.insertBefore(topBarTarget, target);
34 topBarTarget.style.maxWidth = 'var(--layout-max-width)';
35 topBarTarget.style.margin = '0 auto';
36 currentTopBar = topBarTarget;
37 currentWidget = target;
38
39 // FastComments Collab Chat を初期化
40 target.fastCommentsInstance = FastCommentsCollabChat(target, {
41 tenantId: "demo",
42 topBarTarget: topBarTarget
43 });
44
45 // 現在のパス名を更新
46 currentPathname = window.location.pathname;
47 }
48
49 // 初期ロード
50 load();
51
52 // 変更を500msごとにチェック
53 setInterval(() => {
54 // パス名が変更された場合はリロード
55 if (window.location.pathname !== currentPathname) {
56 console.log('Pathname changed, reloading...');
57 load();
58 return;
59 }
60
61 // ウィジェットが削除された場合はリロード
62 if (currentWidget && !currentWidget.parentNode) {
63 console.log('Widget removed, reloading...');
64 load();
65 return;
66 }
67
68 // コンテナの内容が空になった場合はリロード
69 const target = document.querySelector('.super-content');
70 if (target && target.innerHTML.length < 100) {
71 console.log('Container emptied, reloading...');
72 load();
73 }
74 }, 500);
75 })();
76</script>
77

Now paste in the Body area:

貼り付けたコード
貼り付けたコード

If you see a "this is a demo message" after pasting the code:

  • fastcomments.com のアカウントにログインしていることを確認してください。
  • サードパーティのクッキーが有効になっていることを確認してください。
  • このページをリフレッシュし、コードスニペットを再度コピーしてください。tenantId があなたのテナント識別子で埋められているはずです。

参照:通常のコメントウィジェット Internal Link


Super.so の Notion 記事にライブコメントウィジェットを追加する

Collab Chat に加えて、Notion 記事の下部に従来型のコメントウィジェットを追加できます。これにより、読者が記事全体に対してコメントを残したり議論を行ったりできます。

インストール手順

以下のコードをコピーして、Super.so のサイト設定の Body セクションに貼り付けてください:

Super.so FastComments ライブコメントウィジェット
Copy Copy
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<script>
4 (function () {
5 let currentPathname = window.location.pathname;
6 let currentWidget = null;
7
8 function load() {
9 if (!window.FastCommentsUI) {
10 console.log('...no script, trying again...');
11 return setTimeout(load, 100);
12 }
13
14 const contentArea = document.querySelector('.notion-root');
15 if (!contentArea || !contentArea.innerHTML || contentArea.innerHTML.length < 100) {
16 console.log('...no content, trying again...');
17 return setTimeout(load, 100);
18 }
19
20 // 既存のインスタンスをクリーンアップ
21 if (contentArea.fastCommentsInstance) {
22 contentArea.fastCommentsInstance.destroy();
23 }
24
25 // 新しいターゲットを作成
26 const target = document.createElement('div');
27 contentArea.append(target);
28 currentWidget = target;
29
30 // FastComments を初期化
31 contentArea.fastCommentsInstance = FastCommentsUI(target, {
32 tenantId: "demo",
33 urlId: window.location.pathname
34 });
35
36 // 現在のパス名を更新
37 currentPathname = window.location.pathname;
38 }
39
40 // 初回ロード
41 load();
42
43 // 変更を500msごとにチェック
44 setInterval(() => {
45 // パス名が変わったらリロード
46 if (window.location.pathname !== currentPathname) {
47 console.log('Pathname changed, reloading...');
48 load();
49 return;
50 }
51
52 // ウィジェットが削除されたらリロード
53 if (currentWidget && !currentWidget.parentNode) {
54 console.log('Widget removed, reloading...');
55 load();
56 return;
57 }
58
59 // コンテナが空になったらリロード
60 const contentArea = document.querySelector('.notion-root');
61 if (contentArea && contentArea.innerHTML.length < 100) {
62 console.log('Container emptied, reloading...');
63 load();
64 }
65 }, 500);
66 })();
67</script>
68

重要な注意点

  • コメントウィジェットは Notion 記事の下部に表示されます
  • 各ページは URL パスに基づいた固有のコメントスレッドを持ちます
  • FastComments アカウントの実際のテナントID で "demo" を置き換えてください
  • ウィジェットは Super.so の動的ページ読み込みを自動で処理します

カスタマイズ Internal Link


FastComments はお使いのサイトに合わせてカスタマイズできるように設計されています。

カスタムスタイリングを追加したり、設定を調整したい場合は、カスタマイズのドキュメント をご覧ください。