Commenting is enabled for posts, but appears to also be enabled for all pages too.
How can I disable comments on a specific page? I imagine there must be some code snippet I can inject in the header of the page to disable the comments, but cannot find it anywhere.
I ran some quick tests on my local install and this seems like it might be a theme issue. With the default Casper theme there are no comments on any of the pages, only on posts. But with the Digest theme, comments are enabled on every page and post.
Taking a look at the
page.hbs for Casper there’s a section in
post.hbs that’s missing from
page.hbs as shown below. So I’m guessing you’ll have to edit the
hbs files unless you can find some code snippet to inject in the header.
<section class="article-comments gh-canvas">
@NuStoic as mentioned, this is a theme issue, there’s nothing you can inject that will turn comments off on pages if your theme has them enabled there. Which theme are you using?
Are there plans to add per page and per post controls for enabling and disabling comments at the system level ~ instead of at the theme level?
Interesting. There is no page.hbs in the theme folder. I wonder if it is because post.hbs is being used to create both?
I’m also using headline theme and curious about this also. would love to hear about a solution how to change the code in the theme for that
Similar issues with the Edition theme. Just like Headline, the Edition theme folder doesn’t have a page.hbs. Adding the native comments adds the commenting feature to all pages and posts.
Really looking forward to using the native comments. Just a bit strange at the moment with commenting on pages.
@Kevin please see my reply above.
Side-note, how are pages created without a page.hbs
All of our official themes have now been updated to have a
page.hbs file that doesn’t include the comments block.
page.hbs is an optional file in themes, when not present
post.hbs is used instead - posts and pages typically have exactly the same layout so it made sense to reduce duplication and theme maintenance by doing that, with the introduction of comments that’s changed things a little so themes either need a bit more logic in their post template or to split the post/page templates.
The post/page fallback behaviour is documented in the theme structure docs
Simple fix, amazing. Thanks @Kevin!