Skip to content
This repository was archived by the owner on Sep 3, 2026. It is now read-only.

#23 Disqus add comment count - #24

Merged
nicolas-bastien merged 1 commit into
masterfrom
23-disqus-add-count-feature
Dec 7, 2016
Merged

nicolas-bastien merged 1 commit into
masterfrom
23-disqus-add-count-feature

Conversation

@nicolas-bastien

@nicolas-bastien nicolas-bastien commented Nov 28, 2016 •

Copy link
Copy Markdown
Contributor

Fix #23

Description

This PR adds an new configuration 'count' for disqus provider, which allow to load js comment counter code.

Test

Manually on Ez demo post view page

Link to https://jira.ez.no/browse/DEMO-35

@bdunogier bdunogier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple grammar issues, but that aside, +1.

Comment thread Resources/doc/02-configuration.md Outdated

#### Add comment count

This bundle handle the js loading to count disqus comments, all you have to do is to add an element with "disqus-comment-count" class

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grammar: "handles"

Comment thread Resources/doc/02-configuration.md Outdated
#### Add comment count

This bundle handle the js loading to count disqus comments, all you have to do is to add an element with "disqus-comment-count" class
as it is detailled in [disqus documentation](https://help.disqus.com/customer/portal/articles/565624-adding-comment-count-links-to-your-home-page).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"in the disqus doc"

dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
(function() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this makes extra request even if user do not want to use counter feature.
Maybe would be better to move it to configuration?

@clash82 clash82 Nov 29, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could also improve this part:

var disqus_create = function(path) {
    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = path;
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}

disqus_create('//' + disqus_shortname + '.disqus.com/embed.js');
disqus_create('//' + disqus_shortname + '.disqus.com/count.js');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my point of view, I prefer having the same code as the one recommended by the provider it make maintenance easier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clash82 about the configuration, this is what I discuss with @bdunogier as counting is nearly a must have function in a list and especially in comment where this means popularity we ends on shipping that together

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If @bdunogier wants it like that then I'm fine :) it's just that there are different use cases, sometimes you want to have a counter and sometimes not. Would be great to have a complex solution but not required.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't disagree with you, as a matter of fact, @clash82. We could easily add an option to the twig functions to enable/disable comments count.

I guess that the default value for this option should be disabled, since it wasn't there before.

Could you give it a try and let us know, @nicolas-bastien ?

@nicolas-bastien

Copy link
Copy Markdown
Contributor Author

@bdunogier up to you

@bdunogier

Copy link
Copy Markdown
Contributor

After discussion, let's put this topic on hold for the time being.

@andrerom

Copy link
Copy Markdown
Contributor

@nicolas-bastien you can rebase when it fits you so we can get travis to run stuff again.

@nicolas-bastien

Copy link
Copy Markdown
Contributor Author

@bdunogier @clash82 so here is the configuration for count

@clash82 clash82 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Comment thread Resources/doc/02-configuration.md Outdated

#### Add comment count

This bundle handles the js loading to count disqus comments, all you have to do is :

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not bad, just a suggestion that we could add some context to describe what will happen if you enable this feature. Something like:

This bundle supports additional Disqus comments counter which is loaded in separate JavaScript file. This counter is disabled by default and if you want to enable it, you have to follow these steps:

@nicolas-bastien
nicolas-bastien force-pushed the 23-disqus-add-count-feature branch from 0b68bdc to db6c894 Compare December 7, 2016 13:04
@bdunogier

Copy link
Copy Markdown
Contributor

Could you please update the pull-request's description ?

@bdunogier

Copy link
Copy Markdown
Contributor

Looks good to me besides that.

@nicolas-bastien
nicolas-bastien merged commit e4307f2 into master Dec 7, 2016
@nicolas-bastien
nicolas-bastien deleted the 23-disqus-add-count-feature branch December 7, 2016 13:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

4 participants