Configuring Live Copy
Assign live copy admins
Live Copies enable editors to create copies of content anywhere, on other sites.
While this is very powerful, it doesn’t copy content permissions (or restrictions) as configured by roles and access control lists (ACLs).
Since Live Copy 4.0.2
, only users with the livecopy-admin role may create and update live copies (i.e., propagate master changes).
Users with this role are responsible for maintaining consistency of access control, in combination with live copies, and should have visibility over the entire workspace.
To assign this role to a user:
-
Open the Security app.
-
Edit an existing user or add a new one.
-
Go to the Roles tab.
-
Select the
livecopy-admin
role on the left side of the table. -
Click > to grant it to the user.
-
Save changes.
Create live copy site definition
Coordinate with your authors to create a matching site definition for any live copy sites they create.
Go to Configuring a site definition to create a new one for your live copy. Duplicate the master site by making a copy in the Configuration app or a light module folder.
Internationalization
This section describes how to configure i18n for your live copy site.
In this example, we make a live copy of the Magnolia Travel demo. The master is in English and German. We want the live copy to be in German only.
-
Create a live copy of your master site.
-
Go to your master site definition in the Resource Files app.
-
Create a copy of the master site definition.
In this example, we create a live copy of the
travel-demo
site. Therefore, we create a copy of thetravel-demo
site definition yaml file,travel.yaml
. -
Decorate
livecopy/config.yaml
to change the i18n authoring support type from the defaultmultisite
tolivecopy_multisite
:i18nAuthoringSupportType: livecopy_multisite
-
Edit the live copy site definition as follows:
travel-demo/sites/travel0.yamldomains: travel-demo: name: travel0-demo.magnolia-cms.com (1) mappings: website: URIPrefix: '' handlePrefix: /travel0 (1) repository: website templates: class: info.magnolia.module.site.templates.ReferencingPrototypeTemplateSettings prototypeId: travel-demo:pages/prototype availability: templates: home: id: travel-demo:pages/home standard: id: travel-demo:pages/standard searchResultPage: id: travel-demo:pages/searchResultPage pur: id: travel-demo:pages/pur enableAllWithRenderType: freemarker: freemarker spa: spa theme: name: travel-demo-theme i18n: class: info.magnolia.livecopy.i18n.LiveCopyI18nContentSupport (2) enabled: true fallbackLocale: de (3) locales: (4) de: enabled: true languageTag: de
1 Update the domain and mappings to match the live copy name. 2 Change the i18n class to info.magnolia.livecopy.i18n.LiveCopyI18nContentSupport 3 Change the fallback locale to de
(German).4 Delete the other locales and only leave de
.When the author now opens a live copy page, the language switcher does not appear at the bottom of the page and the content presented is the German version.
About locales
Locales are display languages on Magnolia instances.
When you create a live copy of your page, the new page (live copy) adopts the same structure as the original (master).
This means that the locales
of the master site definition are used to define the structure of both the master and live copy pages.
The fallbackLocale
defines which language is used by default from the available locales and which content is served if the content is not available for the current locale.
You can read the Language configuration page for information about defining available locales, and the Internationalization page for more information about translated user interface texts (see examples in the table below).
Master | Live copy |
---|---|
title = Hello world |
title = Hello world |
title_de = Hallo Welt |
title_de = Hallo Welt |
Defining fallbackLocale does not affect the structure of the live copy or the master pages. For example, defining this property as de is like stating that the content of the live copy page will be rendered in the German locale by default when first loaded.
|
Create live copy action
You can configure the following for the Create live copy action:
-
Parallel or sequential creation
Allow users to create multiple live copies in parallel, or block the action (and the push changes actions) to prevent new creations once a creation operation has started. By default, live copy creation is set to run sequentially for performance reasons.
-
Child node copying
Allow users to create live copies of child nodes even when the parent node is already being copied. By default, users can’t create live copies of child nodes if the parent node is being copied.
IsLiveCopyRunningRule:
class: info.magnolia.livecopy.app.availability.IsLiveCopyRunningRuleDefinition
parallel: false (1)
recursive: true (2)
1 | The parallel property from info.magnolia.livecopy.app.availability.IsLiveCopyRunningRuleDefinition, set to false by default.
Once a create live copy action starts, you can’t perform any additional creation or push changes operations until it is complete.
Set to |
2 | The recursive property from info.magnolia.livecopy.app.availability.IsLiveCopyRunningRuleDefinition, set to true by default.
When the create live copy action is triggered for a parent node, both the node and its children are locked, making the action unavailable until the parent node live copy creation completes.
Set to |
Enable content deletion without protecting pages from master updates
Suppose your authors want to delete content, such as a specific component, from a live copy page but they don’t want to protect the whole page from master changes. In this case, what happens is the deleted content is added again when they push the master page.
To work around the content being added to the page again, you can add a no rendering option to the respective master component using an if
condition in its FTL file (example shown below).
[#if "${content.headline}" != "hide"]
<div class="card">
<h1>${content.headline}</h1>
[#assign myAsset = damfn.getAsset("jcr","/an-asset.jpg")!]
[#if myAsset??]
<img src="${myAsset.getLink()}" width="300px"/>
[/#if]
<p class="artwork_title">${content.text}</p>
[#assign myAssetLink = damfn.getAssetLink("jcr:20f53452-7e37-4e1b-b10d-c085a703809d")!]
<p class="webapp_link">${myAssetLink}</p>
<p class="webapp_link">${content.pageLink}</p>
</div>
[/#if]