Disqus unable to load

I have my site up and running, using blogdown, and the (cocoa theme https://github.com/nishanths/cocoa-hugo-theme), and am hosting on (github pages https://github.com/felixthoemmes/felixthoemmes.github.io).

Everything is working except Disqus. I read through some comments related to this, but I think I ruled out errors that have been posted.

I am getting the message “We were unable to load Disqus.”.

  1. My config.toml has a base URL that includes the http portion of the web address.
  2. My config.toml includes my Disqus shortname.
  3. I have checked that both the base URL and the shortname are correct.
  4. My Disqus admin setttings appear to point to the right URL (https://felixthoemmes.github.io/)

I have looked into the generated HTML, this is the code (I have replaced the shortname with XXXXX).

var disqus_shortname = 'XXXXX';
var disqus_identifier = '\/blog\/a-second-test\/';
var disqus_title = 'A second test';
var disqus_url = '\/blog\/a-second-test\/';

(function() {
    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

One thing I noticed was that the identifier and url variables have weird slashes, but I don’t know whether this is correct or not.

Any help on how to make Disqus work on the website would be appreciated.

UPDATE: fixed the issue by using some customized template that does not rely on Hugo Disqus template. See my comment below.

Hello @felixthoemmes,

I’ve had a look at the config file for your website. Your disqusShortname has to be something like spf13 or digitalcraftsman instead of a URL. The disqus shortname is the handle or nickname that is usually displayed next to your comments.

1 Like

Update: I fixed the issue, even though I am not 100% sure what the problem was. I ended up not using the Hugo template, but wrote my own partial which included a simpler version of the Disqus code injection. I have a hunch that the

var disqus_url =

is the culprit, because the template uses relative URLS, whereas I read on the Disqus forum that absolute URLs are needed.

Hello @felixthoemmes, exactly the same issue here while proof-testing Hugo with the bookshelf project of the “quick installation guide”. I checked again and all variables are correct on my side (both in Disqus and in my Hugo project).
I’m using Hugo Static Site Generator v0.20.7 darwin/amd64

Any chance to see the main code fixed? Any hint you can give me about modifying my theme ?


Hi @xaviermarchial, have a look at my github repos (link below). I think the template used relative URLs for the little disqus script, but absolute ones were needed. What I ended up doing was to change the templates of the theme to correct for that. Have a look at this:

Hopefully, this will fix it for you as well.

Thanks. Turned out that the latest updates of Hugo and some themes fixed the issue in parallel.

Which versions have this fixed?

I am using Hugo 0.24.1 at the moment and had problems with this. The documentation was not very clear to me about disqus. So I spend some hours debugging. Eventually I figured out that the problem is disqus_url being relative and not absolute.

Why does Hugo generate relative disqus URLs and not throw an error, if Disqus requires absolute URLs according to the Disqus documentation? An error message makes the user aware of the problem. I had to look in the output html an disqus documentation to understand the issue.

In my case the problem was also related to baseURL in config.toml. I fixed it by not specifying it config.toml, but adding a flag in my Gulpfile. I only learned more about baseURL configuration here and the behavior could also be explained better in the documentation.

It works for me now so this is just my feedback to make the experience better for the next person.

In my case it was fixed by updating to

Hugo Static Site Generator v0.21 darwin/amd64 BuildDate:

and the current master branch of theme hugo_theme_robust

A post was split to a new topic: Disqus problem