• Stars
    star
    366
  • Rank 115,785 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A React component for Disqus

disqus-react

npm version

A package for integrating Disqus services into React applications.

Installation

Using npm:

$ npm install --save disqus-react

Using yarn:

$ yarn add disqus-react

Usage

DiscussionEmbed

This is the component that will load the main Disqus comments section.

import { DiscussionEmbed } from 'disqus-react';

<DiscussionEmbed
    shortname='example'
    config={
        {
            url: this.props.article.url,
            identifier: this.props.article.id,
            title: this.props.article.title,
            language: 'zh_TW' //e.g. for Traditional Chinese (Taiwan)	
        }
    }
/>

This component is limited to one instance in the DOM at a time and will handle updates to both the config and shortname props and reload appropriately with the new discussion thread.

DiscussionEmbed with SSO

This is an example for setting up the DiscussionEmbed component with SSO. This example config is also used on the Disqus React SSO example found here: https://disqus-sso-react-demo.glitch.me/.

import { DiscussionEmbed } from 'disqus-react';

<DiscussionEmbed
    shortname='example'
    config={
        {
            url: this.props.article.url,
            identifier: this.props.article.id,
            title: this.props.article.title,
            language: 'zh_TW', //e.g. for Traditional Chinese (Taiwan)
            apiKey: '',
            sso: {
                name: 'SampleNews',
                button: 'http://example.com/images/samplenews.gif',
                icon: 'http://example.com/favicon.png',
                url: 'http://example.com/login/',
                logout: 'http://example.com/logout/',
                profile_url: 'http://example.com/profileUrlTemplate/{username}',
                width: '800',
                height: '400',
            }
        }
    }
/>

CommentCount

This component will display the comment count for the Disqus thread associated with the provided config.

import { CommentCount } from 'disqus-react';

<CommentCount
    shortname='example'
    config={
        {
            url: this.props.article.url,
            identifier: this.props.article.id,
            title: this.props.article.title,
        }
    }
>
    {/* Placeholder Text */}
    Comments
</CommentCount>

Multiple instances of this component can be included on the same page with different config variables (e.g. an article list showing the comment count for each). However, all threads on the site must be under the same primary site shortname. If the component receives a new shortname, all instances will be reset with counts for threads matching the updated site.

CommentEmbed

This component can be used to embed a Disqus comment into your page.

import { CommentEmbed } from 'disqus-react';

<CommentEmbed
    commentId={this.props.article.featuredCommentId}
    showMedia={true}
    showParentComment={true}
    width={420}
    height={320}
/>

Multiple instances of this component may be include on the same page with different commentId variables and does not require that the embedded comment be under the same primary site shortname.

Recommendations

This component can be used to embed Disqus Recommendations into your page.

import { Recommendations } from 'disqus-react';

<Recommendations 
    shortname='example'
    config={
        {
            url: this.props.article.url,
            identifier: this.props.article.id,
            title: this.props.article.title,
        }
    }
/>

The config prop is optional and is used to prevent any discussions on the current page from being included in the recommendations. This component is limited to one instance in the DOM at a time and will handle updates to the shortname prop and reload appropriately with recommended pages for the new forum shortname.

Contributing

If you'd like to contribute to this package feel free to submit a bug report, feature request, or pull request. Though we would ask that you first read through the contributing guidelines.

More Repositories

1

gargoyle

Feature switches in Django
Python
748
star
2

nydus

Nydus is a Python toolkit for managing database connections and routing operations, primarily for Redis
Python
380
star
3

django-bitfield

A BitField extension for Django Models
Python
377
star
4

DISQUS-API-Recipes

Cook all the things!
PHP
288
star
5

django-mailviews

Class-based email views for the Django framework, including a message previewer.
Python
269
star
6

overseer

A status board built with Django
Python
257
star
7

gutter

Fully featured Python feature switch toolkit
Python
226
star
8

nexus

A centralized, pluggable admin app for Django
Python
204
star
9

disqus-python

Disqus API bindings for Python
Python
162
star
10

django-db-utils

Utilities for your Django Database
Python
159
star
11

python-phabricator

Python bindings for Phabricator
Python
159
star
12

disqus-php

Disqus API bindings for PHP
PHP
146
star
13

django-modeldict

Python
132
star
14

sharding-example

Example of sharding tools used at Disqus
Python
112
star
15

django-perftools

Performance monitoring tools for Django
Python
110
star
16

backbone.uniquemodel

Backbone.js plugin for ensuring unique model instances across your app
JavaScript
98
star
17

porkchop

Simple HTTP-based system information server
Python
93
star
18

durabledict

Dictionary-style access to different types of models.
Python
85
star
19

postfix-stats

