Time warp in AEM 6.3+
Credentials : guest/guest
Scenario: View changes on page based on time.
1. Page viewed at October 24th 2018 (Observe that there are 4 products)
2. Page viewed at October 23rd 2018 (Observe that there are 6 products)
How is this achievable? Timewarp. What is it?
Timewarp is a feature introduced in AEM 6.3 where author can quickly look at prior versions of the pages. It is designed to view the page (only published) at specific times in the past. Time warp allows author to track the published website at the selected point in time. This uses the page versions to determine the state of the publish environment. So, the intermediate changes have to be saved as Versions. In general, Time warp will look only for published pages. But, if no published version is found, then Time warp will revert to the current state of the page on the author environment (this is to prevent an error/404 page, which would prevent browsing).
Using Time warp mode to preview pages
Time warp is one of the modes of a page like edit, design, layout etc. To start it, author can got to editor version of the page and simply switch to “Time warp” as in drop down below.
On changing to Timewarp mode, popup will appear to set the target date and time. We need to set this and click or tap Set Date. The page at particular time will be previewed. If you do not select a time, the current time will default.
On selecting the date and time, a blue status bar will appear at the top of the window. Status bar will contain links to select a new target date or exit Timewarp mode.
“Set Date” will bring up the Timewarp dialog to set the desired time and date and Exit Timewarp will exit from the current Timewarp mode into Edit mode. Note: We can only preview the page in Timewarp mode. If author wants to edit the page, it has to be restored and then edited.
Creating new versions of pages.
There are two ways of creating page versions:
Option -1: Creating from Timeline column
1) Go to sites and navigate to page for which version has to be created2) Select/Tab the page in selection mode and open the Timeline column in left rail.
3) Click/tap on the arrowhead by the comment field, this will provide option to Save as version. On clicking “Save as version”, author can provide Label and Comment to save the version of a page.
4) On clicking Save as Version, popup will appear to provide a Label and Comment if required. Click on “Create” button to create a version of page at that time. 5) On creating version, timeline will be updated to indicate the new version.
Option-2: Creating by selecting a resource
1. Go to sites and navigate to page for which version has to be created.2. Select/Tab the page in selection mode and click on Create option from the toolbar.
3. The dialog will appear to provide a Label and Comment if required. Click on “Create” button to create a version of page at that time.
4. On creating version, timeline will be updated to indicate the new version.
Viewing different versions of page.
There are two ways of viewing page versions: Option -1: 1. Open page in editor view and change to Timewarp mode.
2. Click on Timewarp and select the appropriate date and time to preview the page at that time in history.
3. As we change our dates, it will be pulling the closest version of the page. Current version is not technically stored as a version with in AEM and therefore timer goes back and checks the closest version and displays this version. 4. If we set time to sometime before the page got created, it will show the current version the page. Option -2 1. Navigate to the page to be previewed in selection mode and then, expand the timeline column on left. 2. Select either Show All or Versions. The page versions for the selected page will be listed.
3. Click on the version to be previewed and then on “Preview” button to view the page at that particular version/time.
Restoring/Comparing an old version of a page.
1. Navigate to the page to be previewed in selection mode and then, expand the timeline column on left. 2. Select either Show All or Versions. The page versions for the selected page will be listed. 3. Click on the desired version. There will be 3 options –
Preview – To preview the page at versioned time.
Compare to Current - To see the changes from the versioned page to the current page. The page diff will open and display the differences.
Revert to this Version – To revert the current page and restore the page at particular version or time.
4. Timeline will be updated if a version is restored.
Numbering of versions
1. When we create a version of any page, the initial labels and version node names will be 1.0, 1.1, 1.2 and so forth. 2. When a version is restored i.e. 1.0 and then new version is created, the generated labels and node names will now be 1.0.0, 1.0.1, 1.0.2, etc.
Some content doesn’t retain as part of page versions.
1. Timewarp will only know what is happening in that page, it doesn’t know what happened in referenced images or any other dam assets. - If image is rotated in dam, it will automatically gets rotated in versioned page. 2. If we cancel inheritance and change the tags associated with a page, this will not be retained with the versions because it is saved under template level. Even though we add some tags late, it will appear across versions. 3. All the reference content will be latest one, only the content of q:page will be retained in versions. 4. If elements (such as code, css, assets/images, etc) for rendering the website have changed, the view will differ from what it originally was, as those items are not versioned in the repository.
The Out-of-the-box Clientlibs behind Timewarp functionality?