Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.
The Commenting module adds a commenting feature on any Magnolia page. The module is built on the Forum module and comments are managed in AdminCentral in Forums. The module is integrated with the STK.
The benefits of built-in commenting, as opposed to an external service include:
The STK also supports IntenseDebate, a third party commenting service.
The module is configured in
The module includes two components:
stkArticleand its extensions, but you can make it available on any template. See Adding components to templates for more.
Here's the Comments component on the
/demo-project/about/history page and Latest Comments component in
extras area on a related page.
comments component provides the commenting functionality. When you add it to a page commenting is automatically enabled.
The component definition is in
commentsdialog has a single field, Alternative Text. The content renders if the user does not have permission to view or post comments. By default anonymous commenting is allowed. See Security for more.
modelClass: PageComments :
ContentMapList, including the gravatar, title, message, username, date and inline reply link for each.
comment-form.inc.ftl(GIT) script that renders the form.
The Latest Comments component is a teaser that can be used in
extras area to display comments made on a related page.
latestComments component definition is in
forumName: Comments are stored in the
pagecommentsforum created by the module. See Forums for more.
latestCommentsallows editor's to include a title, select the page that comments are sourced from, set the maximum number of comments, and set the description (message) length.
modelClass: LatestComments retrieves a list of the latest page comments for a specified page.
latestComments.ftl(GIT) renders the component title, list of comments from the specified page, and respects any limitations set in the dialog.
Page comments are stored in and rendered from the
forum workspace. Only properties defined in the component dialogs are stored in the
website workspace. Here's the
comments component in
comments area of the
/demo-project/about/history page in the
website JCR browser, accessible in Tools > JCR Browser (Website).
You can add the commenting components to any template. The
comments component adds the commenting feature automatically. Ideally the
comments component should reside in it's own area, but there is no technical reason that it cannot be add to
content area, for example. See Rendering comments area for an alternative STK method.
The example configurations below add the
comments component to
content area and the
latestComments component to
extras1 area of the
stkSection template configured in STK > Template Definitions
In the examples below dummy comments were added to the
/demo-project/about/subsection-articles page and referenced on the
/news-and-events page. Both pages are based on the
In the STK the is made available in
main/comments area in the template prototype. This is configured in Templating Kit > Site Definitions
The configuration above makes the
comments component available in all templates, but it is in fact only available in the
stkArticle template (and by extension all content templates). This is because
main area in the prototype is rendered by
/templating-kit/pages/global/mainArea.ftl and in
/templating-kit/pages/content/mainArea.ftl. You can find these configurations in Templating Kit > Site Definitions
/default/templates/prototype/areas/main/templateScript and Templating Kit > Template Defintions
/pages/stkArticle/areas/main/templateScript. See main and comments area for more.
You can use the cms:area directive to render the
comments area on any template. Add
[@cms.area name="comments"/] to the relevant main area template.
To demonstrate, we added the directive to
/templating-kit/pages/global/mainArea.ftl that renders main area in the prototype. You can test this in Templating Kit > Templates:
[@cms.area name="comments"/]to the template.
comments area on the
This is a better alternative than Adding components to templates if you use the STK.
The STK is integrated with IntenseDebate commenting. To use this option you need to sign up for an account and get an
The IntenseDebate integration is configured in the
stkComments component definition in Templating Kit > Template Definitions
parameters/intenseDebateId: Insert your
stkCommentsdialog configured at Templating Kit > Dialog Definitions
/components/features/stkCommentshas a single hidden field. The editor sees a blank dialog that renders the
stkCommentscomponent when saved.
comments.ftl(see below) adapts the script provided by IntenseDebate to render the component in Magnolia.
To enable site-wide IntenseDebate commenting you need to substitute the STK Comments for the Magnolia Comments component in the prototype template at Templating Kit > Site Definitions
availableComponents/stkComments: Change the value of the
class: CommentsArea supports the
intenseDebateIdconfiguration property that is made available to the third party software.
Here's the IntenseDebate commenting component on a page.
Magnolia comments are administered and moderated in AdminCentral in Forums. Comments should be moderated on the public instance because this is where the content is generated. See Forum module for more information.
Here are the comments we added in the previous examples on the History and Articles pages in
pagecommentsforum that is created when the module is installed. The
/modules/commenting/templates/components/comments/parameters/forumNamenode of the points to this forum.
Messages can be edited in the Message dialog.
For more information about Magnolia security see Security.
On installation, the Forum module creates the
forum-base role and the Commenting module creates the
forum-pagecomments-admin roles. These roles grant the following permissions in the
Selected and sub nodes
Selected and sub nodes
Moderate and Delete
Selected and sub nodes
Administer(Moderate, Delete and Activate)
Selected and sub nodes
These roles are not assigned to any user or group by default.
superuser is assigned the
forum-All-admin role that provides full permissions.
anonymous user (public user) does not have permission to comment or view comments. You can verify this by logging out of the public instance. The page comments disappear from the page.
To make page comments visible to anonymous users, on the public instance in Security > Systems Users:
Page comments will now be visible, but anonymous users will still be unable to post comments.
To allow public users to view and post comments, follow the procedure above, but assign the
forum-pagecomments-user role to the anonymous user.
You can use the Public User Registration module to require users to register before commenting. The module will automatically assign the
forum-pagecomments-user role to new registered users, if the role is added in
forumPerLocale: Creates forums for each language defined in the
localesnode of the site defintion (EE) or server configuration (CE).
multisite: Creates forums for each site defined in STK > Site definition (EE).
comments component uses the
pagecomments forum by default. This is set in the
forumName property in
/modules/commenting/templates/components/comments/parameters/forumName. To enable multisite and mulitlanguage commenting, delete the value
"pagecomments" and leave it blank. The system will then create new forums automatically in the following formats:
pagecomments_<language identifier>. The forum for the
defaultLocale, for example
pagecomments_en, is created when you add the
commentscomponent to any page. The forums for additional locales, for example,
pagecomments_de, are created when the first comment in the language is posted.
pagecomments-<site name>. A forum is created for each site, for example
pagecomments-demo-features, when the
commentscomponent is added to any page of the site.
pagecomments-<site name>_<language identifier>. The forum for the
defaultLocale, for example
pagecomments-demo-project_en, is created when the
commentscomponent is added to any page of the site, and the forums for additional locales, for example
pagecomments-demo-project_de, are created when the first comment in the language is posted.
Pages with comments are flushed from the server cache when new comments are posted. The Commenting module registers the
class that takes care of this. The configuration is at
/modules/cache/config/configurations/default/flushPolicy/policies/FlushByComments. See Cache module for more information.
You can also disable the cache for individual pages that use comments in
/modules/cache/config/configurations/default/cachePolicy/voters/urls/excludes. Duplicate the
dotMagnolia node and set the
pattern to the page URL. The example configuration below disables the cache for the
This section requires the Observation module that is not installed by default, even though other modules bootstrap configurations to the
/modules/observation/config/listenerConfigurations node. If you do not see a
/observation/version node the module is not installed. Before installing the module export the
generateCategories listener configurations for later use. These are useful and will be overridden on installation of the module.
PageCommentsNotification.ftl script throws an exception when retrieving page link. See MGNLCMNT-103.
You can test this template in Tools > Mail > Template message configuration.
sendMailOnPageComments event listener observes the
forum workspace and sends a preconfigured email when a new comment is posted. This is one of the listener configurations that is overridden when you install the Observation module. See Observation module for more information about configuring listeners.
To use the listener:
sendMailOnPageCommentsevent listener into the
From a system architecture point of view, dealing with high volumes of comments can be challenging. User-generated content POST requests differ from other content requests in that they cannot be served from cache and have the potential to cause bottlenecks during peak load times.
Magnolia can be configured to run in a clustered environment that provides high availability and load balancing. Content sharing between multiple instances is ensured by Jackrabbit’s clustering feature. For more information about running Magnolia in a Jackrabbit clustered environment, see: