hyteck-blog/content/post/cactus-chat.md

61 lines
2.7 KiB
Markdown
Raw Normal View History

2021-08-26 21:00:30 +00:00
---
title: "Cactus comments via Matrix"
date: 2021-08-25T11:08:55+02:00
draft: false
image: "uploads/cactus.svg"
tags: [FOSS, Matrix, Self-Hosting, Cactus-Chat]
categories: [Projects, English]
---
# Integration
Following the [quickstart documentation](https://cactus.chat/docs/getting-started/quick-start/) I tried to add cactus comments to this blog. I currently rely on infrastructure by cactus.chat as I do not host a private synapse server.
I currently implemented this as a shortcode with hard-coded site title and a variable room name.
# Quickstart with HUGO
## Register your site
There is a registration system, that ensures that you are moderater in your comment section(s). I order to register your site you have to send a message to @cactusbot:cactus.chat . First try `help` to ensure that the bot answers you, then register your site e.g. `register hyteck`. The bot should inform you of success and add you to a moderation room.
## Embedd comment section via Shortcode
HUGO, the static site generator I use, has an option to use *shortcodes* that provide a nice interface to hide some HTML, CSS and JavaScript.
The shortcode `chat.html` must be added to `layouts/shortcodes/` and looks like this
```
<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: "hyteck",
commentSectionId: "{{ index .Params 0 }}"
})
</script>
```
If you want to use this, replace the site name with the one you registered in the previous step.
You can then use it as simple as
```
{{</* chat cactus-comments */>}}
```
where `cactus-comments` is the name of the chatroom. You can decide if you want to create a new one for each post (change the name to somthing like the post title) or if you want to use only one (keep the same name).
# Community
CW: Homophobia, Slur
The community in the official chat seemed helpful and nice. Nevertheless I want to mention, that the first time I tried the demo page a user (that does not seem to be associated with the develoipment or involved in the community) insulted me with a homophobic slur. The "reason" behind this were the prounouns I had in my name. I reported the comment and it was removed by a moderator. The moderator made it clear that this behaviour is agains the [Code of Conduct](https://cactus.chat/docs/community/coc/) and that the user is not active in the community. For me this is a very good indication of a functioning community, cheers!
# Comments
{{< chat cactus-comments>}}