Commento - 多说 & Disqus 开源替代品

2,875 阅读1分钟
原文链接: github.com

An open source, lightweight, and tracking-free comment engine.

Example

Installation

I've hosted a live demo here. Check it out!

It's really simple to embed a Commento section to your webpage. A trivial page would look like:

<html>
    <body>
        <script src="https://cdn.rawgit.com/adtac/commento/0.0.4/vendor/commento.min.js"></script>
    </body>

    <script>
    init_commento("http://0.0.0.0:8080");
    </script>

    <div id="commento">
    </div>
</html>

And that's it! Source the script from CDN, add a div called commento (which will contain the comments) and initialize Commento with your server.

To get the server running, run:

$ go get -v github.com/adtac/commento

and build the project using a go build . to get a binary. Internally, I've used sqlite3 as the database. Take a look at the code for more details.

Why?

Disqus is one of the most popular commenting services. However, over the years it has become quite bloated - one blog post has a detailed analysis. In short, a Disqus-free page makes about 16 HTTP requests while the same page makes 105 requests when Disqus is enabled! This is mostly due to various tracking services that record every action you take on any website that has Disqus embedded.

I ran a quick test: go to this codepen and open your developer tools. You'll see that the sum total of all network requests related to Disqus comes to about ~250 kB! And there aren't even any comments!

So I thought I'd quickly write a simple comment engine in Go. I've been learning Go for the past month or so and it has been fantastic.

With Commento, you wouldn't need to worry about shady ad companies getting your data through hundreds of tracking services. You wouldn't need to worry about your page being slowed down - Commento uses just 22 kB total. And it's all open source.

Contributing

Commento is extremely simplistic in comparison to Disqus. It does not have voting, moderation, and some of the more advanced stuff. Patches are more than welcome! But do keep in mind the whole purpose of this project - a lightweight comment engine with zero user tracking.

License

MIT License. See the LICENSE file for more information.