This documentation site is about the unstable (upcoming) Comentario version.  Switch to the stable version »

Embedding comments

How to add comments to a web page by embedding Comentario

The whole point of installing Comentario is, of course, using it as a web comment engine.

Or, in other words, its ability to add comment threads to web pages.

Adding comments to a web page

In order to add (embed) comments to your website, you’ll need to do the following:

  1. Register a new domain in the Administration UI.
  2. Add an HTML snippet to every web page that’s supposed to have comment functionality.

The HTML snippet is displayed in domain properties and looks like this:

<script defer src="https://example.com/comentario.js"></script>
<comentario-comments></comentario-comments>

As you can see, it consists of two tags: a <script> and a <comentario-comments>, more on which below.

Adding a comment counter to a web page

You can also add a widget that displays the number of comments on a specific page.

Just like the comments tag mentioned above, it also requires:

  • A domain registered in Comentario, and
  • Two tags: <script> and <comentario-count>.

The <script> tag is the same as the one above, it must be only added once to the page. Then it will be shared amongst any number of <comentario-comments> and <comentario-count> elements.

Script tag

The <script> tag is the first of the two elements required to embed comments or to display a comment count onto a page. It provides the entire commenting functionality, including server communication, comment layout, content, and styling.

Comments tag

The <comentario-comments> tag is the second required element on a comment page (with the script tag being the first). It represents a web component that provides the comment functionality.

Count tag

The <comentario-count> tag represents an optional widget that displays the number of comments on the current or any other specified page.

See also