Count tag

The <comentario-count> tag inserts a widget displaying the number of comments on a page

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

Like the “main” comments tag, it also requires a script tag being added to the same page, and it’s also a web component.

This tag marks the location for the displayed comment count. After Comentario engine is initialised, the comment count will appear inside the corresponding HTML element.

Customising the element

You can further customise this element by adding attributes to the <comentario-count> tag. Available attributes are summarised in the table below.

AttributeDescriptionDefault value
error-textText to display if fetching the count fails for any reason"?"
pathPath (URL) of the page to display comment count forCurrent page’s path
placeholderText to display before the count becomes available""
prefixText that prefixes a successfully fetched, non-zero count""
suffixText that suffixes a successfully fetched, non-zero count""
zero-textText to display if count is zeroprefix + "0" + suffix

Here’s an example of a customised <comentario-count> tag:

<comentario-count path="/blog/post/123" 
                  placeholder="..."
                  error-text="ERR"
                  zero-text=""
                  prefix="("
                  suffix=")"></comentario-count>

Attribute: error-text

The error-text attribute of the count tag can be used to override the text displayed in the element whenever it encounters a problem with retrieving the data from the server.

Attribute: path

The path attribute of the count tag can be used to specify a different page to display the number of comments for.

Attribute: placeholder

The placeholder attribute of the count tag can be used to specify the text initially displayed in the element.

Attribute: prefix

The prefix attribute of the count tag can be used to prepend the displayed number with a custom string.

Attribute: suffix

The suffix attribute of the count tag can be used to append a custom string to the displayed number.

Attribute: zero-text

The zero-text attribute of the count tag can be used to override the text displayed in the element when its value is 0.

See also