A simple commenting system for the small web.

Working with Data Attributes

When embedding Pure Comments, you can keep setup minimal and let embed.js infer values automatically, or you can override behaviour with data attributes.

Quick Start (No Overrides)

If you do this:

<div id="comments"></div>
<script src="https://comments.example.com/public/embed.js" defer></script>

Then embed.js will:

For many sites, that default behaviour is all you need.

data-post-slug (Optional)

You can use data-post-slug on the #comments container when you want to explicitly control the post/thread identifier.

<div id="comments" data-post-slug="my-first-post"></div>
<script src="https://comments.example.com/public/embed.js" defer></script>

When to use it

Why it matters

Different slugs create different threads. If your blog's URL structure changes later, explicit slugs help prevent comment history from splitting across multiple threads.

data-base-url (Optional)

You can also use data-base-url on the script tag when API calls should go to a different origin than the script file.

<script src="https://comments.cdn.example.com/public/embed.js" data-base-url="https://comments.example.com" defer></script>

When to use it

Using Both Together

You can combine both overrides:

<div id="comments" data-post-slug="my-first-post"></div>
<script src="https://comments.cdn.example.com/public/embed.js" data-base-url="https://comments.example.com" defer></script>

This gives you:

Practical Recommendation

Start with defaults first then add these attributes only when you need predictability across URL changes, multi-domain deployments, or custom routing.

docs

⬅ Previous post
Getting Started

Next post ➡
Theming Pure Comments