Tagging content types and pages

November 14, 2023

Tagging the content is one of the important features in social networking.

Jahia leverages tagging by enabling its support on all content objects and pages using following definitions:

[jmix:tagged] > jmix:metadata mixin
- j:tags (reference, category[autoSelectParent=false]) multiple
- j:newTag (string) hidden indexed=no

[jnt:tag] > nt:base, jmix:hierarchyNode, jmix:basemetadata, jmix:publication, jmix:collection
- tags (reference) multiple hidden < jnt:tag

[jnt:page] > nt:base, jmix:hierarchyNode, jmix:collection, jmix:renderable, jmix:basemetadata, mix:title, jmix:publication, jmix:tagged
+ * (nt:base) version

[jnt:container] > nt:base, jmix:editorialContent, jmix:hierarchyNode, jmix:collection, jmix:basemetadata, mix:title, jmix:categorized, jmix:keywords, jmix:tagged

Please note, that by default tagging is enabled for nodes, extending jnt:page or jnt:container types. To add the tagging feature to any particular node, you need to add the jmix:tagged mixin type to your node definition:

[my_templates:note] > nt:base, jmix:tagged

In order to display the list of tags, which have been assigned to the current content object, you can use the following code in your template:

<template:module node="${currentNode}" template="tags"/>

The following code displays a text entry field and an 'Add' button for tagging the current node (used in conjunction with the 'tags' template):

<template:module node="${currentNode}" template="addTag"/>