Using Live Copy

Live Copy enables you to create one or more copies of a master website. The master can be an entire site, a sub-tree or just a single page.

Because the copies created remain linked to the master version, any changes you make to the master version can be pushed to the copies too.

If you want some of your content in the copied sites to be different, you can add new, local content or protect the initial content copied over from further changes and edit it to suit your requirements.

As a lot of content can be copied and linked, a single wrong action can have a negative impact on a big part of your website.

Plan your content structure in detail before using Live Copy.

Useful terms

There are some specific terms used in the context of live copy:

  • Master - The original source of the content you copy.

  • Live copy - A copy of the master produced by clicking the Create live copy action. Initially, a live copy is a simple replica of the master.

  • Relink - When you create a Live Copy site, its links still point to the Master site. To point the links to your Live copy site, use the Relink action.

  • Push - Sends changes made in the Master version to the Live Copy versions without publishing the affected pages.

  • Push and publish - Like the Push action but also triggers the publication workflow for the affected pages. Note that your content is not actually published, depending on your publication workflow; the process is only initiated.

Good to know before you start

There are a couple of things regarding pushing content to live copies and managing their associated links that are good to know before starting.

  • Suppose you delete content in a live copy without protecting it from master content changes. In that case, the deleted content will be added again when the master content is pushed. One workaround is to 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","/6-2_good-to-knows.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]
  • If you copy a component from one page to another, please remember that any associated link will still point to the page it was linked to before the copy. Managing links in live copy is described here. image

High level steps

This section provides a summary of the steps involved in using Live Copy. Detailed instructions on each step are then provided below.

Create the live copy and corresponding site definition
  • Identify the content you want to copy in the Pages app and create a live copy.

  • Create a site definition for your live copy site.

With the live copy and the site definition created, your authoring experience with Live Copy starts.

Make global changes affecting all of your sites
  • Edit the desired content on the master site.

  • When the new content is finalized, push the changes to your live copy sites.

    Your live copies will then reflect the new content from Master

At this stage, your changes are not yet published.
Protect local content you don’t want updated

You may decide that some content on your live copy sites should be protected from master site updates.

Example: you don’t want your Contact Us page, or component, to be changed because the content is specific to your branch or region.

  • In your live copy, edit the content to match your local requirements.

  • Protect any pages, individual components or fields that should not be updated with content from master using the Disable updates from master actions.

  • New master content changes pushed to the live copies don’t affect your local content when it is protected.

Manage links

When you create a Live Copy site, its links still point back to the Master site.

Often this is not the required behavior. This is why both the Push and Push and publish actions have an Automatically relink option selected by default.

  • Keep the Automatically relink option selected to ensure the live copy links point to the relevant live copy content.

  • If you want the live copy links to point back to master, deselect the Automatically relink option when pushing updates.

Later, you can also manage the Relinking behavior from the action bar.

Creating a live copy

To create a live copy:

  1. Open the Pages app.

  2. Select the site/tree/page you want to copy.

  3. Click Create live copy in the action bar.

  4. Choose a location for the live copy in the Choose page location dialog.

  5. Optionally, you can clear the default Automatically relink checkbox. However, in most cases, having links in the live copy site point to target links within it and not to the master site is what you want.

    Automatically relink by default

    Relinking can also be done on the Pages app’s action bar via the Relink all pages to live copy pages action or when new changes are pushed.
  6. Finally, create a matching site definition for your freshly created live copy site.

In the Live Copy column of the Pages app, the two sites are indicated using an icon:

Master Live Copy

image

image

Note that the newly created live copy site follows the same naming conventions as the standard copy action. For example, if your master site is named travel, then the new live copy site is named travel0, if it is called Route-66, then the live copy is named Route-67.

We recommend you rename the live copy site.

image

You can copy just a sub-tree or a single page instead of a whole site.

You have to select the correct location for the copy in the chooser. Initially the choice is limited to the root.

If you have several existing live copies and are copying a new subpage from the master, for example, you have more locations available.

Creating live copy subpages

If you have added a new page to a master site, you must create a live copy of the new page so that its equivalent exists in the live copy site before you can push master changes to it.

Newly created pages are not added automatically to a live copy upon pushing master changes.

If several live copies of a master exist, when you create a live copy of the subpage(s), you can choose where to locate the new subpage live copy.

The live copy or copies are created in each location specified.

Navigating between master and live copy

You can:

  • Jump from a live copy page to the corresponding master page.

    To do so, open the live copy page and click Open master page in the action bar.

    The master page opens in a new tab. To be able to see this action, make sure you don’t have a component selected in the page.

  • View live copies from a master page. To do so, select a master page in the app browser view and click Show linked live copy pages in the action bar.

    A dialog opens listing the live copy or copies corresponding to the selected master. You can choose to Open them in tabs or Show in browser (they are highlighted in the browser).

    image

Typically, your master site contains links that are internal to the master site. The links in your newly created live copy site will still point to that master content.

This can be desirable in some situations. However, in many scenarios, the links should point to pages in the live copy site.

To automatically change the links so that they point to within your live copy site, select the live copy page(s) and click Relink all pages to live copy pages.

