Description
This plugin is an allrounder you will really like! It allows your website visitors to engage with your content in multiple ways:
-
in a Facebook-style thumbs-up way, where only upvotes are allowed
-
by allowing both up- and downvotes
-
giving numeric ratings, e.g. 1 to 5 stars.
How it works
The plugin saves a reaction to the selected content node from the Mesh user.
First, it requires a string field, named likes by default, existing at your project’s content schema. This field is populated with a per-node configuration of how exactly to 'like' the content.
The actual reactions to the content are stored in an own Mesh folder, Like Plugin, where can be accessed or manipulated, if required.
The plugin uses Handlebars for the templating.
Configuration
The plugin configuration looks as following:
-
projects: A list of you projects where Like plugins is expected to work with (read this as: where a field should exist on a content schema, see below) -
configField: A field name, expected to exist at the project’s content schema. Default value islikes. -
templatesPath: The path to the Handlebars templates. -
caching: Flag of cache usage. Default value istrue.
The per-node configuration is a JSON, containing the following:
{
active: false, // true/false, turning the liking on and off for a particular node. Default value is `false`.
type: "like", // a type of a 'like'. Possible values are 'like', 'rating', 'plusminus', see the description below.
maxRating: 10, // a maximum value for the 'rating' type. Default value is 0, e.g. rating is disabled and requires explicit limit to be set.
}
There are following liking types possible, from the perspective of currently logged in Mesh user to the selected content node:
-
like: a plain 'you have liked this post' reaction. -
plusminus: a polarized 'like/dislike' reaction. -
rating: a 'rating' reaction from zero to themaxRatingvalue.
API
The plugin contains a set of REST APIs to control the likes functionality per Mesh node:
-
POST /likes/:nodeUuid/:langposts a reaction of a current Mesh user to the content with UUID:nodeUUIDand:langlanguage. -
GET /likes/:nodeUuid/:langgets the reaction of a current user to the content with UUID:nodeUUIDand:langlanguage. -
DELETE /likes/:nodeUuid/:langremoves the reaction of the current user to the content with UUID:nodeUUIDand:langlanguage. -
GET /likes/:nodeUuid/:lang/statisticsgets the full reaction statistics to the content with UUID:nodeUUIDand:langlanguage. -
GET /templatesreturns the liking HTML according to the Handlebars templates set up.
