Time Machine

Last Updated: Mar 5, 2024
documentation for the dotCMS Content Management System
Deprecated

 

The Time Machine feature is now considered deprecated. The future-focused section of the Time Machine feature is planned to be moved to Page scope, via the editor, while past snapshots will eventually be removed altogether. To preserve static snapshots of existing Sites, we recommend using static push-publishing.

The Time Machine allows you to browse snapshots of how a site has looked historically, or to view how a site will look in the future based on scheduled content publishing and expiration dates.

Using the Time Machine

To use the Time Machine, you must select the time you want to view, and the Language version of the site you want to view.

Once you have selected the time and the Language, a fully browsable version of your site will be displayed. You will be able to navigate through this version of your site and use it in almost all ways you would be able to use your regular (front-end) site.

Selecting the Time

You may view your site as it looked at a specific time in the Past, or as it will look on a given date in the Future.

  • When selecting a time in the Past, you may only select from times when you created Snapshots of your site.
    • If you have not yet created any Snapshots, you will not be able to view a past version of your site.
  • When selecting a time in the Future, you may select any future date (but not a specific time on that date).
    • The site will display all content that will be published on the specified future date (taking into account any Publish Date and Unpublish Date fields set in any of your Content Types).

Selecting the Language

If you have selected a Future snapshot, you may select any Language defined on your site. If you have selected a Past snapshot, you may select any language which was included when the Snapshot you have selected was created. If you wish to be able to view non-Default Language versions of your site in the Time Machine, you must make sure to include those Languages when creating your Snapshots.

Snapshots

To be able to view a Past version of your site, you must take a Snapshot of your site at the time. A Snapshot creates a copy of your site at the present time, allowing you to view it later. You may schedule to have Snapshots of your site taken automatically at regular intervals.

A Snapshot is a static copy of your site, which is saved on the server as a bundle. The bundle contains static versions of all pages and content on the site (the HTML is all fully generated before being saved in the Snapshot).

Note that the Snapshot of your site is static, meaning code is not dynamically generated as it is on a live site. However the Snapshot site is still fully functional, so once you have saved a Snapshot, the Time Machine bundle can then be used to run a static copy of your site on a web server other than dotCMS. Multiple snapshots can be taken for each given host.

Please see the Time Machine Snapshots documentation for more information on how to schedule static Snapshots.

Identifying When the Time Machine Generates a Snapshot

When the Time Machine is accessing your page to create a Snapshot, it will set the User-agent header in the request to DOTCMS-TIMEMACHINE. This means that if you want your pages to behave in a specific way (such as serving specific content) when the Time Machine queries and reads your page, you can check the User-agent request header using Velocity code, and set the behavior and content appropriately.

The following code segment demonstrates how to access the User-Agent header from your Velocity code:

#if ($request.getHeader("User-Agent") == "DOTCMS-TIMEMACHINE")
    ##Behavior when Time Machine is accessing the page...
#else
    ##Normal behavior (when users access the page from a browser)...
#end

Note: The User-agent request header can also be used to determine what type of browser and platform a user is running when accessing your site, to serve up different versions of your site for different platforms. However dotCMS provides a more powerful and simple solution; for more information, please see the User Agent Viewtool documentation.

Video: dotCMS Time Machine

On this page

×

We Dig Feedback

Selected excerpt:

×