Search

I've installed Disqus on my blog. Everything is working but I want to display comment count on my blog main page.

Comments are displaying in blog_post.xsl, and comment count should display on blog.xsl.

E.g.

I've 2 comments in first entry. On main page I'd like to have something like this: 2 Comments.

When a new comment is added I'd like to display how many new comments are added.

Sadly, not a Symphony thing, but a Disqus API thing.

http://help.disqus.com/customer/portal/articles/565624-tightening-your-disqus-integration

http://help.disqus.com/customer/portal/articles/1131783-tutorial-get-comment-counts-with-the-api

I did this a while ago. As far as I can remember there are 3 steps involved.

  1. In your blog.xsl, include some Disqus javascript that will load the disqus comment counter code. See the attachment to this post for mine.
  2. Include a javascript variable definition in the article page (in your case, blog-post.xsl). It gives Disqus the identifier for your post and will allow you to get the comment count for this identifer in the main page. This is mine (simplified the XSLT):

    var disqus_identifier = 'articulo-<xsl:value-of select="@id"/>
  3. Include a special tag in the place where you want the comments to appear. I did it as a hyperlink which, in your case, would lead to the comments in blog-post.xsl

<a href="{$root}/articulo/{titulo/@handle}#disqus_thread" data-disqus-identifier="articulo-{@id}">Comentarios</a>

Disqus links the comments in the article to the comment count in the main page via the data-disqus-identifier tag, which corresponds to the disqus_identifier variable in the blog_post page. Hope this helps.

Attachments:
disqus.xsl

Thanks for your help guys :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details