If I ever change anything with my theme, take out a base theme, remove a script, etc., if I publish, it doesn't update on the website. It isn't even reflecting in EE. Then sometimes randomly if I come back to my website the next day, my changes are now there. I'm at a loss why Sitecore is exhibiting this weird behavior. It is happening on my local environment which doesn't have separate CM and CD sites, but it is also happening on the server, and it does have separate sites. Publishing the site does not fix the issue.
1 Answer
I assume that during publish the changes are correctly saved into the web database and the cache is cleared correctly.
If you have Sitecore version 9.3 or less I think this is happening due to the caching issue from file generated by the Sitecore cli gulp task. The BuildAssetPath function is using the Sitecore.XA.Foundation.SitecoreExtensions.Templates.Statistics.Fields.__Created
field to
build the versioning, which never changes.
public static string BuildAssetPath(this Item item, bool addTimestamp = false)
{
MediaItem mediaItem = MediaItem.op_Implicit(item);
MediaUrlOptions mediaUrlOptions = new MediaUrlOptions();
mediaUrlOptions.set_Thumbnail(true);
string str1 = MediaManager.GetMediaUrl(mediaItem, mediaUrlOptions).Replace("&thn=1", string.Empty).Replace("?thn=1&", "?").Replace("?thn=1", string.Empty);
string str2 = str1.Contains("://") ? str1 : StringUtil.EnsurePrefix('/', str1);
if (addTimestamp)
str2 = str2 + "?t=" + ((BaseItem) item).get_Item(Sitecore.XA.Foundation.SitecoreExtensions.Templates.Statistics.Fields.__Created);
return str2;
}
Can you try to see if after changing the Create date in sitecore on the theme the changes appear on the website?