Requirements:
- CKAN 1.7+
- Disqus account and forum
- Disqus API keys (for Single Sign On support)
Installation:
1. Activate CKAN virtualenv:
. /usr/lib/ckan/default/bin/activate
Install extension:
pip install -e git+https://github.com/okfn/ckanext-disqus#egg=ckanext-disqus
Add plugin to ckan.plugins:
ckan.plugins = … disqus …
Configure Disqus settings (see Configuration below)
Restart CKAN:
sudo service apache2 restart
Disqus Account Setup:
1. Create Disqus account at https://disqus.com/
2. Register your site to get a forum shortname
3. (Optional) Generate API keys for SSO:
- Go to https://disqus.com/api/applications/
- Create new application
- Note the Public Key and Secret Key
Configuration:
Required Settings:
Disqus forum shortname (from your Disqus account)
disqus.name = your-forum-shortname
Optional Settings:
Full URL to Disqus site (for better integration)
disqus.disqus_url = http://your-site.disqus.com
Single Sign On API keys (for automatic user authentication)
disqus.secret_key = YOUR_DISQUS_SECRET_KEY
disqus.public_key = YOUR_DISQUS_PUBLIC_KEY
Usage:
Automatic Integration:
- Comments automatically appear on package pages after installation
- Uses disqus_identifier format: {controller}::{id}
Example: package::my-dataset-name
Template Helpers:
Add comments to custom template:
{{ h.disqus_comments() }}
This embeds the full Disqus comment thread for the current page.
Add recent comments widget:
{{ h.disqus_recent() }}
Shows recent comments across all threads.
Customize recent comments count:
{{ h.disqus_recent(num_comments=10) }}
Default is 5 comments if not specified.
Single Sign On (SSO):
When SSO is configured with API keys:
- Users automatically authenticated with their CKAN credentials
- No separate Disqus login required
- User display name matches CKAN username
- Seamless commenting experience
To enable SSO:
1. Obtain Disqus API keys (see Disqus Account Setup above)
2. Add keys to production.ini:
disqus.secret_key = YOUR_SECRET_KEY
disqus.public_key = YOUR_PUBLIC_KEY
3. Restart CKAN
Customization:
Customize Disqus Identifier:
By default, identifiers use pattern: {controller}::{id}
To customize, override in your theme:
- Modify the disqus_identifier in template context
- Ensure identifiers remain consistent for each page
Customize Appearance:
Disqus appearance configured through Disqus admin panel:
1. Log into https://disqus.com/admin/
2. Select your forum
3. Go to Settings → Appearance
4. Customize colors, layout, etc.
Moderation:
Moderate comments through Disqus:
1. Log into https://disqus.com/admin/
2. Select your forum
3. Go to Moderate
4. Approve, delete, or mark as spam
Moderation settings:
- Pre-moderation (approve before publishing)
- Automatic spam detection
- User blocking
- Comment filtering
Troubleshooting:
Comments not appearing:
- Verify disqus.name is set correctly in production.ini
- Check Disqus forum is active
- Ensure JavaScript is enabled in browser
- Check browser console for errors
SSO not working:
- Verify disqus.secret_key and disqus.public_key are correct
- Check Disqus application is approved for SSO
- Verify user is logged into CKAN
- Check CKAN logs for authentication errors
Widget not showing recent comments:
- Verify there are existing comments
- Check disqus.name matches forum shortname
- Ensure widget JavaScript loads correctly
Wrong site comments appearing:
- Verify disqus_identifier is unique per page
- Check disqus.name matches intended forum
- Review Disqus forum settings
Development:
The extension provides:
- Plugin class: ckanext.disqus.plugin:Disqus
- Template helpers for embedding Disqus components
- SSO payload generation and signing
- Automatic identifier generation
License: GPL
Keywords: CKAN, comments, disqus, discussion, sso
Developer: Open Knowledge Foundation