FastComments.com

Add Members-Only Live Commenting to ghost Sites

ืขื FastComments ืื ื—ื ื• ื™ื›ื•ืœื™ื ืœื”ื•ืกื™ืฃ ื‘ืงืœื•ืช ืชื’ื•ื‘ื•ืช ื—ื™ื•ืช ื”ืžื™ื•ืขื“ื•ืช ืœื—ื‘ืจื™ื ื‘ืœื‘ื“ ืœื›ืœ ืืชืจ ืฉื ื‘ื ื” ืขื Ghost.

ื ื•ื›ืœ ืœื™ื™ื‘ื ืื•ื˜ื•ืžื˜ื™ืช ืืช ืฉืžื•ืช ื”ืžืฉืชืžืฉื™ื ืฉืœ ื”ื—ื‘ืจื™ื ืฉืœืš, ืืช ืชืžื•ื ื•ืช ื”ืคืจื•ืคื™ืœ ืฉืœื”ื, ื•ืœื”ื’ื“ื™ืจ ื”ืชืจืื•ืช ืขืœ ืชืฉื•ื‘ื•ืช ืœืชื’ื•ื‘ื•ืช.

ืฉื™ื ืœื‘ ืฉื”ืžื“ืจื™ืš ื”ื–ื” ื“ื•ืจืฉ ื—ืฉื‘ื•ืŸ FastComments. ืžื•ืžืœืฅ ืœื”ื™ืจืฉื ืงื•ื“ื ื•ืื– ืœื—ื–ื•ืจ ืœื›ืืŸ. ืืชื” ื™ื›ื•ืœ ืœื™ืฆื•ืจ ื—ืฉื‘ื•ืŸ ื›ืืŸ.

ื‘ืžื“ืจื™ืš ื–ื” ื ืชืžืงื“ ื‘ื‘ืœื•ื’ ืฉื ื‘ื ื” ืขื Ghost, ืืš ืขื ืงืฆืช ื™ื“ืข ื˜ื›ื ื™ ืื•ืชืŸ ื”ื”ื•ืจืื•ืช ื—ืœื•ืช ืขืœ ื›ืœ ืกื•ื’ ืืชืจ.

ืžื“ืจื™ืš ื–ื” ืžืชื—ื™ืœ ืžื ืงื•ื“ืช ืžื‘ื˜ ืฉืœ ืžืฉืชืžืฉ ื—ื“ืฉ ืžืื•ื“ ืœ-Ghost. ืžืฉืชืžืฉื™ื ื”ืžื ื•ืกื™ื ื‘ืขืจื™ื›ืช ื”ืชื‘ื ื™ื•ืช ืฉืœื”ื ื™ื›ื•ืœื™ื ืœื“ืœื’ ืœ Step 4.

ืื ืืชื ื ืชืงืœ/ื•ืช ื‘ื‘ืขื™ื”, ืืœ ืชื”ืกืกื• ืœืฉืœื•ื— ืืช ืชื‘ื ื™ืช ื”ืขื™ืฆื•ื‘ ื”ืžื™ื•ืฆืืช ืฉืœื›ื ืœื ืฆื™ื’ ื”ืชืžื™ื›ื” ืฉืœื›ื (ื–ื” ืขื“ื™ื™ืŸ ื“ื•ืจืฉ ืืช ื”ืฆืขื“ื™ื 1 - 5).

ืฉืœื‘ 1: ื”ื•ืจื“ ืืช ื”ืชื‘ื ื™ืช ืฉืœืš Internal Link

ื›ื“ื™ ืœื”ื•ืกื™ืฃ ืืช FastComments ืœ-Ghost ื›ืจืื•ื™, ืขืœื™ื ื• ืœืขืจื•ืš ืืช ืงื‘ืฆื™ ื”ืชื‘ื ื™ืช.

ื ืชื—ื™ืœ ื‘ื”ื•ืจื“ืช ื”ืชื‘ื ื™ืช ื”ืงื™ื™ืžืช ืื• ื”ืจืฆื•ื™ื”.

