Skip to content

How to add comments to a Joomla site

Add EchoThread comments to Joomla 4 or 5 with a Cassiopeia template override. Joomla has no native article comments — this adds threaded, spam-filtered ones without an extension.

10 min setup No dependencies
On this page

Why Joomla + EchoThread

Joomla core has never included article comments. Every Joomla site with a discussion under its articles is running a third-party component — which means another extension to update, another database table to back up, and another place for spam to accumulate.

EchoThread needs no extension. One template override outputs a container div, and everything else — threading, reactions, sign-in, ML spam filtering, and the moderation queue — happens in the hosted service. The widget is under 60 KB gzipped and loads asynchronously from a CDN.

Prerequisites

Step 1 — Create the override

You can do this without touching the filesystem. In the Joomla administrator go to System → Site Templates → Cassiopeia Details and Files, open the Create Overrides tab, and choose com_content → article. Joomla copies the core layout to the override path for you:

override path templates/cassiopeia/html/com_content/article/default.php

This path is the whole point of the exercise. Joomla looks here before it looks at core, and core updates never write to it — so your change survives the next Joomla release. Editing components/com_content/tmpl/article/default.php directly would not.

Step 2 — Add the widget

Open the override file. At the very bottom you will find the line that fires the onContentAfterDisplay plugin event, just before the closing </div>. Add the EchoThread container after it:

templates/cassiopeia/html/com_content/article/default.php <?php // Content is generated by content plugin event "onContentAfterDisplay" ?> <?php echo $this->item->event->afterDisplayContent; ?> <div id="echothread" data-api-key="YOUR_API_KEY" data-identifier="joomla-<?php echo (int) $this->item->id; ?>" data-page-title="<?php echo htmlspecialchars($this->item->title, ENT_QUOTES, 'UTF-8'); ?>"></div> <script src="https://cdn.echothread.io/widget.js" async></script>

Replace YOUR_API_KEY with the public API key from your EchoThread dashboard. It is designed to live in page source — it only lets visitors read and post on your registered site.

Inside this template $this->item is the article, so $this->item->id is its ID and $this->item->title its title. Cast the ID to int and run the title through htmlspecialchars() with ENT_QUOTES as shown — both values end up inside HTML attributes, and a title containing an apostrophe would otherwise break the markup.

There is deliberately no data-page-url here. Joomla's URLs change shape depending on whether SEF routing is on, so letting the widget read the browser's current URL is more reliable than trying to rebuild it in PHP. The thread is keyed to the article ID regardless.

Choosing an identifier

The snippet keys each thread to joomla-<article id>. Joomla article IDs are stable, so the discussion follows the article through an alias change, a category move, or an SEF settings change — each of which rewrites the URL.

Keep the joomla- prefix if this EchoThread site also serves content from another platform, so the two cannot produce the same identifier.

Blog and category layouts

The override above applies to the single-article view only, which is what you want — a category blog page showing ten article intros should not load ten comment widgets.

If you do want a comment count or the widget on another view, create the matching override from the same Create Overrides screen: blog.php for the category blog layout, featured.php for the featured-articles view. Each lands beside default.php in the same folder.

Troubleshooting

The override doesn't take effect

  • Confirm you overrode the template that is actually assigned as the site default — Joomla can have several installed, and the override path is per-template.
  • Clear the Joomla cache under System → Clear Cache, and disable any page-cache plugin while you test.
  • Check the file really is at templates/<your-template>/html/com_content/article/default.php — a missing html folder level is the usual mistake.

A PHP error appears where comments should be

Almost always an unbalanced <?php ?> block from pasting into the middle of a conditional. The snippet belongs after the afterDisplayContent line and before the closing </div>, at the same nesting level.

Sign-in opens and then does nothing

Register your Joomla site's domain on the EchoThread site in the dashboard. Reading comments works without it; handing back a completed sign-in does not.

Frequently asked questions

Does Joomla have built-in article comments?

No. Joomla core has never shipped article comments, which is why every Joomla site with a discussion under its articles is running a third-party extension. EchoThread gives you the same thing without installing one — a single template override and a hosted service.

Do I need to install a Joomla extension?

No. This is one template override file in your site template. Nothing is installed, so there is nothing to keep updated against future Joomla releases beyond the override itself.

Will a Joomla update overwrite my change?

Not if you put the file in the override path shown below. Joomla template overrides live under templates/<template>/html/ specifically so that core updates do not touch them. Editing the file in components/com_content/tmpl/ directly would be overwritten.

Will this slow down my Joomla site?

No. The widget is under 60 KB gzipped, loads from a CDN with the async attribute, and adds no PHP work, no database queries, and no extension overhead to the page render.

Ready to add comments to your Joomla site?

Free for your first site. Set up in under 10 min.

Create free account