
FastComments provides lightweight, standalone comment count widgets that can display the number of comments for specific pages or posts. These widgets are separate from the main commenting widget and are designed for use in places anywhere you want to show comment counts without the full commenting interface.
There are two types of comment count widgets available:
- Comment Count Widget - For displaying the comment count of a single page
- Bulk Comment Count Widget - For efficiently displaying comment counts across multiple pages on the same page
This article covers the VanillaJS widgets. Our React/Angular/etc libraries also have their own widgets.
Comment Count Widget Installation 
The Comment Count Widget is designed for displaying the comment count of a single page. It's lightweight and provides real-time updates if configured.
Basic Installation


Configuration Options
The FastCommentsCommentCount
function accepts the following configuration options:
- tenantId (required): Your FastComments tenant ID
- urlId (optional): The page identifier. Defaults to
window.location.href
if not specified - numberOnly (optional): If
true
, only renders the number without any text. Default isfalse
- isLive (optional): If
true
, the count will update automatically. Default isfalse
Advanced Examples
Custom URL ID


Number Only Display


Live Updates


Widget Methods
The widget returns an object with the following methods:
- destroy(): Removes the widget and cleans up any timers
- update(config): Updates the widget with a new configuration
Example Usage


Styling
The widget renders plain HTML with the comment count and comes with minimal styling. You can customize the appearance with CSS:


Bulk Comment Count Widget Installation 
The Bulk Comment Count Widget is designed for efficiently displaying comment counts for multiple pages on the same page. Instead of making individual API calls for each comment count, this widget batches requests for optimal performance.
Basic Installation


How It Works
The bulk widget works by:
- Scanning the page for elements with the class
fast-comments-count
- Reading the
data-fast-comments-url-id
attribute from each element - Batching API requests to fetch multiple comment counts efficiently
- Updating each element with the appropriate comment count
Configuration Options
The FastCommentsCommentCountBulk
function accepts the following configuration options:
- tenantId (required): Your FastComments tenant ID
- apiHost (optional): Custom API host if you're using a self-hosted instance
Real-World Example
Here's a practical example showing how you might use the bulk widget in a blog post listing:


Performance Considerations
The bulk widget automatically optimizes performance by:
- Batching requests: Multiple comment counts are fetched in a single API call
- Request size limits: Requests are automatically split if the URL list becomes too large (over 1,000 characters)
- Deduplication: Multiple elements with the same
data-fast-comments-url-id
share the same count
Multiple Elements with Same URL ID
You can have multiple elements on the page with the same data-fast-comments-url-id
. They will all be updated with the same count:


Localization
The bulk widget automatically formats comment counts based on your FastComments language settings. It provides appropriate text for:
- Zero comments
- One comment
- Multiple comments
When to Use Bulk vs Single Widget
Use the Bulk Widget when:
- You have multiple comment counts on the same page
- You're displaying a list of posts/articles with comment counts
- Performance is important (reduces API calls)
Use the Single Widget when:
- You only need one comment count on the page
- You need live updates (the single widget supports real-time updates)
- You want more control over individual widget behavior
The FastComments comment count widgets provide a simple and efficient way to display comment counts across your site.
We hope you found this documentation helpful.