Since I started this blog, I wanted to have a comments function running on it. It took a while since I got my first response, but it was worth it :).
This blog is running a default Ghost blog Casper theme that was modified to allow the implementation of Commento platform. Developed and maintained by Adhityaa Chandrasekar, you can find the latest build and project informations on GitLab.
So what was I looking for? Comment platform? Well theres Disqus. No, thank you. Personally I hate tracking and Commanto is one of those solutions that allow you to selfhost a private and light solution. Also I wanted something thats Docker ready. Check.
You can have this up and running in matter of minutes. Documentation is well maintained and easy to follow. So all in all, if you are looking for a modern, private, personal and light commenting solution, look no further, Commento is it.
Commento + Ghost
How to implement Commento with your Ghost (or any other major web platform)? Here are the steps you will need to follow:
- Setup PostgreSQL as a Commento backend database solution
- Configure and install Commento (I will focus on Docker solution here)
- Register your public website that you want to use Commento on
- Embed Commento in Ghost post.hbs file theme using the universal tag
Setting up PostgresSQL db will not be covered by this tutorial, but I will say that all you need is a functional Postgres backend and just create a db with a name of your choice. Give it an account that you will later use with your Commento docker image and read/write permissions.
Commento docker container
When you have prepared the DB side of this story, now its time to get the Commento container up and running.
Keep in mind that this tutorial will focus on use and implementation of Commento platform on a custom domain name with Ghost platform as a base publishing platform
All the detail steps on this process can be found here as well: https://docs.commento.io/installation/self-hosting/on-your-server/docker.html
So, first things first, download the image from gitlab:
$ docker pull registry.gitlab.com/commento/commento
Next create the container:
$ docker create -it \ -p 80:8080 \ -e COMMENTO_ORIGIN=http://commento.example.com \ -e COMMENTO_POSTGRES=postgres://username:password@ipaddr:port/commento \ registry.gitlab.com/commento/commento
Now there are only 2 required variables that need to be used, `COMMENTO_ORIGIN` AND `COMMENTO_POSTGRES`.
In COMMENTO_POSTGRES variable be sure to use the port number that your PostgresSQL is running on. If you have it in Docker as well on a custom port be sure to use the correct one (if its not the default 5432).
Now that you have your container up and running, visit the page URL that you have specified in the COMMENTO_ORIGIN variable. You should land on the main page for your Commento platform.
If you are looking into protecting this site (and you should) via an SSL using a valid certificate, be sure to check out the Let's Encrypt tutorial as well. It will guide you how to create one for your custom domain name.
Also if you want to protect this comment site via a reverse proxy there is a tutorial for that as well. It will allow you to push your unprotected http site to a protected https site (prerequisite will be to have a valid SSL certificate)
Register your public website that you wanna use Commento on by adding a new domain:
The only thing now thats left to do is to embed Commento into Ghost theme. To this log into your ghost platform and go to the admin area.
Now under Settings > Design scroll to the bottom and look at the installed themes. Click the download button to download the complete theme.
Now unpack it and edit the post.hbs file (using any text editor) that is used for the articles themselfs. Locate the end of <article> tab, the one that looks like this </article> and paste in the universal HTML tag from Commento (just be sure to change the URL of your commento site).
So the end result should look like this:
</article> <div id="commento"></div> <script defer src="https://commento.example.com/js/commento.js"> </script> </div> </main>
Save the change and upload the template back to ghost using the Upload button in the Settings > Design. Just be sure to change the name of the template so you don't overwrite the default one.
One final step is to make that theme active (now that you have more then one theme) in your ghost instance by clicking the active link next to the theme name.
That's it! Now all you have to do is test it out. Open up any of your new or existing articles and scroll to the bottom. You should see the Commento section come alive.
I have been using the platform for some time now and its been great. Fast, light and working as intended. There is also a lot of features that are there like OAuth, SMTP, custom CSS etc. Considering its open source you can mod it to your linking.
Hope this will come in handy and if you have any questions, you are welcome to comment. Anonimously, no registration required, but you are welcome to register as well.