27 Best Practices for Creating Future Site Preview Assets and Templates

To successfully implement Future Site Preview functionality, content creators must understand how to create sets of time-sensitive assets. Developers must also include the tag that filters assets by date in templates that will display those assets.

This chapter contains the following sections:

27.1 Considerations when Implementing Future Site Preview

Using the Future Site Preview feature, content contributors can preview assets in the Contributor interface as they will appear at a future time. This functionality utilizes asset start date and end date attributes. These two attributes determine the date range that assets are available on the website. Content creators can specify start dates and end dates in Edit screens in the Contributor interface.

The following requirements must be met in order to properly implement the Future Site Preview feature:

27.2 Creating Sets of Assets

When different versions of the same item will be displayed on different dates, content creators need to create multiple assets.

For example, suppose you are creating a page in a website. You want to run a special version of the page for a one-day New Year's Day sale event. You would need three separate assets to accomplish this task. Here is how you would create the one-day sale:

  • Create the regular page asset, setting its end date to the date before the sale day, December 31st 23:59:59.

  • Create the sales event asset, setting the start date to the beginning of the sale day, January 1st 00:00:00, and the end date to the end of the sale day, January 1st 23:59:59.

  • Duplicate the regular page asset, setting the start date to the day after the sale, January 2nd 00:00:00.

After the three assets are created, they can be passed as input to the asset:filterassetsbydate tag (see Section 27.3, "Writing Templates for Future Site Preview" for more information), which will return the asset to render based on the given date.

For ease of use in searching for the related group of assets for editing, publishing, and filtering in templates, we recommend that developers designate an attribute (such as name) which content contributors fill in using a naming convention when creating related sets of time-sensitive assets.

27.3 Writing Templates for Future Site Preview

Appropriate usage of the asset:filterassetsbydate tag is critical to Future Site Preview functionality. This tag filters assets according to a given date. The proper use of this tag is discussed below. More information about the asset:filterassetsbydate tag can be found in the Oracle Fusion Middleware WebCenter Sites Tag Reference.

This section contains the following topics:

27.3.1 The asset:filterassetsbydate tag

The filter tag has the following format:

[date="date value in either yyyy-MM-dd HH:mm:ss OR yyyy-MM-dd format"]>

Notice that the filter tag has two input attributes (inputList and date) and one output attribute (outputList):

  • The inputList attribute specifies the list of assets to be filtered based on the given date.

  • The date attribute is optional. The date attribute is expected to be in either yyyy-MM-dd HH:mm:ss or yyyy-MM-dd format. The date attribute should be coded to accept the date value passed from the date picker in the preview screen (use the __insiteDate variable for this).

  • The tag produces an output list (outputList) which contains assets whose start/end dates enclose the given date.

The tag performs the following steps:

  1. Checks for the cs.sitepreview property to determine if the template is stored on a content management system.

  2. If Future Site Preview is turned off, the system date passes into the date field.

  3. If Future Site Preview is turned on, the tag routine:

    • Disables caching of the current page being rendered (see Caching Considerations for more on caching).

    • Accepts the date parameter (passed from the date picker).

    • Checks for the appropriate format of the date passed into the tag.

    • Filters the input list of assets based on the given date to produce the output list.

27.3.2 The Input List

The asset:filterassetsbydate tag requires the input list to contain two columns named assetid and assettype. This input list can be constructed in a variety of ways.

The simplest way to build the input list, and the way we recommend, is for content contributors to follow a naming convention when filling in the attribute of your choice (usually the name attribute). The list-building code could then be written using the asset:search tag or other similar tags to search that attribute for the agreed upon string and construct the list from the search results.

Another method for locating assets to place into the input list is to use the Recommendation asset type to hold a list of assets of interest.

Whichever method you use to determine the assets that need to be filtered, use the listobject tag to construct the input list for the filter tag, as shown in the sample code below.

This sample code creates a list object inputListName and adds a row containing two columns: assetid and assettype. The listobject:tolist then creates the input list called assetInputList. This list is now ready to be passed as input to the filter tag.

<listobject:create name="inputListName" columns="assetid,assettype" />
<listobject:addrow name="inputListName">
<listobject:argument name="assetid" value='<%=ics.GetVar("assetIdVar")%>' />
<listobject:argument name="assettype" value='<%=ics.GetVar("assetTypeVar")%>' />
<listobject:tolist name="inputListName" listvarname="assetInputList" />

Note that for the sake of simplicity, the code snippet explains the creation of an input list containing only one row. In practice users typically have multiple rows (usually read off from the results of asset:search tag or some other list) added to the list with each row representing an asset that needs to be filtered by a given date.

After creating the input list of assets to be filtered, use the asset:filterassetsbydate tag as follows:

<asset:filterassetsbydate inputList="assetInputList" outputList="assetOutputList" date='<%=ics.GetVar("dateValueVariable")%>' />

To pass input from the Future Site Preview date picker to the date attribute, replace the generic dateValueVariable with _insiteDate.

The tag produces an output list assetOutputList. Read through the list for assets that clear the filter by date test as follows:

<ics:if condition='<%=ics.GetList("assetOutputList")!=null &&     
        <ics:listloop listname=assetOutputList>
        <ics:listget listname=assetOutputList fieldname=assetid output=id />
        <ics:listget listname=assetOutputList fieldname=assettype output=type/>

Perform your usual asset load, asset get and other rendering functions using WebCenter Sites tags here 

27.4 Caching Considerations

In a delivery system, in order for web pages to be displayed appropriately for the current date, asset entries must be removed from the cache at the proper times. Therefore, WebCenter Sites includes start and end dates in the factors it uses to calculate the expiry time for cached pages.


WebCenter Sites does not support the use of start and end dates with Export to Disk publishing. When assets are exported to disk, start and end date attributes are also exported to disk. However, the Export to Disk publishing method has no mechanism similar to the cache cleaning process (which, in other publishing methods, automatically removes expired assets from disk).

On a content management system, when a page is previewed, the asset:filterassetsbydate tag disables page caching for that page. This ensures that the page being served always displays assets filtered by the date being passed from the future preview date picker, rather than serving pages from the page cache, which may have been generated using different date input.