Show Cove comments only on certain posts

Filed in Setup & installation

It's possible, using Ghost's tag system, to show Cove comments only on certain posts (or pages).

We will use Ghost's internal tags for this example. An internal tag starts with a # symbol. These tags are hidden from your blog's theme and are only used in the background to organise posts.

Step 1: Create the tag

Add a tag like #cove to the posts (or pages) that you want to show Cove comments on.

Step 2: Tweak the Cove install code

We now want to only load Cove on posts and pages with the #cove tag.

To do this, we have to make a small change to the Cove install code: just wrap a {{#has}} block around the standard Cove code.

{{#has tag="#cove"}}
{{#if @labs.members}}
  <h2><span id="cove-count"></span> Comments</h2>
  <div id="cove"></div>

  ...
  
{{/if}}
{{/has}}

And that's all 👍

The {{#has}} helper is very powerful. Make sure you to read through the full documentation to explore some other useful ways to use it in your theme.

You've successfully subscribed to Cove!