This documentation is still in progress. We are working hard to update all our screenshots to the new Magnolia 6 style. Please bear with us.

Page tree
Skip to end of metadata
Go to start of metadata

Magnolia stores data in a Java Content Repository. The repository is a hierarchical object database that is particularly well-suited for storing content. In a content management system you need to be able to store text, documents, images and other binary objects along with their metadata. The data is structured as a tree of nodes. Each node can have one or more types. The type defines what kind of properties the node has, the number and type of its child nodes, and its behavior. See Jackrabbit Node Types for more information and Node Type Visualization for a diagram of the node type hierarchy.

In Magnolia we define custom node types that define Magnolia's custom content model. The JCR in turn enforces the constraints of that model at the repository level. If you need to reference JCR node types in your code, Jackrabbit's JcrConstants is useful. We provide constants also for Magnolia's custom node types but also convenience methods. For example, to update the last modification date of a node, use the NodeTypes.LastModified.update(node) convenience method. Magnolia node types are registered by the  NodeTypes Java class.

Prefixes

Node type

Prefix

Notes

JCR primary node type

nt:


Mixin node type

mix:


Magnolia node type

mgnl:

The mgnl prefix does not tell you whether the node is a primary node or a mixin. To find out which type a mgnl node is, check the magnolia-types.xml file.

Node type hierarchy

In this simplified node type hierarchy diagram you can see what extends what. For example, mgnl:page extends mgnl:versionable. This means that page is an object you can version. In contrast, mgnl:area and mgnl:component are not versionable – they are subnodes that must be activated together with the parent page. However, all three node types (page, area, component) are renderable which means you can render a component on its own without its parent page. See the magnolia-types.xml  file for a full view of the Magnolia node type hierarchy.

Primary node types

Every node has a primary node type assigned to it upon creation. The primary node type defines node structure such as allowed and required child nodes and properties. Primary types reflect the business that is represented in the repository. Magnolia's primary node types define content management nodes such as pages, areas, components and resources.

JCR primary node types

Notation

Description

nt:base

The base type of all primary node types.

nt:unstructured

Unstructured node type that allows any properties and child nodes.

nt:hierarchyNode

Abstract base type for nodes in a structured node hierarchy.

nt:file

JCR representation of a file.

nt:frozenNode

This node type is used in the versioning system.

Magnolia primary node types

The primary Magnolia node types are defined in:

magnolia-nodetypes.xml
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Log in - Magnolia Bitbucket</title><script>
window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};window.WRM._unparsedErrors=window.WRM._unparsedErrors||{};
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\u0022\u0022";
WRM._unparsedData["com.atlassian.analytics.analytics-client:policy-update-init.policy-update-data-provider"]="false";
WRM._unparsedData["com.atlassian.analytics.analytics-client:programmatic-analytics-init.programmatic-analytics-data-provider"]="false";
WRM._unparsedData["com.atlassian.bitbucket.server.feature-wrm-data:user.time.zone.onboarding.data"]="true";
if(window.WRM._dataArrived)window.WRM._dataArrived();</script>
<link type="text/css" rel="stylesheet" href="/s/fa400c2a54afb0aa0cca10081dfc24c0-CDN/-801985560/0ae31a3/1720/672e262bc7b230289d63de569d60ec91/_/download/contextbatch/css/_super/batch.css" data-wrm-key="_super" data-wrm-batch-type="context" media="all">
<link type="text/css" rel="stylesheet" href="/s/75e8671d5672e7115d9bc43f5342d76f-CDN/-801985560/0ae31a3/1720/ea28cfaf2acbe7b82e7be0a0260044b0/_/download/contextbatch/css/bitbucket.page.login,-_super/batch.css" data-wrm-key="bitbucket.page.login,-_super" data-wrm-batch-type="context" media="all">
<link type="text/css" rel="stylesheet" href="/s/031df3c6d8ef531007562b822082d2f9-CDN/-801985560/0ae31a3/1720/3fe7202d1f70d1f7764f04f48dea2826/_/download/contextbatch/css/bitbucket.layout.focused,bitbucket.layout.base,-_super/batch.css" data-wrm-key="bitbucket.layout.focused,bitbucket.layout.base,-_super" data-wrm-batch-type="context" media="all">
<link type="text/css" rel="stylesheet" href="/s/56cc98f4ff8092fbf4a7cd8d4a88b1ae-CDN/-801985560/0ae31a3/1720/d0594185e2a40f18481f65faf8c6286c/_/download/contextbatch/css/atl.general,-_super/batch.css" data-wrm-key="atl.general,-_super" data-wrm-batch-type="context" media="all">
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-T/-801985560/0ae31a3/1720/4.3.7/_/download/batch/com.stiltsoft.stash.graphs:modern-icons/com.stiltsoft.stash.graphs:modern-icons.css" data-wrm-key="com.stiltsoft.stash.graphs:modern-icons" data-wrm-batch-type="resource" media="all">
<script type="text/javascript" src="/s/0731ea840d31e175ff6a60723e0fa0d7-CDN/-801985560/0ae31a3/1720/672e262bc7b230289d63de569d60ec91/_/download/contextbatch/js/_super/batch.js?locale=en-US" data-wrm-key="_super" data-wrm-batch-type="context" data-initially-rendered></script>
<script type="text/javascript" src="/s/0eb669ba7e83dd2764beba1c1af71d1f-CDN/-801985560/0ae31a3/1720/ea28cfaf2acbe7b82e7be0a0260044b0/_/download/contextbatch/js/bitbucket.page.login,-_super/batch.js?locale=en-US" data-wrm-key="bitbucket.page.login,-_super" data-wrm-batch-type="context" data-initially-rendered></script>
<script type="text/javascript" src="/s/58cb2d92d524e7b1c07c6ea06069ac96-CDN/-801985560/0ae31a3/1720/3fe7202d1f70d1f7764f04f48dea2826/_/download/contextbatch/js/bitbucket.layout.focused,bitbucket.layout.base,-_super/batch.js?locale=en-US" data-wrm-key="bitbucket.layout.focused,bitbucket.layout.base,-_super" data-wrm-batch-type="context" data-initially-rendered></script>
<script type="text/javascript" src="/s/a4d713e59b1f89c2e585a67f9cb03c22-CDN/-801985560/0ae31a3/1720/d0594185e2a40f18481f65faf8c6286c/_/download/contextbatch/js/atl.general,-_super/batch.js?locale=en-US" data-wrm-key="atl.general,-_super" data-wrm-batch-type="context" data-initially-rendered></script>
<meta name="application-name" content="Bitbucket"><link rel="preload" href="/s/-801985560/0ae31a3/1720/7.6.3/_/download/resources/com.atlassian.auiplugin:internal-iconfont-v2/fonts/adgs-icons.woff" as="font" type="font/woff" crossorigin="anonymous" /><link rel="shortcut icon" type="image/x-icon" href="/s/-801985560/0ae31a3/1720/1.0/_/download/resources/com.atlassian.bitbucket.server.bitbucket-web:favicon/favicon.ico" /><link rel="search" href="https://git.magnolia-cms.com/plugins/servlet/opensearch-descriptor" type="application/opensearchdescription+xml" title="Bitbucket code search"/></head><body class="aui-page-focused aui-page-focused-small aui-page-size-small bitbucket-theme user-login"><ul id="assistive-skip-links" class="assistive"><li><a href="#content">Skip to content</a></li></ul><div id="page"><!-- start #header --><header id="header" role="banner"><section class="notifications"></section><nav class="aui-header aui-dropdown2-trigger-group" role="navigation"><div class="aui-header-inner"><div class="aui-header-before"><a class=" aui-dropdown2-trigger app-switcher-trigger" aria-controls="app-switcher" aria-haspopup="true" role="button" tabindex="0" data-aui-trigger href="#app-switcher"><span class="aui-icon aui-icon-small aui-iconfont-appswitcher">Linked Applications</span></a><div id="app-switcher" class="aui-dropdown2 aui-style-default" role="menu" aria-hidden="true" data-is-switcher="true" data-environment="{&quot;isUserAdmin&quot;:false,&quot;isAppSuggestionAvailable&quot;:false,&quot;isSiteAdminUser&quot;:false}"><div role="application"><div class="app-switcher-loading">Loading&hellip;</div></div></div></div><div class="aui-header-primary"><h1 id="logo" class="bitbucket-header-logo"><a href="https://git.magnolia-cms.com">Bitbucket</a></h1><ul class="aui-nav"></ul></div><div class="aui-header-secondary"><ul class="aui-nav"><li class=" help-link"title="Help"><a class=" aui-dropdown2-trigger aui-dropdown2-trigger-arrowless" aria-controls="com.atlassian.bitbucket.server.bitbucket-server-web-fragments-help-menu" aria-haspopup="true" role="button" tabindex="0" data-aui-trigger><span class="aui-icon aui-icon-small aui-iconfont-question-circle">Help</span><span class="icon aui-icon-dropdown"></span></a><div id="com.atlassian.bitbucket.server.bitbucket-server-web-fragments-help-menu" class="aui-dropdown2 aui-style-default" role="menu" aria-hidden="true"><div role="application"><div class="aui-dropdown2-section help-items-section"><ul class="aui-list-truncate" role="presentation"><li role="presentation"><a href="http://docs.atlassian.com/bitbucketserver/docs-0516/Bitbucket+Server+documentation?utm_campaign=in-app-help&amp;amp;utm_medium=in-app-help&amp;amp;utm_source=stash" title="Go to the online documentation for Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:general-help">Online help</a></li><li role="presentation"><a href="https://www.atlassian.com/git?utm_campaign=learn-git&amp;utm_medium=in-app-help&amp;utm_source=stash" title="Learn about Git commands &amp; workflows" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:learn-git">Learn Git</a></li><li role="presentation"><a href="/getting-started" class="getting-started-page-link" title="Overview of Bitbucket features" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:getting-started-page-help-link">Welcome to Bitbucket</a></li><li role="presentation"><a href="/#" class="keyboard-shortcut-link" title="Discover keyboard shortcuts in Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:keyboard-shortcuts-help-link">Keyboard shortcuts</a></li></ul></div></div></div></li><li class=" alerts-menu"title="View system alerts"><a href="#alerts" id="alerts-trigger" class="alerts-menu" title="View system alerts" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:global-alerts-menu-item">Alerts</a></li></ul></div></div> <!-- End .aui-header-inner --></nav> <!-- End .aui-header --></header><!-- End #header --><!-- Start #content --><section id="content" role="main" tabindex="-1" data-timezone="-60" ><div class="aui-page-panel content-body"><div class="aui-page-panel-inner"><section class="aui-page-panel-content"><h2>Log in</h2><form class="aui top-label prevent-double-submit " action="/j_atl_security_check" method="post" accept-charset="UTF-8"><div class="field-group"><label for="j_username" >Username</label><input class="text long-field" type="text" id="j_username"  name="j_username"  autofocus accesskey="u"/></div><div class="field-group"><label for="j_password" >Password</label><input class="text long-field" type="password" id="j_password"  name="j_password"  accesskey="p"/></div><div class="aui-group"><fieldset class="group checkbox"><div class="checkbox"><input class="checkbox" type="checkbox" id="_atl_remember_me"  name="_atl_remember_me"  checked="checked"  accesskey="r"/><label for="_atl_remember_me" >Keep me logged in</label></div></fieldset></div><div class="aui-group"><input name="next" type="hidden" value="/projects/PLATFORM/repos/main.pub/browse/magnolia-core/src/main/resources/mgnl-nodetypes/magnolia-nodetypes.xml?at=master&amp;raw"/><input name="queryString" type="hidden" value="next=/projects/PLATFORM/repos/main.pub/browse/magnolia-core/src/main/resources/mgnl-nodetypes/magnolia-nodetypes.xml?at%3Dmaster%26raw"/><input class="aui-button aui-button-primary" type="submit" id="submit"  name="submit"  value="Log in" accesskey="s"/><a id="forgot" class="aui-button aui-button-link"  name="forgot" href="/passwordreset" autocomplete="off" tabindex="0">Unable to access your account?</a></div></form></section><!-- .aui-page-panel-content --></div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel --></section><!-- End #content --><!-- Start #footer --><footer id="footer" role="contentinfo"><section class="notifications"></section><section class="footer-body"><ul><li data-key="footer.license.message">Git repository management for enterprise teams powered by <a href="http://www.atlassian.com/software/bitbucket/">Atlassian Bitbucket</a></li></ul><ul><li>Atlassian Bitbucket <span title="0ae31a3266879d333534208d4e6b326678aad9bf" id="product-version" data-commitid="0ae31a3266879d333534208d4e6b326678aad9bf" data-system-build-number="0ae31a3"> v5.16.1</span></li><li data-key="footer.links.documentation"><a href="http://docs.atlassian.com/bitbucketserver/docs-0516/Bitbucket+Server+documentation?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" target="_blank">Documentation</a></li><li data-key="footer.links.contact.support"><a href="https://support.atlassian.com/contact" target="_blank">Contact Support</a></li><li data-key="footer.links.jac"><a href="https://jira.atlassian.com/browse/BSERV" target="_blank">Request a feature</a></li><li data-key="footer.links.about"><a href="/about">About</a></li><li data-key="footer.links.contact.atlassian"><a href="http://www.atlassian.com/company/contact/" target="_blank">Contact Atlassian</a></li></ul><div id="footer-logo"><a href="http://www.atlassian.com/" target="_blank">Atlassian</a></div></section></footer><!-- End #footer --></div><script>require('bitbucket/internal/layout/base/base').onReady(null, "Magnolia Bitbucket" ); require('bitbucket/internal/widget/keyboard-shortcuts/keyboard-shortcuts').onReady();</script><script type="text/javascript">require('bitbucket/internal/page/login/login').onReady();</script></body></html>
These types are required for the basic features of Magnolia to function: configuration, page-editing and rendering as well as activation from author to public (which relies on versioning).

Notation

Description

mgnl:area

Area

mgnl:component

Component

mgnl:content

Activatable and versionable content objects such as pages.

mgnl:contentNode

Activatable but not versionable content objects which can be rendered independently. For example, blocks or objects below page level such as area or component.

mgnl:folder

Folder

mgnl:group

Group

mgnl:metaData

Metadata

mgnl:nodeData

Property

mgnl:page

Page

mgnl:reserve

Reserved for system use.

mgnl:resource

Resource
mgnl:role Role

mgnl:user

User

Mixin node types

Mixin node types specify additional properties or characteristics to the node. A node can have a primary type and several mixin types at the same time. JCR mixins add repository-level functionality such as versioning and locking. Magnolia mixins add content management capabilities such as activating and rendering.

JCR mixin node types

Notation

Description

mix:referenceable Mixin type for referenceable nodes. Provides an auto-created jcr:uuid property that gives the node a unique, referenceable identifier.
mix:versionableMixin type for versionable nodes.
mix:lockableEnables locking capabilities for a node.

Magnolia mixin node types

Notation

Properties

Description

mgnl:deleted

mgnl:deleted (DATE)

mgnl:deletedBy (STRING)

Date the node was deleted, the user who deleted it and the deletion comment.

mgnl:lastModified

mgnl:lastModified (DATE)

