Sharing content across sites

October 8, 2024

System site and system templates

The system site is a special site containing all content shared across all other sites. It is created by Jahia and cannot be deleted.

The system site uses a special set of templates named templates-system. This set contains different templates for browsing and viewing content. If a template cannot be found in a site, the templates-system will be used as a fallback if available.

It also contains all templates for user profile (user) and settings (user-edit-details), start page (user-home). See profile documentation to see about user profiles templates organization.

Shared content

Shared content can be created in the system site, under /sites/systemsite/contents . One easy wat to create content here is to use the content browsing templates in contribute mode, browsing at :

  http://<server>/cms/contribute/default/en/sites/systemsite/contents.html

contribute-test-folder.png

Applications that require content to be shared can store components in contents folder, under a specific sub folder. For example, the MyPortal application stores all components available for the portal in the system site shared content folder under portal-components .

Shared files

Shared files can be stored in /sites/systemsite/files.

Categories

Jahia Category tree is stored in the system site, under /sites/systemsite/categories. This tree is edited with the category manager.

User profile

Information related to user profiles are stored in the system site.

MySpace module

These modules extends the My space pages by adding new information and features.

My space structure

The My space page is a set of templates deployed in the system site, that can be applied on any user node. They are organized under /base/user-base template :

templates
  +-base
     +-user-base
       +-user-home
       +-user-content
       +-user-content-manager
       +-user-edit-details
       +-user-sites
       +-user-tasks

The user-home template is available with the http://server/start shortcut, which redirects to http://server/cms/en/users/username.user-home.html

The user-base template provides the skeleton of the user pages :


Templates under user-base have 3 areas available :

  • pagecontent : the main area, in the center of the page
  • user-profile-aside-left : area under the "My space" links
  • user-profile-aside-right : area under the "My web projects shortcuts"

The navigation menu on the left is not hardcoded in the user-base template - it's actually a reference to a content folder located in the system site, in /contents/profile-page-items . This allows to add dynamically new items in the menu.

Creating a My space module

A My space module can be created by using the maven archetype (see module development or by using the studio.

A My space module will add new templates to the system site to add new features. In order to stay in the My space skeleton, the module needs to deploy its templates under /base/user-base. This is done by setting the value of j:rootTemplatePath to /base/user-base.

The module can only be deployed on the system site : the value of j:dependencies is set to templates-system.

It's also useful to add a link to the new templates in the navigation bar on the left - this is done by creating a new node jnt:componentLink into the list /contents/profile-page-items .

So a basic myspace module will look like :

  <templateSets jcr:primaryType="jnt:templateSets">

    <contents jcr:primaryType="jnt:contentFolder">
      <profile-page-items jcr:primaryType="jnt:contentFolder">
          <mymodule jcr:primaryType="jnt:componentLink"
                               targetTemplate="user-mytemplate"/>
      </profile-page-items>
    </contents>

    <mymodule j:dependencies="templates-system" j:installedModules="bookmarks" j:siteType="profileModule" jcr:primaryType="jnt:virtualsite">
      <templates j:rootTemplatePath="/base/user-base" jcr:primaryType="jnt:templatesFolder">
        <user-mytemplate j:applyOn="jnt:user" j:defaultTemplate="false" jcr:primaryType="jnt:contentTemplate">
          <pagecontent jcr:primaryType="jnt:contentList">
            ... my components ...
          </pagecontent>
        </user-mytemplate>
      </templates>
    </mymodule>

  </templateSets>