This module doesn't define a way to display comments count in a twig template.

A twig filter would be suited : {{ content.field_disqus|disqus_count_widget }}

Comments

Anonymous’s picture

machour created an issue. See original summary.

maria.dis’s picture

Hi, did you find a way to do it?. I'm loking for the same solution. Thanks

gaurav.kapoor’s picture

Status: Active » Closed (works as designed)

You can use the attribute 'data-disqus-identifier' with a link in the twig file to display the count of comments. Take a hint from the way views field plugin this module provides the count link.

chike’s picture

Version: 8.x-1.x-dev » 2.0.1-alpha5
Status: Closed (works as designed) » Active

Following the hint at #3. This code

<a href="{{ url }}#disqus_thread" data-disqus-identifier="node/{{ node.id }}">Comments</a>

showed the comments count on a site where I am also showing the comment count in views on the homepage and on the /blog page using the views field plugin.

On a different site where I am not using the views field plugin anywhere, the comment count is not shown. For the code to work I had to follow the instructions here https://help.disqus.com/en/articles/1717274-adding-comment-count-links-t... and add the following code at the bottom of my Twig template file,

<script id="dsq-count-scr" src="//EXAMPLE.disqus.com/count.js" async></script>

damienmckenna’s picture

This should be something the module can do out of the box instead of having to customize a twig file to do it.