mgnl:lastModifiedBy (STRING)

Date the node was last modified and the user who modified it.
mgnl:activatable

mgnl:lastActivated (DATE)

mgnl:lastActivatedBy (STRING)

mgnl:activationStatus (STRING)

mgnl:lastActivatedVersion (STRING)

Date the node was activated, the user who activated it, its current activation status and the version in which the node was activated.


Note that on the public instance, lastActionDate always contains the date of the previous activation, not the current one. This is because the lastActionDate is updated only after the content is sent to the public instance.

mgnl:created

mgnl:created (DATE)

mgnl:createdBy (STRING)

Date the node was created and the user who created it.
mgnl:renderablemgnl:template (STRING)Associates a template with the node for rendering.
mgnl:versionablemgnl:comment (STRING)Allows the user to leave a comment on the version.
mgnl:visitorReferencemgnl:visitorId (STRING)Uniquely identifies a page visitor and the associated site content for the purposes of personal data protection (GDPR).

Same name siblings are not allowed

The Magnolia node type definition magnolia-types.xml  does not allow same name siblings. This means that you cannot have two nodes at the same level in the node hierarchy with the same name. Typically same name siblings is not an issue because Magnolia enforces the constraint automatically during normal usage. However, if prior to Magnolia 5.2 you imported an XML file that was created outside of Magnolia or was edited by hand, it is possible that the XML import created a same name sibling.

