New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disqus discussion not generated because of wrong disqus_url #52

Closed
simecek opened this Issue Jan 31, 2017 · 12 comments

Comments

Projects
None yet
6 participants
@simecek

simecek commented Jan 31, 2017

I was not sure whether to report this because I am new to Hugo and it is possible that I am just doing it wrong. However, I see other blogs running into the sample problem (see below).

The problem is after adding disqusShortname to config.toml and generating HTML page, Disqus says: We were unable to load Disqus. If you are a moderator please see our troubleshooting guide. (see for example Kevin Wong's blog: http://kevinfw.com/post/blogging-with-r-markdown/)

After viewing the page source and some troubleshooting I have found that the problem is disqus_url that miss the baseurl. For example in Kevin Wong's blog above the line 261 is

var disqus_url = '\/post\/blogging-with-r-markdown\/';

but instead it should be

var disqus_url = 'http:\/\/kevinfw.com\/post\/blogging-with-r-markdown\/post\/blogging-with-r-markdown\/';

For my blog https://simecek.github.io/blog I have solved the problem by editing the footer of the theme and replacing default Hugo disqus template by my own. However, this is likely to be a blogdown bug and should be corrected.

@yihui

This comment has been minimized.

Member

yihui commented Feb 1, 2017

When publishing the website, you need to run blogdown::build_site() so that all configurations in config.toml will be respected (see the R help page ?blogdown::build_site). When you blogdown::serve_site(), a few configurations have to be tweaked so you can preview the site locally.

@simecek

This comment has been minimized.

simecek commented Feb 1, 2017

Thank you, yes, build_site(local=FALSE) solves the problem (tested on a newly created blog https://github.com/simecek/test_blogdown).

I apologize for bothering you. It still might be useful to notify the other users because I doubt I have been the only one running into this.

@simecek simecek closed this Feb 1, 2017

@yihui

This comment has been minimized.

Member

yihui commented Feb 1, 2017

No worries. It is not your fault but lack of a systematic documentation, which is still under development.

@yihui yihui added this to the v0.1 milestone Feb 1, 2017

@larnsce

This comment has been minimized.

larnsce commented Mar 22, 2017

Unfortunately, the blogdown::build_site() solution does not work for me. Disqus is set-up and my disqusShortname "larnsce" entered into the config.toml file. Then build_site is used and the content of the public folder uploaded to my server. The site is hosted at: http://lse.de/r-tistic/

After clicking on either "About", "Resources" or "Slides" in the header of the page, I receive the following message from disqus:

We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

After clicking on "troubleshooting guide" the disqus load button shows up with the message

Disqus seems to be taking longer than usual. Reload?

I am grateful for any additional suggestions.

@yihui

This comment has been minimized.

Member

yihui commented Mar 22, 2017

@larnsce Try to set baseurl = "http://lse.de/r-tistic/" in config.toml.

The other way is to add layouts/partials/disqus.html

<div id="disqus_thread"></div>
<script>
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://larnsce.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
@larnsce

This comment has been minimized.

larnsce commented Mar 22, 2017

Try to set baseurl = "http://lse.de/r-tistic/" in config.toml.

Worked out, thanks! :)

Also set relativeurls = false in this case.

@yihui

This comment has been minimized.

Member

yihui commented Mar 22, 2017

I actually recommend the second way. The one thing I dislike most about Hugo is baseurl. It makes the website not portable.

Unfortunately you cannot set relativeurls = false in your case (your website is in a subdirectory). You will run into issues when you have R plots in your posts. See https://bookdown.org/yihui/blogdown/methods.html

@jarvmiller

This comment has been minimized.

jarvmiller commented May 11, 2017

Hi,
My issue is that I don't even get an "if you are a moderator please see the troubleshooting guide" message on my blog. Nothing loads or attempts to load. I've got the following in my config.toml
baseurl = "https://jarvmiller.github.io/"
disqusShortname = "jarvmiller-github-io"

I've also added the layouts/partials/disqus.html as mentioned above. I'm not sure what the issue could be..

Edit: ack, Sorry I just saw that this was closed right after I posted my comment.

@yihui

This comment has been minimized.

Member

yihui commented May 11, 2017

@jarvmiller Not sure which page you were looking at, but Disqus won't work for local preview (127.0.0.1) by default. I'll document how to make it work. For now, you can only see comments on the published website.

timtrice added a commit to timtrice/web that referenced this issue May 16, 2017

Hack to allow disqus comments
Disqus comments were not being displayed for some reason. Found Issue
52 in the blogdown repo. The following fix appears to resolve the
issue:

rstudio/blogdown#52 (comment)
@taraskaduk

This comment has been minimized.

taraskaduk commented Sep 26, 2017

Try to set baseurl = "http://lse.de/r-tistic/" in config.toml

This finally worked for me, too!
I've spent days troubleshooting!
Thanks!

@taraskaduk

This comment has been minimized.

taraskaduk commented Oct 1, 2017

...and somehow my previous solution stopped working. Back to square one

@dsaada

This comment has been minimized.

dsaada commented Dec 6, 2018

I try to use disqus with radix, I can see post your comment at to bottom of the post, but when I push, nothing come, any idea?
thx
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment