cusdis icon indicating copy to clipboard operation
cusdis copied to clipboard

Comments are not tied to the post but they appear on every post.

Open zozo6015 opened this issue 2 years ago • 7 comments

Hello,

I have just installed this in ghost and I see the comments are showing up on every post and not limited to a certain post. Is this coded like this or it's a bug?

zozo6015 avatar Apr 02 '22 18:04 zozo6015

show the code, you might set the data-page-id incorrectly

Young-Lord avatar Aug 02 '22 02:08 Young-Lord

I used the exact core that the tool showed me under embed button;

<div id="cusdis_thread"
  data-host="https://comments.zozoo.io"
  data-app-id="6cba3112-de50-4701-a4de-44f3d2254db6"
  data-page-id="{{ PAGE_ID }}"
  data-page-url="{{ PAGE_URL }}"
  data-page-title="{{ PAGE_TITLE }}"
></div>
<script async defer src="https://comments.zozoo.io/js/cusdis.es.js"></script>

rccbuild avatar Aug 02 '22 07:08 rccbuild

I used the exact core that the tool showed me under embed button;

<div id="cusdis_thread"
  data-host="https://comments.zozoo.io"
  data-app-id="6cba3112-de50-4701-a4de-44f3d2254db6"
  data-page-id="{{ PAGE_ID }}"
  data-page-url="{{ PAGE_URL }}"
  data-page-title="{{ PAGE_TITLE }}"
></div>
<script async defer src="https://comments.zozoo.io/js/cusdis.es.js"></script>

This is my config

zozo6015 avatar Aug 02 '22 07:08 zozo6015

I have checked the database to see if there is any information about the pages and I have found the following:

cusdis=# select * from pages;
                  id                  | slug | url | title |       created_at        |       updated_at        |              projectId               
--------------------------------------+------+-----+-------+-------------------------+-------------------------+--------------------------------------
 972f97dc-b55d-4dd6-b3ca-93b4b9df245d |      |     |       | 2022-04-02 17:54:51.316 | 2022-04-02 17:54:51.316 | 6cba3112-de50-4701-a4de-44f3d2254db6
 2b91e92d-5a99-4874-869f-9d38ff3aa5d0 |      |     |       | 2022-08-02 07:55:14.11  | 2022-08-02 07:55:14.11  | 6526ac37-ab2d-4ad9-ac68-ed69753b7edf

As it can be seen no url no title nothing that would identify a specific page.

zozo6015 avatar Aug 02 '22 08:08 zozo6015

Cusdis will NOT automatically generate the arguments. You should read the docs, find the Intergration part, find the sample code that matchs your framework. If there is not sample, you should adapt it by yourself as what I did

the user guide is a bit misleading, I think

UPDATE for Jekyll: offical docs available here

Young-Lord avatar Aug 02 '22 10:08 Young-Lord

In this parameter, these three are user-defined content, relative to your website generation program. I use Jekyll as an example, Jekyll does not have capitalized {{ PAGE_ID }} and {{ PAGE_URL }} and {{ PAGE_TITLE }}, corresponding to the template language usage are: Jekyll page-variables

data-page-id="{{ page.id }}"
data-page-url="{{ page.url }}"
data-page-title="{{ page.title }}"

the official documentation does not use Jekyll as an example, it uses Hugo, so the corresponding template language usage is different. So the correct way to handle this is to put this snippet into _lauouts/post.html and modify these three fields

y377 avatar Feb 18 '23 08:02 y377

In this parameter, these three are user-defined content, relative to your website generation program. I use Jekyll as an example, Jekyll does not have capitalized {{ PAGE_ID }} and {{ PAGE_URL }} and {{ PAGE_TITLE }}, corresponding to the template language usage are: Jekyll page-variables

data-page-id="{{ page.id }}"
data-page-url="{{ page.url }}"
data-page-title="{{ page.title }}"

the official documentation does not use Jekyll as an example, it uses Hugo, so the corresponding template language usage is different. So the correct way to handle this is to put this snippet into _lauouts/post.html and modify these three fields

I came here to post this, but glad that someone else said it. I had to figure it out on my own. Changing these 3 attributes fixes the issue raised here. After I was able to fix this, I was having to figure out how to show the comment form only on posts and not on pages.

If anyone else is facing this, this is how you can fix it:-

Go to wherever you've put the cusdis embed code and wrap it inside this if block:-

{% if page.disable_comments!= true %} cusdis_embed_code goes here {% endif %}

And on the pages that you don't want the comments to appear, add the attribute for disable_comments as true on the metadata at the top. Example:-


layout: single title: About author_profile: true permalink: about disable_comments: true

This will disable comments on pages and you can also use this on specific posts where you don't want to have comments appear.

Hope this helps someone!

ryarasi avatar Apr 23 '23 06:04 ryarasi