FastComments.com

Add Live Discussions to Super.So Sites


FastComments Collab Chat подиже Super.so сајтове на виши ниво додавањем дискусија унутар текста које се одржавају уживо. Корисници могу истакнути и коментарисати делове текста заједнички - уживо!

Овде ћемо покрити кораке инсталације који би требали трајати само неколико минута.


Корак 1: Отворите подешавања Internal Link

Прво треба отворити уређивач кода. Ако желите додати FastComments на све странице, једноставно у доњем лијевом углу изаберите Code:

Отворите поставке кода
Отворите поставке кода

Ако желите додати на одређену страницу, онда у поставкама те странице изаберите Edit Custom Code.

Now let's select the Body tab. Ово је важно!. Installing the code snippet in Head does not work.

Изаберите Body
Изаберите Body

Сада сте спремни за корак 2.

Корак 2: Додајте унапред припремљени код Internal Link

У следећем кораку морате копирати унапред припремљени код видгета испод.

Све док сте пријављени на FastComments.com доле наведени исјечак кода ће већ садржати информације о вашем налогу. Хајде да га копирамо:

Super.so FastComments Collab Chat Код
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 // Провјеравај на сваких 500мс за промјене
53 setInterval(() => {
54 // Поново учитај ако се pathname промијени
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

Сада залепите у област Body:

Залепљени код
Залепљени код

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

  • Увјерите се да сте пријављени на свој fastcomments.com налог.
  • Увјерите се да имате омогућене колачиће трећих страна.
  • Затим освежите ову страницу и поново копирајте исјечак кода. Он би требао имати попуњено tenantId поље са идентификатором вашег tenant-а.

Погледајте такође: Уобичајени видгет за коментаре Internal Link

Dodavanje widgeta za komentare uživo na vaše Super.so Notion članke

Pored Collab Chata, možete dodati tradicionalni widget za komentare na dno vaših Notion članaka. Ovo omogućava čitaocima da ostave komentare i vode diskusije o čitavom članku.

Koraci instalacije

Kopirajte sljedeći kod i zalijepite ga u odjeljak Body postavki vaše Super.so stranice:

Super.so FastComments widget za komentare uživo
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 // Očisti postojeću instancu
21 if (contentArea.fastCommentsInstance) {
22 contentArea.fastCommentsInstance.destroy();
23 }
24
25 // Kreiraj novi ciljni element
26 const target = document.createElement('div');
27 contentArea.append(target);
28 currentWidget = target;
29
30 // Inicijalizuj FastComments
31 contentArea.fastCommentsInstance = FastCommentsUI(target, {
32 tenantId: "demo",
33 urlId: window.location.pathname
34 });
35
36 // Ažuriraj trenutnu putanju
37 currentPathname = window.location.pathname;
38 }
39
40 // Početno učitavanje
41 load();
42
43 // Provjeri svake 500ms ima li promjena
44 setInterval(() => {
45 // Ponovo učitaj ako se putanja promijenila
46 if (window.location.pathname !== currentPathname) {
47 console.log('Pathname changed, reloading...');
48 load();
49 return;
50 }
51
52 // Ponovo učitaj ako je widget uklonjen
53 if (currentWidget && !currentWidget.parentNode) {
54 console.log('Widget removed, reloading...');
55 load();
56 return;
57 }
58
59 // Ponovo učitaj ako je kontejner ispraznjen
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

Važne napomene

  • Widget za komentare će se pojaviti na dnu vaših Notion članaka
  • Svaka stranica dobija svoju jedinstvenu nit komentara na osnovu URL putanje
  • Obavezno zamijenite "demo" sa stvarnim tenant ID-jem iz vašeg FastComments naloga
  • Widget automatski podržava dinamičko učitavanje stranica Super.so

Прилагођавање Internal Link


FastComments je dizajniran da se prilagodi vašoj stranici.

Ako želite dodati prilagođeni stil ili promijeniti konfiguraciju, Pogledajte našu dokumentaciju o prilagođavanju i konfiguraciji da saznate kako.