LESSON 3: Setting an expiration time
This tutorial explains how to add an expiration time to a Web Slice.
Expiration is appropriate if the content in the Web Slice may not be relevant after a certain date and time. For example, the ticket auction ends at a certain time, after which the auction will close and there will not be any more updates.
An expiration time is expressed with the following attributes:
- class="endtime" - Signifies that this is an expiration element.
- title="__UTC_Format__" - The title attribute contains the expiration date and time in Universal Time Code (UTC) format.
The following is an example of the hAtom abbr design pattern used to encode the expiration date and time.
<abbr class="endtime" title="2008-04-29T17:50:00-08:00"></abbr>
UTC time is expressed in relation to Greenwich Mean Time (GMT). If today was March 5, 2008 at 5:35 p.m. in Las Vegas, then that could be expressed as "2008-03-05T17:35:00-08:00." The time is written in 24 hour time and the -08:00 indicates that the time zone is eight hours behind GMT.
Add an expiration time to the ticket auction Web Slice
A few things to remember:
- Select an expiration time very close to now so that you can view the Web Slice before and after it expires.
- The title of a Web Slice that is about to expire turns bold and italic, as shown below.
- Once the content has expired, the Web Slice title turns grey. Users can still click through to the Web page where the Web Slice originated.
- Use the abbr design pattern to add an expiration date to your Web Slice.
- Express the date and time in UTC format.
Check your work
Confirm that your expiration value was correctly added to the Web Slice by viewing the feed source.
- Open your Feeds list in the Favorites Center (Ctrl+J).
- Click the feed with the title of your Web Slice.
- Right-click on the feed reader page, and select View source from the option menu.
- Search for a tag called mon:expiration. If you don't see this tag, then your expiration value was not accepted.
If you are having any trouble, you can view the example implementation in Source Listing #3.
Go forward to LESSON 4: Setting a time-to-live (TTL) value