psychobunny / nodebb-plugin-blog-comments

Lets NodeBB act as a comments engine/widget for your blog
BSD 2-Clause "Simplified" License
100 stars 55 forks source link

REQUEST - please integrate with pencilblue cms #51

Closed dede5 closed 8 years ago

dede5 commented 8 years ago

https://pencilblue.org/

theunknownartisthour commented 8 years ago

Well this code is hosted on nodeBB so it's agnostic to what host you're setting up on. It just needs a few parameters :)

So if we take this code for integrating into ghost

<a id="nodebb/comments"></a>
<script type="text/javascript">
var nbb = {};
nbb.url = '//your.nodebb.com'; // EDIT THIS
nbb.cid = 1;    // OPTIONAL. Forces a Category ID in NodeBB.
                //  Omit it to fallback to specified IDs in the admin panel.

(function() {
nbb.articleID = '{{../post.id}}'; nbb.title = '{{../post.title}}';
nbb.tags = [{{#../post.tags}}"{{name}}",{{/../post.tags}}];
nbb.script = document.createElement('script'); nbb.script.type = 'text/javascript'; nbb.script.async = true;
nbb.script.src = nbb.url + '/plugins/nodebb-plugin-blog-comments/lib/ghost.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(nbb.script);
})();
</script>
<script id="nbb-markdown" type="text/markdown">{{{../post.markdown}}}</script>
<noscript>Please enable JavaScript to view comments</noscript>

We may get a quick idea of what to do in pencilblue by taking a quick look here https://github.com/pencilblue/pencilblue/wiki/Quickstart:-HTML-Templates

We'd just need to change from hbs template syntax to ts and we should be relatively good to go. Granted I don't know where pencilblue keeps its article ids or whether you can access them. I guess I'll be finding out in a short bit~

Edit: Taking a quick hint from https://github.com/pencilblue/disqus-pencilblue/blob/master/templates/disqus_comments.html

theunknownartisthour commented 8 years ago

Somewhat finished plugin / product~ https://github.com/theunknownartisthour/nodebb-comments-pencilblue

psychobunny commented 8 years ago

Nice, I'll leave a note on this repo's readme about your pencilblue project

theunknownartisthour commented 8 years ago

@psychobunny would you consider refactoring this repo for external comment counts? EG we return the comment count parameterized in

<span id="nodebb-comments-count"></span>

somehow?

for example:

<span id="nodebb-comments-count" data-nodebb-category="3" data-nodebb-thread="4"></span>

perhaps where:

<span id="nodebb-comments-count" data-nodebb-category="3"></span>

returns the aggregate post count for category 3?

This way for ghost/wordpress index pages we can get a preview of the comment count like you do in the forum.