├── .gitignore ├── package.json ├── test └── index.test.js └── lib └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | _site 3 | .DS_Store 4 | tmp/* 5 | *.sw? 6 | lib-cov 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { "name": "pop-disqus" 2 | , "description": "Provides a Disqus helper to Pop sites." 3 | , "version": "0.1.0" 4 | , "author": "Alex R. Young " 5 | , "engines": ["node >= 0.4.7"] 6 | , "main": "./lib/index.js" 7 | , "repository": { 8 | "type" : "git" 9 | , "url" : "http://github.com/alexyoung/pop-disqus.git" 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /test/index.test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert') 2 | disqus = require(__dirname + '/../lib/index.js').helpers.disqus 3 | , site = { config: { url: 'http://popjs.com' } }; 4 | 5 | // Ensure the plugin respects the developer setting 6 | assert.ok( 7 | disqus.apply(site, [{ url: '/example/url' }, 'popjs']).match( 8 | /developer = 0/ 9 | ) 10 | ); 11 | 12 | assert.ok( 13 | disqus.apply(site, [{ url: '/example/url' }, 'popjs', true]).match( 14 | /developer = 1/ 15 | ) 16 | ); 17 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | helpers: { 3 | /** 4 | * Includes Disqus universal code. 5 | * 6 | * Disqus documentation: http://docs.disqus.com/help/2/ 7 | * 8 | * @param {Object} A `Post` object 9 | * @param {String} Your site's shortname 10 | * @param {Boolean} Include developer code? 11 | * 12 | * @return {String} 13 | */ 14 | disqus: function(post, shortname, developer) { 15 | return '' 16 | + '' 19 | + '' 27 | + "
" 28 | + "" 36 | + "" 37 | + "blog comments powered by Disqus\n"; 38 | } 39 | } 40 | }; 41 | --------------------------------------------------------------------------------