ื ื•ื•ื˜ ืœืœื•ื— ื”ื‘ืงืจื” ืฉืœ ื”ืืชืจ ื•ืœื—ืฅ ืขืœ ื”ืกืžืœ ืฉืœ ื”ื”ื’ื“ืจื•ืช ื‘ืคื™ื ื” ื”ืฉืžืืœื™ืช ื”ืชื—ืชื•ื ื”:

ืคืชื— ืืช ื”ื”ื’ื“ืจื•ืช
ืคืชื— ืืช ื”ื”ื’ื“ืจื•ืช

ืœืื—ืจ ืžื›ืŸ ื‘ื—ืจ ื‘ืืคืฉืจื•ืช Design:

ื‘ื—ืจ ื‘ืขื™ืฆื•ื‘
ื‘ื—ืจ ื‘ืขื™ืฆื•ื‘

ืœืžืจื•ืช ืฉื‘ืขืฆื ืื™ื ื ื• ืžืฉื ื™ื ืืช ื”ืชื‘ื ื™ืช, ืœื—ืฅ ืขืœ Change Theme ื‘ืคื™ื ื” ื”ืฉืžืืœื™ืช ื”ืชื—ืชื•ื ื”:

ืฉื ื” ืืช ื”ืชื‘ื ื™ืช
ืฉื ื” ืืช ื”ืชื‘ื ื™ืช

ื‘ืคื™ื ื” ื”ื™ืžื ื™ืช ื”ืขืœื™ื•ื ื” ื‘ื—ืจ ื‘-Advanced:

ื‘ื—ืจ ื‘ืžืชืงื“ื
ื‘ื—ืจ ื‘ืžืชืงื“ื

...ื•ืื– ื”ื•ืจื“ ืืช ื”ืชื‘ื ื™ืช ื”ื ื•ื›ื—ื™ืช ืื• ื”ืจืฆื•ื™ื”:

ื”ื•ืจื“ ืืช ื”ืชื‘ื ื™ืช
ื”ื•ืจื“ ืืช ื”ืชื‘ื ื™ืช

ืฉืœื‘ 2: ื”ืชืงืŸ ืืช ื”ืชื‘ื ื™ืช ื‘ืื•ืคืŸ ืžืงื•ืžื™ Internal Link

Now that we've downloaded the zip file, extract it to a folder. I've downloaded the default casper.zip and extracted to Downloads\casper on Windows.

Next, you'll want to make sure you have the LTS or newer version of NodeJS installed. You can get that here: https://nodejs.org/en/download/

Once NodeJS is installed, you'll want to install a code editor.

We recommend (and use) Webstorm, which you can get here with a 30-day trial (no credit card needed): https://www.jetbrains.com/webstorm/

The next best free option would probably be Visual Studio Code: https://code.visualstudio.com/download

Once you have your editor setup, and the theme folder open in the editor, open the terminal in the IDE and run:

ื”ืชืงืŸ ืืช ื”ืชื‘ื ื™ืช
Copy Copy
1
2npm install
3

Successful output will look like this (you can ignore warnings):

ืคืœื˜ ื”ืชืงื ื” ืžื•ืฆืœื— ืฉืœ npm
ืคืœื˜ ื”ืชืงื ื” ืžื•ืฆืœื— ืฉืœ npm

This will set up the theme's dependencies for later commands we will run. Also, the export depends on the theme's dependencies being installed, otherwise the re-import will not work properly.


ืฉืœื‘ 3: ืชืŸ ืฉื ืœืชื‘ื ื™ืช ื”ื—ื“ืฉื” Internal Link


ื›ืขืช, ื›ืฉื”ืขืจื›ืช ื”ื ื•ืฉื ืคืชื•ื—ื” ื‘ืขื•ืจืš ืฉืœื ื•, ืคืชื— ืืช package.json ื•ืฉื ื” ืืช ื”ืฉื“ื” name ืœืžืฉื”ื• ืื—ืจ. ื‘ืžืงืจื” ืฉืœื ื• ืคืฉื•ื˜ ื ื•ืกื™ืฃ -fastcomments ื‘ืกื•ืฃ:

