Skip to content

pirxpilot/disqus-snippet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM version Dependency Status

disqus

Load disqus threads

See in the wild on the American Scenic Byways website - source.

Installation

Install with npm(1):

$ npm install --save disqus-snippet

API

Add #disqus_thread element where you want the thread of discus comments to be rendered.

The following configuration variables are supported:

  • shortname - your disqus forum id - the only mandatory parameter
  • identifier - identifier if different than URL, recommended
  • title - page title if different from head.title
  • url - cannonical page URL, recomended if page URL can have query params
  • developer - set to 1 when loading from localhost

You can pass disqus paramaters using dataset attributes or options object.

On the page:

  <div id="disqus_thread" data-shortname="foo" data-title="Thrursday Foo Discussion"></div>

In the script:

  var disqus = require(`disqus`);
  disqus({
    title: 'Some other title',
    developer: 1
  });

Parameters passed to disqus function overwrite those set up using data- attributes.

If no #disqus_thread element is found we die silently.

License

MIT

About

Load disqus threads

Resources

License

Stars

Watchers

Forks

Packages

No packages published