Recently been looking through some optimisation techneques for our websites.
I noticed that the last modified date was always incorrect. As this could affect caching etc, I decided to apply a quick fix. As our code is in MVC the physical pages themselves may not get changed, so the modified date being used is misleading even if it used the file modified date.
This can be added into the global.asax PreSendRequestHeaders
if (Sitecore.Context.Item != null)
{
Response.Headers.Remove("Last-Modified");
Response.Headers.Add("Last-Modified", Sitecore.Context.Database.GetItem(Sitecore.Context.Item.ID).Statistics.Updated.Date.ToString());
}
This will allow you to apply a modified date of your choice.
The affect we want is for the pages to accurately reflect when the relative sitecore item is updated.
Hope this helps.
No comments:
Post a Comment