ืฉื ื” ืืช ืฉื ื”ืชื‘ื ื™ืช
ืฉื ื” ืืช ืฉื ื”ืชื‘ื ื™ืช

ืื ืืชื” ืžืฉืชืžืฉ ื‘-IDE, ื”ื•ื ื™ืฉืžื•ืจ ืื•ื˜ื•ืžื˜ื™ืช ืื—ืจื™ ืฉืชื‘ืฆืข ืืช ื”ืฉื™ื ื•ื™ ื”ื–ื”.


ืฉืœื‘ 4: ืคืชื— ืืช ืชื‘ื ื™ืช ื”ืคื•ืกื˜ Internal Link

ื›ืขืช ื ืคืชื— ืืช ื”ืชื‘ื ื™ืช ื”ืžืฉืžืฉืช ืœืžืืžืจื™ ื”ื‘ืœื•ื’ ืฉืœื ื•. ื”ื™ื ื ืงืจืืช post.hbs:

ืคืชื— ืืช post.hbs
ืคืชื— ืืช post.hbs

ืฉืœื‘ 5: ื”ื•ืกืฃ ืืช ืงื•ื“ FastComments Internal Link

Next we need to identify where to add the FastComments.com widget code.

If you're using the default casper theme, you'll see a section like this at line 82:

ืžื“ื•ืจ ืชื’ื•ื‘ื•ืช ืžื•ืฉื‘ืช
ืžื“ื•ืจ ืชื’ื•ื‘ื•ืช ืžื•ืฉื‘ืช

If you're using other themes, you won't see this, and will need to add this code after the last </section>:

ื“ื•ื’ืžื” ืœ-
Copy Copy
1
2<section class="article-comments gh-canvas">
3</section>
4

You should have something like this ready:

ืชื‘ื ื™ืช ืžื•ื›ื ื” ืœืงื•ื“ ืชื’ื•ื‘ื•ืช
ืชื‘ื ื™ืช ืžื•ื›ื ื” ืœืงื•ื“ ืชื’ื•ื‘ื•ืช

Once ready, copy the FastComments.com widget code:

