I have SPA pages that use durandaljs and knockoutjs. Now I'm going to implement disqus plugin support for my site.
When I added disqus, I found that the same comments are displayed for different pages with different URLs (I used durandal to rewrite the URLs).
I assume the root of this problem is that my rewritten url has full hashbang (#!)

The following code:
var disqus_shortname = 'somename';
var disqus_identifier = context.id;
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
if (typeof DISQUS != 'undefined') {
DISQUS.reset({
reload: true,
config: function () {
this.page.title = "title" + context.id;
this.page.identifier = context.id;
this.page.url = "http://localhost:23054/#!ideas/details/" + context.id;
debugger;
}
});
}
View:
<div id="disqus_thread"></div>
I hope someone uses disqus comments with SPA pages and knows how to help me solve this problem.
source
share