Simple threaded stats aggregator for Postfix
Python
76
star
20

grunt-smartrev

A "smart" file versioner for production environments which takes inter-file dependencies into account automatically.
JavaScript
75
star
21

orbital

Orbital is a real-time map built on top of Websockets and ZeroMQ.
JavaScript
69
star
22

disqus-wordpress

Legacy WordPress plugin 1.x - 2.x. Go to disqus/disqus-wordpress-plugin for current version -
PHP
68
star
23

toronado

fast lxml-based stylesheet inliner
Python
60
star
24

disqus-install-examples

Installation Examples for Disqus
HTML
55
star
25

mule

Mule is a distributed test runner for Python
Python
51
star
26

gutter-django

Python
45
star
27

menagerie

ZooKeeper-backed Django settings interface.
Python
42
star
28

disqus-postgres

Python
39
star
29

fpm-recipes

Makefile
39
star
30

grockets

Realtime streaming graphite data via socket.io and node.js
JavaScript
38
star
31

nose-performance

A plugin for Nose for running performance tests
Python
34
star
32

zumanji

A web interface for aggregating results from nose-performance
JavaScript
33
star
33

disqus-wordpress-plugin

WordPress plugin for Disqus (Latest version)
TypeScript
33
star
34

nagios-plugins

Nagios plugins written at Disqus
Python
30
star
35

channels

A demo of a modern forum powered by DISQUS
JavaScript
30
star
36

nydus-django

Python
29
star
37

playa

An audio playing web service
Python
27
star
38

sentry-graphite

An extension for Sentry that increments a key in graphite based on the error.
Python
27
star
39

disqus-arcanist

Arcanist extensions by Disqus
PHP
26
star
40

php-disqus

Old PHP bindings for Disqus
PHP
22
star
41

porkchop-plugins

Plugins for Porkchop
Python
18
star
42

nose-socket-whitelist

nose plugin that provides control over what socket connections can be opened during test execution
Python
17
star
43

disqus.github.com

Python
16
star
44

codebox

Code Sharing for Teams
Python
14
star
45

nose-template-usage

Template usage reports for testing Django applications with Nose.
Python
13
star
46

mockhttp

Python
13
star
47

django-patches

A collection of patches of various changes in Django used by Disqus
12
star
48

pgshovel

A change data capture system for PostgreSQL
Python
11
star
49

pg_audit

Audit PostgreSQL tables in an automated fashion.
10
star
50

docker-nginx

some dockerfiles for some nginx
Dockerfile
9
star
51

graphite-reporter-agent

Java Agent for Cassandra's Metrics' Graphite Reporter
Java
9
star
52

facebook-python-sdk

Facebook Platform Python SDK
Python
8
star
53

django-metaredirect

META-tag and JavaScript based generic redirect views for maintaining HTTP referrers.
Python
8
star
54

psycopg2-managed-connection

Thread-safe connection manager for psycopg2 connections.
Python
8
star
55

pg_partition

Partition management for PostgreSQL
7
star
56

fastly-slurper

Slurps delicious fastly logs. Mmm.
Python
7
star
57

django-test-helpers

Python
7
star
58

convey

Python
6
star
59

disqus-api-demos

Python
6
star
60

docker-pgqd

pgqd (PgQ Ticker Daemon) on Docker
Python
5
star
61

standup-helper

Disqus' standup bot + dashboard.
JavaScript
4
star
62

phab-trello

Phabricator-to-Trello Webhook
JavaScript
4
star
63

bokbok

JavaScript
4
star
64

imperium-python

Impermium API bindings for Python
Python
4
star
65

grunt-kssgen

KSS styleguide generator for grunt. - Alternative to grunt-kss since it is dead
JavaScript
4
star
66

diamond-collectors

Python
3
star
67

nginx-old

Nginx (PPA packaging)
C
2
star
68

nose-unittest

Python
2
star
69

datasketches-hive

Java
2
star
70

kazoo-eventlet-handler

Kazoo handler for usage in eventlet greenthreaded environments.
Python
2
star
71

smartrev

A "smart" file versioner for production environments which takes inter-file dependencies into account automatically.
2
star
72

trello-phab

Parse phab-trello webhook attachments
JavaScript
1
star
73

docker-heka

heka in a docker
1
star
74

Hive-JSON-Serde-tmp

Java
1
star
75

nginx

Disqus Nginx Build
C
1
star
76

facebook-sdk

Mirror of facebook-sdk
Python
1
star
77

dataweek2013

Scala
1
star
78

disqus-slack

post Disqus comments to a Slack channel or PM with /disqus <comment url>
JavaScript
1
star
79

kafka-python

mirror of original dpkp/kafka-python
Python
1
star