Cactus Comments

Cactus Comments

Cactus Comments is a software solution that allows you to add a comment box to the pages of your site.

We have decided to use Cactus Comments for comments on this site.

Why did we choose Cactus Comments?

Our decision is based on the following two considerations.

First, we used Hugo (as we had the opportunity to explain) to build this website, and therefore it was necessary to find a resource that was compatible with the platform used. Many indications are given on the Hugo reference site, both about the proposed solutions and the alternatives, and Cactus Comment turns out to be one of them. Essentially, it is a resource considered entirely usable in the Hugo ecosystem.

Secondly, our research was geared towards solutions that would guarantee user privacy while being stable and easy to install. This second aspect conditioned our decision.

In fact, on the home page of the Cactus Comments site, we read, “Cactus Comments is a federated comment system for the web, based on the Matrix protocol.”.

This disclaimer incredibly caught our attention since we’re familiar with Matrix (we’re also supporters) and have our server (https://matrix.nicfab.it); we’ll talk about Matrix in a new post soon.

Also, on the Cactus Comments website, the Introduction section reads, “Cactus Comments is a federated comment system built on Matrix. It respects your privacy, and puts you in control. The entire thing is completely free and open source..”

The above considerations convinced us to implement Cactus Comments on this site, and below, we will explain which steps we followed.

How to integrate Cactus Comments with Hugo.

The guide published in the Docs section of the Cactus Comments site is not exhaustive but sufficient.

You can choose to install Cactus Comments on your Matrix server (Why Self-Host? and How to Self-Host) or you can use the Cactus Comments server. In our case, we have decided to use - at the moment - the Cactus Comments server. In our opinion, it depends on the number of comments potentially added to each post on your website that you expect.

Therefore, consulting the Cactus Comments site, we can see that Hugo is present in the Integrations entry.

First step

The first step is to read what is published in Quick Start and, in particular, the section Prerequisites: you must have a Matrix account or create one. Having already a Matrix account on our server, we have passed this first step.

Second step

The second step is to register your site with Cactus Comments, and this is possible by starting a chat with the relative bot. Using Element, we created a new chat and, when it opened the window where to insert the recipient, we typed @cactusbot:cactus.chat.

Once the chat is created, we need to type the command:

register <YOUR-SITE-NAME>

Where the string <YOUR-SITE-NAME> must be replaced with the name of your site. Assuming you want to name your site nicfab, the command will be:

register nicfab

At this point, the bot that manages the chat responds with

Created site <YOUR-SITE-NAME> for you 🚀

Third step

The third step is to create an HTML file with the following content:

<script type="text/javascript" src="https://latest.cactus.chat/cactus.js"></script>
<link rel="stylesheet" href="https://latest.cactus.chat/style.css" type="text/css">
<div id="comment-section"></div>
<script>
initComments({
  node: document.getElementById("comment-section"),
  defaultHomeserverUrl: "https://matrix.cactus.chat:8448",
  serverName: "cactus.chat",
  siteName: "<YOUR-SITE-NAME>",
  commentSectionId: "{{ index .Params 0 }}"
})
</script>

You have to replace the string <YOUR-SITE-NAME> with the site’s name previously registered in the Cactus Comments chat with the bot.
You must save the created file as chat.html in the folder layouts/shortcodes/, and if the folder “shortcodes” does not exist, you have to create it.

Fourth step

The fourth step is to add the string

{{ < chat cactus-comments > }}

Writing instead of “cactus-comments” the name we want to give to Matrix room where we will find comments.

You have to report the string at the end of each post that you intend to publish and if you decide to activate the comments.

N.B.: we specify that between symbols {{ and < there must be no space and, in the same way, between symbols > and }} there must be no space.

Fifth step

The fifth step is to create inside Matrix a room (this is the name of virtual places where you interact with more than one interlocutor, differently from chats that are 1:1) that allows you to see posts and eventually manage moderation. This last step is simple because you have to click on + and choose “Join public room” with the following precise address:

#comments_yoursitename_commentssectioID:cactus.chat

You have to replace the string yoursitename with the name of the site you decided to register (second step), and the string commentssectioID with the name of that one you choose in the fourth step.

At this point, you can access the room in which we can see any comment and manage the moderation, if necessary.

How to write comments on the site

We said at the beginning that we had been directed to Cactus Comments basically for the aspects that concern privacy and control by each user.

Those who want to comment on a post can do it in two ways, namely in anonymous mode or through a Matrix account.

Anonymous mode

With the anonymous mode proceed as follows:

  1. in the box where it appears the writing “Add a comment” you can write the comment you want;
  2. in the box “Name” you can write the name of the author of the comment (it can also be a fantasy);
  3. once the entries are finished, click on “Post”", and the comment will automatically be added at the end of the post.

Through a Matrix account

It’s possible to write a comment through a Matrix account (if you don’t have one, you can create one on Matrix, on our or any other Matrix server) in two different ways:

Proceed by logging in, as follows:

  1. first, you have to log in on your matrix server, clicking on the “Log in” button and entering your credentials to access the server (username, password, and server address); if the login procedure completes correctly, you will see the Post as “matrixuser “ as per the following image;

comment

  1. in the box where it appears the writing “Add a comment” you can write the comment that you want;
  2. at the end, click on Post as “matrixuser “.

Post as “Matrix client “ (e.g. Element):

  1. clicking on the item “Use a Matrix client” it will be proposed the opening of the client (in our case Element) to access the room where it’s possible to write the comments;
  2. once completed, Matrix will publish the comment on the web page.

Privacy profiles

At the beginning of this post, we pointed out that Cactus Comments is a solution that guarantees privacy for users who want to add comments.

It is true.

Privacy is guaranteed whether you choose the anonymous mode or use a Matrix account.

The choice of anonymity should not be confused with the possibility for the user who intends to add a comment to do what he wants. Whoever manages the site can always act with moderation to avoid unpleasant words.

However, the anonymous mode - if properly used - allows the user who intends to add one or more comments to express themselves as they see fit.

Also, adding comments through a Matrix account guarantees privacy because no personal information of the user who comments is exposed, but simply his Matrix address. Even in this case, if there are unpleasant comments, those who manage the site can intervene with moderation. Moreover, the contents subject of messages from users of the Matrix ecosystem are encrypted.

We remind you that Matrix is a distributed, decentralized, and federated communication system.

In conclusion, in our opinion, Cactus Comments’ solution associated with the Matrix ecosystem results in privacy by design and by default, within the meaning of Article 25 of the GDPR.

In addition, Cactus Comments complies with the provisions of Whereas (7) of the same GDPR, according to which

Natural persons should have control of their own personal data. Legal and practical certainty for natural persons, economic operators and public authorities should be enhanced.

We agree with what we read on the Cactus Comments website, and precisely that this solution gives the user complete control over their personal data.

Stay tuned!