diff --git a/src/Geta.Optimizely.Sitemaps/Areas/GetaOptimizelySitemaps/Pages/Shared/_Layout.cshtml b/src/Geta.Optimizely.Sitemaps/Areas/GetaOptimizelySitemaps/Pages/Shared/_Layout.cshtml index 7009b4f6..8c728db1 100644 --- a/src/Geta.Optimizely.Sitemaps/Areas/GetaOptimizelySitemaps/Pages/Shared/_Layout.cshtml +++ b/src/Geta.Optimizely.Sitemaps/Areas/GetaOptimizelySitemaps/Pages/Shared/_Layout.cshtml @@ -70,4 +70,4 @@ @RenderSection("Scripts", required: false) - \ No newline at end of file + diff --git a/src/Geta.Optimizely.Sitemaps/Configuration/SitemapOptions.cs b/src/Geta.Optimizely.Sitemaps/Configuration/SitemapOptions.cs index 5a8320b3..ff38d9df 100644 --- a/src/Geta.Optimizely.Sitemaps/Configuration/SitemapOptions.cs +++ b/src/Geta.Optimizely.Sitemaps/Configuration/SitemapOptions.cs @@ -23,6 +23,8 @@ public class SitemapOptions public Type UriAugmenterService { get; set; } = typeof(DefaultUriAugmenterService); + public int SitemapDataCacheExpirationInMinutes { get; set; } = 60; + public void SetAugmenterService() where T : class, IUriAugmenterService { UriAugmenterService = typeof(T); diff --git a/src/Geta.Optimizely.Sitemaps/Controllers/GetaSitemapController.cs b/src/Geta.Optimizely.Sitemaps/Controllers/GetaSitemapController.cs index b26980ba..9933be17 100644 --- a/src/Geta.Optimizely.Sitemaps/Controllers/GetaSitemapController.cs +++ b/src/Geta.Optimizely.Sitemaps/Controllers/GetaSitemapController.cs @@ -1,4 +1,4 @@ -// Copyright (c) Geta Digital. All rights reserved. +// Copyright (c) Geta Digital. All rights reserved. // Licensed under Apache-2.0. See the LICENSE file in the project root for more information using EPiServer; @@ -112,7 +112,8 @@ private void CacheSitemapData(SitemapData sitemapData, bool isGoogleBot, string ? new CacheEvictionPolicy(TimeSpan.Zero, CacheTimeoutType.Sliding, new[] { _contentCacheKeyCreator.VersionKey }) - : null; + : new CacheEvictionPolicy(TimeSpan.FromMinutes(_configuration.SitemapDataCacheExpirationInMinutes), + CacheTimeoutType.Absolute); CacheManager.Insert(cacheKey, sitemapData.Data, cachePolicy); } diff --git a/src/Geta.Optimizely.Sitemaps/Geta.Optimizely.Sitemaps.Views/Views/Shared/_ShellLayout.cshtml b/src/Geta.Optimizely.Sitemaps/Geta.Optimizely.Sitemaps.Views/Views/Shared/_ShellLayout.cshtml index db8c6002..cb5c213f 100644 --- a/src/Geta.Optimizely.Sitemaps/Geta.Optimizely.Sitemaps.Views/Views/Shared/_ShellLayout.cshtml +++ b/src/Geta.Optimizely.Sitemaps/Geta.Optimizely.Sitemaps.Views/Views/Shared/_ShellLayout.cshtml @@ -19,9 +19,9 @@ @Html.Raw(Html.CreatePlatformNavigationMenu())
+ @RenderBody()
-@RenderBody() diff --git a/src/Geta.Optimizely.Sitemaps/Utils/UrlFilter.cs b/src/Geta.Optimizely.Sitemaps/Utils/UrlFilter.cs index 6e985aed..ee232923 100644 --- a/src/Geta.Optimizely.Sitemaps/Utils/UrlFilter.cs +++ b/src/Geta.Optimizely.Sitemaps/Utils/UrlFilter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Geta Digital. All rights reserved. +// Copyright (c) Geta Digital. All rights reserved. // Licensed under Apache-2.0. See the LICENSE file in the project root for more information using System.Collections.Generic; @@ -49,7 +49,7 @@ private static bool IsPathInUrl(string url, ICollection paths, bool must private static string AddTailingSlash(string url) { - if (url[url.Length - 1] != '/') + if (!string.IsNullOrWhiteSpace(url) && url[url.Length - 1] != '/') { url = url + "/"; }