[nodebb-plugin-blog-comments] Blog Commenting Engine (Ghost, Wordpress widget)
-
I have upgraded the node to the latest version of version4 but that did not helped at all.
-
@Peter-Zoltan-Keresztes I do and it works just fine.
-
@AOKP Interesting, but I don't understand why I am having these issues.
-
@Peter-Zoltan-Keresztes maybe share your config.json and also the settings you use for the plugin in the ACP.
-
@AOKP Here is my config.json:
{ "url": "http://z0z0.me/comments", "secret": "somehash", "database": "redis", "redis": { "host": "127.0.0.1", "port": "6379", "password": "somepass", "database": "0" } }
and here is the plugin setting in the ACP:
-
@Peter-Zoltan-Keresztes and how did the code looked you embed into your Ghost installation?
I assume that maybe you are facing a theming issue here. But we will see.
-
Peter-Zoltan Keresztesreplied to A Former User on last edited by Peter-Zoltan Keresztes
@AOKP I am using the default Casper theme and I just copied the code from this post and implemented in the post.hbs right before the {{/post}} tag.
</aside> <a id="nodebb/comments"></a> <script type="text/javascript"> var nbb = {}; nbb.url = '//z0z0.me/comments'; // EDIT THIS (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> {{/post}}
-
@Peter-Zoltan-Keresztes try to insert it right after the share section.
-
@AOKP said:
@Peter-Zoltan-Keresztes try to insert it right after the share section.
reply
After a sleepless night where I have reinstalled everything. New VPS, new blog, new nodebb and I am back at square 1 where out of 15 posts only on 3 I was able to enable the comments. On rest I am getting in the logs the 31/12 08:10 [6749] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me. It seam to me that nodebb cannot read the Origin header from most of the blog posts.
-
@Peter-Zoltan-Keresztes had the same in my logs though and it worked as I showed you yesterday.
-
Not sure what can I do. Right now I am using your exact same configs for node and ghost in nginx.
-
This post is deleted!
-
The latest updates fixed all the issues I had on enabling comments on most of the ghost blog posts.
-
Just a heads up for anyone else using this with Wordpress. After the latest update the categoryID variable in comments.php of your theme isn't optional. If it isn't defined publishing doesn't work.
-
Currently, I can't change the category id to another category. It's always posting to category id 1
-
@Hưng-Thành-Nguyễn are you using Wordpress or Ghost?
-
@overlawled
Hi, I'm using wordpress -
I did a integration between forum.mysensors.org and my new open hardware sharing site https://www.openhardware.io using parts of the blog-comments plugin to allow commenting on each project.
From the forum side: http://forum.mysensors.org/category/30/openhardware-io
And from openhardware: https://www.openhardware.io/view/4/EasyNewbie-PCB-for-MySensors#tab-commentsBut as we have to keep title/tags in forum in-sync with the open-hardware-site I had to create a new endpoint which besides creating, also updates the post each time someone published changes. The publishing/update request is sent from our backend.
Here is the interesting part of the code:
Comments.publishProject = function(req, res, callback) { var markdown = req.body.markdown, title = req.body.title, url = req.body.url, commentID = req.body.id, tags = req.body.tags, uid = xxx; if (req.body.token !== "XXXXXXXXXXXXXX") return res.json({error: "Unknown token"}); Comments.getTopicIDByCommentID(commentID, function(err, tid) { if (err || !tid) { var hostUrls = (meta.config['blog-comments:url'] || '').split(','), position = 0; hostUrls.forEach(function(hostUrl, i) { hostUrl = hostUrl.trim(); if (hostUrl[hostUrl.length - 1] === '/') { hostUrl = hostUrl.substring(0, hostUrl.length - 1); } if (hostUrl === req.get('origin')) { position = i; } }); var cid = meta.config['blog-comments:cid'].toString() || ''; cid = parseInt(cid.split(',')[position], 10) || parseInt(cid.split(',')[0], 10) || 1; topics.post({ uid: uid, title: title, content: markdown, tags: tags, req: req, cid: cid }, function(err, result) { //console.log(err); //console.log(err.stack); if (!err && result && result.postData && result.postData.tid) { posts.setPostField(result.postData.pid, 'blog-comments:url', url, function(err) { if (err) { return res.json({error: "Unable to post topic", result: result}); } db.setObjectField('blog-comments', commentID, result.postData.tid); res.redirect((req.header('Referer') || '/') + '#tabs-comments'); }); } else { res.json({error: "Unable to post topic", result: result}); } }); } else { topics.getMainPost(tid, uid, function(err, post) { if (err) return res.json({ok:false}); var payload = { title: title, uid: uid, pid: post.pid, content: markdown, tags: tags, options: { tags: tags } }; posts.edit(payload, function(err, returnData) { if (err) return res.json({ok:false}); //errorHandler.handle(err, res, returnData); res.json({ok:true}); }); }); } }); };
-
Just wanted to point out that there are compatibility issues with the ns-plugin-ns-points plugin. The following error is thrown when accessing any of the posts on Ghost
error: TypeError: Cannot read property 'uid' of undefined at nodebbpath/node_modules/nodebb-plugin-ns-points/app/filters.js:68:36
It worked once I disabled the points plugin.
-
@overlawled said:
Just a heads up for anyone else using this with Wordpress. After the latest update the categoryID variable in comments.php of your theme isn't optional. If it isn't defined publishing doesn't work.
@overlawled @Hưng-Thành-Nguyễn Could you try to set
var categoryID = 0;
orvar categoryID = null;
? Any falsy value should work.