8000 Disqus doesn't load · Issue #33 · Zenithar/hugo-theme-bleak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 11, 2020. It is now read-only.

Disqus doesn't load #33

Open
curtiscde opened this issue Apr 27, 2017 · 1 comment
Open
8000

Disqus doesn't load #33

curtiscde opened this issue Apr 27, 2017 · 1 comment

Comments

@curtiscde
Copy link
Contributor

When entering my disqus ID into the config and reloading the application disqus comments do not appear on any of the posts.

@nayibor
Copy link
nayibor commented Jun 4, 2017

the code required for disqus to load after an ajax request is different from the code required for a normal page load it seems .
It seems disqus has to do some reset of some sort.
You can see the warnings by looking at your browser console.
I had to modify a few things on my end before it worked.
This is what i ended up with but my code also contains some extra stuff also for identifying the specific page through the hugo slug also .

<input type="hidden" id="disq_variables" name="disq_variables" data-ident="{{ .Params.slug }}" data-url="{{ .Permalink }}"/>
<aside class="post-comments">
    {{ if ne .Params.comments false}}
    {{ with .Site.Params.disqusShortname }}
<div id="disqus_thread"></div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    
    var disq_var = document.getElementById('disq_variables');
    var disqus_shortname = 'https-nayibor-github-io';
    var disqus_identifier = disq_var.getAttribute('data-ident');
    var disqus_url = disq_var.getAttribute('data-url');
	var disqus_config = function () { 
	  this.language = "en";
	};
    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
    /* * * Disqus Reset Function * * */
    var reset = function (newIdentifier, newUrl, newTitle, newLanguage) {
        DISQUS.reset({
            reload: true,
            config: function () {
                this.page.identifier = newIdentifier;
                this.page.url = newUrl;
                this.page.title = newTitle;
                this.language = newLanguage;
            }
        });
    };

</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    {{ end }}
    {{ end }}
</aside>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0