How do I add my own section to the jContent left navigation?
Question
How do I add my own section to the jContent left navigation?
Answer
The left navigation entries are accordionItem registry entries. jContent
registers its own - Pages, Content folders, Media, Apps, Search, Categories - the
same way a module does.
A section backed by a content tree
Most custom sections want the standard tree, so compose from jContent's base descriptor rather than writing the rendering yourself:
import {registry} from '@jahia/ui-extender';
import {Grain} from '@jahia/moonstone';
const base = registry.get('accordionItem', 'renderDefaultContentTrees');
registry.add('accordionItem', 'myThings', base, {
targets: ['jcontent:75'],
icon: <Grain/>,
label: 'myModule:label.myThings',
rootPath: '/sites/{site}/contents/my-things',
requiredSitePermission: 'myThingsAccess',
isEnabled: siteKey => siteKey !== 'systemsite',
treeConfig: {
hideRoot: false,
selectableTypes: ['jnt:contentFolder', 'myt:thing'],
openableTypes: ['jnt:contentFolder']
}
});
The third argument - the base descriptor - is what supplies the tree rendering and the route component. Omit it and you get a registry entry that renders nothing, which is the usual reason a new section does not appear.
The pieces that matter
| Key | What it does |
|---|---|
targets | 'jcontent:<priority>'. This is what puts the item in the navigation at all, and the number orders it. jContent's own items use 50 and above. |
rootPath | the subtree the section browses, with {site} substituted per site |
label | a resource-bundle key, <module>:<key> |
icon | a Moonstone icon element |
isEnabled(siteKey) | hide the section for some sites - jContent's own items exclude systemsite |
requiredSitePermission | gates visibility on a site permission |
treeConfig | selectableTypes, openableTypes, hideRoot, rootLabel |
tableConfig | the main panel's columns and view selectors |
Register it from a jahiaApp-init callback at a priority above 1, since
jContent registers its own at jahiaApp-init:1.
A section that is not a content tree
If your section is an arbitrary React route rather than a JCR subtree, supply
routeComponent and your own render instead of composing from the tree base.
jContent does this for its Search and Deletion-info items.
A caveat worth knowing
No module outside jContent itself registers an accordionItem anywhere in
Jahia's public GitHub organisation. The mechanism is the one jContent uses for
its own navigation, and it is a registry like any other, but you will not find a
third-party example to copy - the shipped items are the reference.
Because of that, treat the key set above as what jContent currently consumes rather than as a frozen public contract, and re-check it against the jContent version you ship.
This article was drafted with AI assistance, then reviewed and curated by Jahia Customer Support engineers before publication.