Search code examples
rr-markdowndisqushugoblogdown

Disqus plugin + Social URLs don't load in site generated using R blogdown


I recently set-up a static-site using R blogdown package with Hugo theme 'kakawait/hugo-tranquilpeak-theme'. While everything works perfectly fine, I couldn't get disqus-plugin and social share-URLs to work. Site is hosted in Github Pages.

Tried changing config.toml settings and Disqus short-names, but couldn't make it work.

config.toml file

As you can see at the end of blog-article here, Disqus fails with error message "We were unable to load Disqus. If you are a moderator please see our troubleshooting guide." On the other hand, Social URLs (for the share icons at the end of blog) show-up in html with the baseURL prefix missing.

Disqus-Team has mentioned in one of their help pages that this normally happens when there are incorrectly-formatted JS variables.

In View-Source of my blog-article, this.page.url variable appears only with relative URL

this.page.url = '\/2017\/05\/tamilnadu-2016-election---a-data-story\/';

This is how social URLs are showing up along-side Twitter/Facebook/G-Plus icons in the page.

Twitter: https://twitter.com/intent/tweet?text=%2f2017%2f05%2ftamilnadu-2016-election---a-data-story%2f

Facebook: https://www.facebook.com/sharer/sharer.php?u=%2f2017%2f05%2ftamilnadu-2016-election---a-data-story%2f

G Plus: https://plus.google.com/share?url=%2f2017%2f05%2ftamilnadu-2016-election---a-data-story%2f

I think some issue in baseURL config setting is causing both the problems.

Thank you.


Solution

  • This is one of the many reasons why I don't recommend GitHub pages but Netlify. You can choose to publish with GitHub pages, but you always have to run blogdown::hugo_build() before you publish the site. See the blogdown documentation for more details.