Skip to content
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 · 13 comments
Closed

Disqus discussion not generated because of wrong disqus_url #52

simecek opened this issue Jan 31, 2017 · 13 comments
Milestone

Comments

@simecek
Copy link

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
Copy link
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
Copy link
Author

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 as completed Feb 1, 2017
@yihui
Copy link
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
Copy link

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
Copy link
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
Copy link

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
Copy link
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
Copy link

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
Copy link
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
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
Copy link

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
Copy link

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

@dsaada
Copy link

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

dvanic added a commit to dvanic/blogdown that referenced this issue Mar 21, 2020
And rebuilt all the pages. THIS FINALLY WOKKED. Detials of how I needed to fix this thing were in Yui Xi'es github issues here rstudio/blogdown#52 (comment)
@IanniMuliterno
Copy link

IanniMuliterno commented Jun 13, 2021

Hello, so I am using a recent version of blogdown, the archive is now config.yaml instead of config.toml. My config looks like this

baseURL: "https://iannimuliterno.github.io/blog2021/"
languageCode: en
DefaultContentLanguage: en
title: config yaml draft do meu blog
theme: anatole
summarylength: 10
enableEmoji: yes
enableRobotsTXT: yes
publishDir: "docs/"
pygmentsUseClasses: yes
pygmentsCodeFences: yes
pygmentsCodefencesGuessSyntax: yes
disqusShortname: annymuliterno

markup:
  goldmark:
    renderer:
      unsafe: true

Only adding disqusShortname: annymuliterno wasn't enough, so I've also tried

  • 1 creating disqus.html at themes\anatole\layouts\partials\
  • 2 running build_site()

and it did not work, so I noticed that inside themes\anatole\layouts\partials\ exists a directory called comments and tried moving disqus.html to themes\anatole\layouts\partials\comments, then ran build_site() again and still I bump into the trobleshooting issue, I'd love to add comments to my blog so any help will be greatly appreciated.

for the record, my disqus.html looks like this :

<div id="disqus_thread"></div>
<script>
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://annymuliterno.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>

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

No branches or pull requests

7 participants