Make sure the corresponding pages in the live copy exist so that the links can be relinked within the live copy.

image

In the Relink all pages popup that appears, you have the option of disabling updates from master on components that are relinked. This means the relinked live copy pages are protected from being overwritten when new content is pushed from the master. The relinked components appear as locked in the live copy pages. For example:

image

Links in the page properties (added via the Page Properties dialog) are relinked too.

Note about transformers

For compatibility fields (before 6.2.3) that still use (deprecated) transformer classes, only the following default transformers are supported:

  • Composite field: info.magnolia.ui.form.field.transformer.composite.CompositeTransformer

  • Switchable field: info.magnolia.ui.form.field.transformer.composite.SwitchableTransformer

  • Multivalue field: info.magnolia.ui.form.field.transformer.multi.MultiValueTransformer

  • Multivalue composite field: info.magnolia.ui.form.field.transformer.multi.MultiValueSubChildrenNodePropertiesTransformer

For example, if you have a link field inside a composite field, the relink function only works if the composite field’s transformer class is CompositeTransformer.

Pushing changes from master to live copy pages (and publishing)

When you change content on your master page and want to push your changes to a matching live copy page, use the Push master changes or Push master changes incl. subnodes actions.

In the Push master content changes dialog that appears, select the live copy or copies you want to push changes to. You can push your changes to the live copy pages with the Push button or push your changes and publish your live copy pages in one operation with the Push and publish button.

Use the Automatically relink option to automatically relink all links in the live copy so that they point to within your live copy site, instead of pointing to the master site, if required.

image

Push

When you click Push, the content in the live copy is updated as follows:

  1. Content, including personalized content – This includes page properties, component ordering, added and/or removed components.

  2. Page position – If a child page in the master site is moved to a different location, then the equivalent live copy child page is moved too.

  3. Page variants.

  4. Page links – Depending on the Automatically relink option.

If you have added a new page to the master site, you must create a live copy of the new page to create it in the copied site before you can push master changes to it. Newly created pages are not added automatically upon pushing master changes.

If you have deleted a page from the master site, you must delete the equivalent live copy page too if required. Pushing master changes with or without including subnodes does not delete pages from the live copy.

Push and publish

When you click Push and publish, a second step in the dialog opens where you can add a comment and schedule a date and time for the publication task for your live copy pages.

image

When you click Push & publish now, the content in the live copies is updated as described above and the publication workflow is triggered for your live copy pages.

When you create a live copy from a master, the master is set to modified. You can see the publication status goes from green to yellow in the Pages app browser. Live copies are not published upon creation; you must publish them individually using the standard Publish action or when pushing changes from master.

Protecting content from master content changes

Components within a live copy page are marked with an extra icon: image. This helps you to differentiate between live copy content and unlinked content.

You may not want all the content in your live copy pages to be overwritten when master changes are pushed. You can protect the content in whole pages, components or selected fields.

Full pages

To protect a full page, select the live copy page and click Disable updates from master.

The page is marked with an unlinked icon in the Pages app browser: image

This breaks the link between the master and the live copy, but you can reattach it if you need to.

Components

To protect a component, edit the page, select the component, and click Disable updates from master.

The component bar changes to white and is marked with an unlinked icon:

image

When you disable updates from master, the component node is flagged with liveCopyReferenceDropped = true (visible to developers in the JCR Browser app) and the color of the component bar changes to white.

When you only protect some fields within a component, the propertiesToIgnore flag is set in the array of field names (visible to developers in the JCR Browser app) and the color of the component bar remains green.

In the case of complex components with many fields within fields, note that all the nodes are protected when updates are disabled from master.

For example, if a contact component has multiple fields and subfields as part of an address, the component node is locked and each individual field node is also locked to ensure they are not overwritten by content from the master:

  • /live-copy/multi-page/contact/0 — The component itself

  • /live-copy/multi-page/contact/0/multi0 — A complex field in the component

  • /live-copy/multi-page/contact/0/multi0/address — A subfield within the complex field

Fields in a component

To protect a field within a component, edit the component then click on the protect field icon next to the fields that should not be overwritten by your master content.

image

The red icon in the screenshot above indicates that the field is not linked to the master content. It is protected.

The grey and white icon indicates that the field is linked to the master content.

When only one or some of the fields in a component are locked, the propertiesToIgnore flag is set in the array of field names (visible to developers in the JCR Browser app) and the color of the component bar remains green.

You can protect a field in one language and not another by switching the language and then clicking on the protect field icon.

Breaking and reattaching

You can break the link between the master and the live copy pages.

The linking of live copy pages to master content is done using a page property called masterContentIdentifier. You can see this property in the JCR Browser or via content export.

To break this link, select a page and click Disable updates from master. After confirmation, the page no longer receives updates from the master page.

Breaking the link to master content is achieved through a page property called liveCopyReferenceDropped. When this flag is set to true, the linking of content is turned off.

However, the masterContentIdentifier still remains and the content can be re-linked at any time. To reattach the live copy content to the master content, click Enable updates from master.

Deleting the master

If you delete the master, a warning appears to confirm deletion. The warning gives a list of linked pages that may be affected. Once the master is deleted, any of its previously created live copies can then be used as masters.

Feedback