Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.
Reusing content in more than one location on a website is a common scenario. The objective is to either render the same page in multiple locations or the same component on multiple pages.
Common content should be editable in one location and changes should propagate to affiliate sites immediately. Links pointing to other pages should continue to work when content is reused away from its original context. The content should adhere to the target site theme and pages should appear in navigation when rendered on target site.
The following approach retrieves content from the source page
main area and renders it in the target page
This example is NOT a complete solution. It is just a starting point for your own customization.
To configure a reuse page template:
stkReusein any folder, for example in
/functional. You can copy and amend a current dialog, for example
sourcePage. The control will save the source page UUID to a property of the same name.
mainarea in the new template and shows how to use the stored value of the UUID link control to render the selected page content.
stkReuse. You can copy and amend
Reuseso you can identify the new template in Website.
/areas/mainnode so that it contains only the following two properties:
standard-templating-kit:functional/stkReuse. Created in 1.
/templating-kit/pages/functional/reuse.ftl, Created in 2.
/default/templates/availability/templatesmake the new template available to all sites:
/stkReuseadd a data node
idand set the value to
Download the configuration used in this example as XML files:
stkReusetemplate to the target page.
main area of the source page is rendered in the target page
Reusing components can be done with inheritable components. This functionality is built in the STK. Inheritance is enabled on an area level in the
/areas node of the template definition. There are two options:
The limitation is that configured inheritance works only down a particular branch of the site. Inheriting a component from another branch or from a different site needs a custom solution.
Example usage: A sports news website is running special coverage on the upcoming Formula One Grand Prix. Site editors want to display a team standings component in the sidebar. Editors want to edit the component in once place and have it displayed on multiple pages, not all of which are in the same branch.
The recommended approach is to store and edit reusable component content in a separate website structure that is not visible on a public instance. This can be a branch within the same site or a completely different site root. Storing the reusable content in the Data module is also possible.
Following the example of Reusing pages above, create a:
A control that invokes the can be added to a dialog. Components are represented as numbered content nodes under the page area nodes, allowing for a specific component to be selected. In the example below, the page area
/demo-project/news-and-events/news-overview/news01/content has two components denoted as