This plugin is a folk from NodeBB Blog Comments, I just added some more features and fixed some bugs to it.
- Support multiple blogs, use
articleID
andblogger
to distinguish posts from different blogs, so this is kinda break change to the original nodebb-plugin-blog-comments. - Simple script for ghost, hugo, pelican etc, and a general script for any other blogs, just add a
<script>
node at any place of the page, will support more blog platforms later. - Use
siteTitle
instead of NodeBB in thecomments.tpl
. - Support social sites sharing plugin and upvote and bookmark actions.
- Two css styles for comments.
- Fixed some bugs, like escaped title and content problems, profile image display, etc.
The multiple blogs feature is great, you can see at here: https://v2mm.tech/category/46/blog There are already some blogs conntected with V2MM.
NodeBB Blog Comments
The original NodeBB Blog Comments lets NodeBB act as a comments engine/widget for your blog. It supports both Ghost and WordPress.
The comments are exposed to any plugin you have built into the core, so it is completely possible to have emoticons, embedded video, and/or whatever else you want in the comments section of your blog.
Articles are published to a forum category of your choice, and will gain a tag that links it back to the original article.
Screenshots
-
Style 1
-
Style 2
Installation
First install the plugin:
npm install nodebb-plugin-blog-comments2
Activate the plugin in the ACP and reboot NodeBB. Head over to the Blog Comments section in the ACP and select the Category ID you'd like to publish your blog content to (default is Category 1). Make sure you put the correct URL to your blog.
General Use
Put this script to anywhere in your blog's article page, either in head or body, fill the variables, see explanations below.
If you wish, you can create <a id="nodebb-comments"></a>
to where you want to place the actual comments widget.
Also, there are some special scripts for some common blog platform. But in various blog themes, these scripts cannot guarantee to be true.
For example, simple-wordpress.js
can't be used on any wordpress websites.
If you encounter any error, use general.js
instead or put an issue to me.
Ghost Installation
Paste this any where in yourtheme/post.hbs
, somewhere between {{#post}}
and {{/post}}
. All you have to edit is line 3 (nbb.url
) - put the URL to your NodeBB forum's home page here.
{{../post.title}}{{../post.markdown}}Please enable JavaScript to view comments
If you wish, you can move <a id="nodebb-comments"></a>
to where you want to place the actual comments widget.
See demo at hgkat's blog, her blog is using this script to connect with V2MM.
Simple Ghost Installation
Since some blogs might installed with docker, couldn't change the theme file, I create this simple script which can be added at any place of the html.
Just add this any where on your blog's page:
<script id='nodebb-comments-script' ourl="//your.nodebb.com" ocid="1" blogger='name' src="//your.nodebb.com/plugins/nodebb-plugin-blog-comments2/lib/simple-ghost.js"></script>
Note: ocid is the category id in your NodeBB, blogger is set for distinguish posts from different blogs.
See demo at Wave's blog, his blog is using this script to connect with V2MM.
Simple Hugo Installation
<script id='nodebb-comments-script' ourl="//your.nodebb.com" ocid="1" blogger='name' src="//your.nodebb.com/plugins/nodebb-plugin-blog-comments2/lib/simple-hugo.js"></script>
See demo at Leyafo's blog, his blog is using this script to connect with V2MM.
Simple Pelican Installation
<script id='nodebb-comments-script' ourl="//your.nodebb.com" ocid="1" blogger='name' src="//your.nodebb.com/plugins/nodebb-plugin-blog-comments2/lib/simple-pelican.js"></script>
See demo at Cycleuser's blog, his blog is using this script to connect with V2MM.
Wordpress plugin and any other plugins in PHP, I haven't test them yet, as I don't have those blogs. If your blog is wordpress, and would like to connect with V2MM, I would be glad to set up this script for you.
Wordpress Installation
First, install the Wordpress JSON API plugin.
Replace the contents of /wp-content/themes/YOUR_THEME/comments.php
with the following (back-up the old comments.php, just in case):
<?phpif ( post_password_required() ) return;?> Please enable JavaScript to view comments
Comments Counter
You may optionally put a "# of comments" counter anywhere on the page with the following code:
Comments
A mechanism to query the number of comments on another separate page will be available in a future release.
Author and Category information
To use NodeBB's category and author information (instead of using Ghost's user/tag system), there are two elements that this plugin searches for:
Published by in
Publishing
Head over to the article that you'd like to publish. The code will detect if you're both an administrator of your blog and NodeBB (so ensure that you're logged into both) and will display a publish button if so.
You may also create a publishers
group in NodeBB to allow a group of regular users to have publish rights.