Xiaohong Deng I am super awesome
Published

二 04 七月 2017

←Home

Set Up Disqus With Pelican

There are a few variables in pelicanconf.py involved in this problem, there are a few that break your app in other ways. I'm gonna concentrate on those directly involved and traps you might get caught up with.

  • This Disqus comment feature can not be previewed locally, I will explain it later.
  • Just in case, set RELATIVE_URLS to True in pelicanconf.py and to False in publishconf.py. Set SITEURL to your domain name in the form of http://domainame.me in publishconf.py. Generate your site using publishconf.py if you want to view it remotely.
  • Set DISQUS_SITENAME = <YOUR_DOMAIN>. It can be any string you like.

Registration at Disqus

  • Follow disqus_static plugin installation, the html text under usage is not relevant in most of the themes. Of course I can't test them all. When register the application at Disqus, there are many blanks you need to fill in. Fill in <YOUR_DOMAIN> when possible, in case some blank is used to match DISQUS_SITENAME.
  • Do not move disqus_static.py to plugin folder in pelican installation directory. Instead, specify the PLUGIN_PATHS as pelican docs suggests.
  • There is another registration process you need to go through. I don't remember where is the entrance, but the first step is for you to choose whether you want to comment as a user or install Disqus comment feature to your site. After the registration <YOUR_DOMAIN>.disqus.com/admin/settings should be accessible. Click site -> advanced on the left. Add SITEURL to Trusted Domains. localhost or 127.0.0.1 can't be added. That's why this feature can't be previewed locally.
  • At some step of the above registration process, you will be asked for the blogging system you tend to apply Disqus to. Pelican is not on the list and you will be directed to some universal embedded code. Pelican doesn't need those code to work with Disqus. You can safely ignore it.

If Things Mesh

  • If you set DISQUS_SITENAME and it matches the corresponding setting on Disqus.com, for some themes like pelican-clean-blog comment hyperlinks should be visible under each article on the index page. This part is independent of the next part.
  • When the comment section is not loaded on an article page, for some themes it's hard to tell if your plugin is not loaded correctly or it's communication failure between your site and Disqus. Those themes fail silently. Some other themes will show error message "We were unable to load Disqus" and give a trouble shooting link. That means the plugin is loaded correctly. For themes that fail silently you can comment out PLUGIN_PATHS and PLUGINS to see if things are different in any ways. Themes like Flex are integrated with Disqus plugin so that's trouble saving.
Go Top
comments powered by Disqus