ืงื˜ืข ืงื•ื“ ืชื’ื•ื‘ื•ืช ืฉืœ Ghost ืœ-FastComments.com
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 () {
6 let simpleSSO = null;
7
8 {{#if access}}
9 {{#if @member}}
10 simpleSSO = {
11 id: '{{ @member.uuid }}',
12 email: '{{@member.email}}',
13 username: '{{@member.name}}',
14 avatar: '{{ @member.avatar_image }}',
15 optedInNotifications: true,
16 optedInSubscriptionNotifications: true,
17 displayLabel: '{{@member.labels}}'
18 }
19 {{/if}}
20 {{/if}}
21
22 FastCommentsUI(document.getElementById('fastcomments-widget'), {
23 tenantId: "demo",
24 urlId: window.location.pathname,
25 allowAnon: false,
26 simpleSSO: simpleSSO
27 });
28 })();
29</script>
30

...and it should look like this:

ื”ื•ืกืฃ ืืช ืงื•ื“ ื”ืชื’ื•ื‘ื•ืช ืฉืœ FastComments.com
ื”ื•ืกืฃ ืืช ืงื•ื“ ื”ืชื’ื•ื‘ื•ืช ืฉืœ FastComments.com

Coding done. Now we just have to re-import our theme!

ืฉืœื‘ 6: ื™ื™ืฆื ืืช ื”ืชื‘ื ื™ืช ืฉืœืš Internal Link

ืขื›ืฉื™ื• ืขืœื™ื ื• ืœืืจื•ื– ืืช ืงื‘ืฆื™ ื”ืชื‘ื ื™ืช ื—ื–ืจื” ืœืงื•ื‘ืฅ zip. ื›ื“ื™ ืœืขืฉื•ืช ื–ืืช, ื”ืฉืชืžืฉื• ื‘ืชื›ื•ื ื•ืช ื”ืžื•ื‘ื ื•ืช ื‘-Ghost.

ืคืชื—ื• ืฉื•ื‘ ืืช ื”ื˜ืจืžื™ื ืœ ืฉืœ ื”ืขื•ืจืš ืฉืœื›ื ื•ื”ืจื™ืฆื• npm run zip.

ื™ื™ืฆื ืืช ื”ืชื‘ื ื™ืช ืฉืœืš
ื™ื™ืฆื ืืช ื”ืชื‘ื ื™ืช ืฉืœืš

ื–ื” ื™ืืจื•ื– ืืช ื”ืชื‘ื ื™ืช ืœืงื•ื‘ืฅ zip ื‘-dist/casper-fastcomments.zip (ืื ื–ื” ื”ืฉื ืฉื ืชืชื ืœืชื‘ื ื™ืช ื‘-Step Three).

ืฉืœื‘ 7: ื”ืขืœื” ืืช ื”ืชื‘ื ื™ืช ืืœ Ghost Internal Link

ื‘ื—ื–ืจื” ื‘ืœื•ื— ื”ื‘ืงืจื” ืฉืœ Ghost, ื ืขืœื” ืืช ืขืจื›ืช ื”ืขื™ืฆื•ื‘ ืฉืœื ื•:

ื”ืขืœื” ืืช ืขืจื›ืช ื”ืขื™ืฆื•ื‘ ืฉืœืš
ื”ืขืœื” ืืช ืขืจื›ืช ื”ืขื™ืฆื•ื‘ ืฉืœืš

ืืฆืœื™ ื”ืงื•ื‘ืฅ zip ื ืžืฆื ื‘ืžื™ืงื•ื ื”ื‘ื. ืฉื™ื ืœื‘ ืœืชื™ืงื™ื™ืช dist:

ื‘ื—ืจ ืงื•ื‘ืฅ Zip ืœื”ืขืœืื”
ื‘ื—ืจ ืงื•ื‘ืฅ Zip ืœื”ืขืœืื”

ื–ื›ื•ืจ ืœื”ืคืขื™ืœ ืืช ืขืจื›ืช ื”ืขื™ืฆื•ื‘ ืฉื”ืขืœื™ืช ื–ื” ืขืชื” (Ghost ืืžื•ืจ ืœืฉืื•ืœ ืื•ืชืš).

ื”ืฆืœื—ื”! Internal Link


ื›ืขืช ืืžื•ืจ ืœื”ื™ื•ืช FastComments Live Commenting ืคืขื™ืœ ืขื‘ื•ืจ ื”ื—ื‘ืจื™ื ืฉืœื ื•!

ื”ืฆืœื—ื”!
ื”ืฆืœื—ื”!

ืžื–ืœ ื˜ื•ื‘ ืขืœ ื”ื’ื“ืจืช FastComments ืขื Ghost! ืื ื ืชืงืœืช ื‘ึพDomain Error, ืื• ื‘ืจืฆื•ื ืš ืœืœืžื•ื“ ื›ื™ืฆื“ ืœื”ืชืื™ื ืื™ืฉื™ืช ืืช ืื–ื•ืจ ื”ืชื’ื•ื‘ื•ืช, ื”ืžืฉืš ืœืงืจื•ื!


ื”ืชืืžื” ืื™ืฉื™ืช Internal Link

FastComments ื ื•ืขื“ ืœื”ื™ื•ืช ืžื•ืชืื ืื™ืฉื™ืช ื›ื“ื™ ืœื”ืชืื™ื ืœืืชืจ ืฉืœืš.

ืื ื‘ืจืฆื•ื ืš ืœื”ื•ืกื™ืฃ ืขื™ืฆื•ื‘ ืžื•ืชืื ืื™ืฉื™ืช, ืื• ืœื›ื•ื•ื ืŸ ืืช ื”ืชืฆื•ืจื”, ืขื™ื™ืŸ ื‘ืชื™ืขื•ื“ ื”ื”ืชืืžื•ืช ื•ื”ื”ื’ื“ืจื•ืช ืฉืœื ื• ื›ื“ื™ ืœืœืžื•ื“ ื›ื™ืฆื“.