diff --git a/Lombiq.Hosting.MediaTheme.Bridge/Services/FileVersionProviderDecorator.cs b/Lombiq.Hosting.MediaTheme.Bridge/Services/FileVersionProviderDecorator.cs index 444e955..3158616 100644 --- a/Lombiq.Hosting.MediaTheme.Bridge/Services/FileVersionProviderDecorator.cs +++ b/Lombiq.Hosting.MediaTheme.Bridge/Services/FileVersionProviderDecorator.cs @@ -50,7 +50,6 @@ public string AddFileVersionToPath(PathString requestPathBase, string path) var assetsSubPath = _mediaFileStore.Combine( _mediaOption.Value.AssetsRequestPath, Paths.MediaThemeRootFolder, Paths.MediaThemeAssetsFolder); - path = path.Replace(Routes.MediaThemeAssets, assetsSubPath); // Note that this will work all the time for local files. When a remote storage implementation is used to store // Media files though (like Azure Blob Storage) then Media Cache will mirror the files locally. Since this only @@ -60,7 +59,7 @@ public string AddFileVersionToPath(PathString requestPathBase, string path) // then the original file will get stuck, and no cache busting parameter will be added until the new file is // accessed with some other cache busting parameter. So, before the actual cache busting parameter can be added, // we need to add a random parameter. - var cacheBustedPath = _decorated.AddFileVersionToPath(requestPathBase, path); + var cacheBustedPath = _decorated.AddFileVersionToPath(requestPathBase, path.Replace(Routes.MediaThemeAssets, assetsSubPath)); // This check could be more sophisticated with UriBuilder, but let's keep it simple, since it'll run frequently. if (!cacheBustedPath.Contains("?v=")) @@ -68,6 +67,6 @@ public string AddFileVersionToPath(PathString requestPathBase, string path) return QueryHelpers.AddQueryString(path, "mediatheme", _randomizer.Get().ToTechnicalString()); } - return cacheBustedPath; + return cacheBustedPath.Replace(assetsSubPath, Routes.MediaThemeAssets); } } diff --git a/Lombiq.Hosting.MediaTheme/Recipes/Lombiq.Hosting.MediaTheme.Samples.recipe.json b/Lombiq.Hosting.MediaTheme/Recipes/Lombiq.Hosting.MediaTheme.Samples.recipe.json index 81a9ef2..4157d93 100644 --- a/Lombiq.Hosting.MediaTheme/Recipes/Lombiq.Hosting.MediaTheme.Samples.recipe.json +++ b/Lombiq.Hosting.MediaTheme/Recipes/Lombiq.Hosting.MediaTheme.Samples.recipe.json @@ -31,6 +31,10 @@ "SourcePath": "_MediaTheme/Assets/example.png", "TargetPath": "_MediaTheme/Assets/example.png" }, + { + "SourcePath": "_MediaTheme/Assets/example2.png", + "TargetPath": "_MediaTheme/Assets/example2.png" + }, { "SourcePath": "_MediaTheme/Templates/Example.liquid", "TargetPath": "_MediaTheme/Templates/Example.liquid" diff --git a/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Assets/example.png b/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Assets/example.png index 0218b6e..57277f6 100644 Binary files a/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Assets/example.png and b/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Assets/example.png differ diff --git a/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Assets/example2.png b/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Assets/example2.png new file mode 100644 index 0000000..1b8e084 Binary files /dev/null and b/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Assets/example2.png differ diff --git a/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Templates/Example.liquid b/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Templates/Example.liquid index ff96a00..19cb32a 100644 --- a/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Templates/Example.liquid +++ b/Lombiq.Hosting.MediaTheme/Recipes/_MediaTheme/Templates/Example.liquid @@ -1,3 +1,9 @@

This is an example template hosted in Media Theme.

Below is an image also hosted in Media Theme:

+{% comment %} +The images are from https://unsplash.com/. +{% endcomment %} example + +example2 +