Use the siblings.groovy script to find same name siblings in your repository. The example below searches for identically named areas (returnItemType is mgnl:area) in the website workspace under the /travel/about page. See Groovy module for instructions on how to execute Groovy scripts.

siblings.groovy
import info.magnolia.cms.util.QueryUtil;
import info.magnolia.cms.core.search.Query;
import info.magnolia.cms.core.Path;
import info.magnolia.jcr.util.NodeUtil;
import info.magnolia.context.MgnlContext;
import javax.jcr.Session;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import org.apache.commons.lang.StringUtils;
import java.util.LinkedList;
def siblings(workspace,path,returnItemType) {
    query = "/jcr:root" + path + "//* order by @name";  //i.e. path=/travel/about
    try {
        NodeIterator nodes = QueryUtil.search(workspace,query,Query.XPATH,returnItemType);
        
        Session session = MgnlContext.getJCRSession(workspace);
        def siblings = []; 
        while (nodes.hasNext()) {
            Node node = nodes.nextNode();
            nodePath = node.getPath();
            if (StringUtils.contains(nodePath,"[")) {
              println "found same name sibling of '${node.getName()}' at ${nodePath}";
              siblings.add(node);
            }
        }
        siblings.each {
            nodePath = node.getPath();
            newName = Path.getUniqueLabel(session,nodePath,node.getName());
            NodeUtil.renameNode(node,newName);
            println "${nodePath} was renamed to ${newName}";
        }
        session.save();
    } catch (Exception e) {
        println e;
    }
}
//example
siblings("website", "/travel/about", "mgnl:area");

Options from the expandable Groovy script above:

  • workspace: Any Magnolia workspace.
  • path: A valid path in the workspace. / will search for everything under the workspace root.
  • returnItemType: A valid JCR node type. The query goes through all node types but the results are filtered to the node type you specify. Use nt:base as a "wildcard". 

Module-specific node types

The following sections list node types that are provided by individual Magnolia modules. You can define several node types per module if you so require. Almost all the node types added inherit from mgnl:contentNode or mgnl:content.

Categorization module

Defined in  magnolia-category-nodetypes.xml .

Notation

Description

mgnl:categoryAn object containing a category. Inherits from mgnl:content .

Content Editor module

Defined in  content-editor-nodetypes.xml .

Notation

Description

mgnl:blockContent editor block objects containing text, image or similar content. Inherits from mgnl:contentNode and are activatable but not versionable.
mgnl:compositionCompositions are activatable and versionable as a whole and contain ordered subnodes of type mgnl:block.
mgnl:collectionCollection of unordered content editor compositions.

Content Tags module

Defined in  content-tags-nodetypes.xml .

Notation

Description

mgnl:tagAn object containing a content tag. Inherits from mgnl:content .

Marketing Tags module

Defined in  magnolia-tags-nodetypes.xml .

Notation

Description

mgnl:marketing-tagAn object containing a marketing tag. Inherits from mgnl:content .

Password manager module

Defined in  magnolia-keystore-nodetypes.xml .

Notation

Description

mgnl:passwordAn object containing a password. Inherits from mgnl:content .

Personalization module

Notation

Description

mgnl:componentVariantA personalized variant of a component node.

Custom node types

To meet your needs you can define custom content types and with the Magnolia Content Types module you can define them (together with workspaces) also in light modules.

Please read the page Defining JCR node types and workspaces, which provides an overview of all ways to define custom JCR node types and create new workspaces with Magnolia.