Skip to content

Fixed tailing slash index check, added caching timeout and fixed scro… #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
<script src="/_content/GetaOptimizelySitemaps/js/dashboard.js"></script>
@RenderSection("Scripts", required: false)
</body>
</html>
</html>
2 changes: 2 additions & 0 deletions src/Geta.Optimizely.Sitemaps/Configuration/SitemapOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class SitemapOptions

public Type UriAugmenterService { get; set; } = typeof(DefaultUriAugmenterService);

public int SitemapDataCacheExpirationInMinutes { get; set; } = 60;

public void SetAugmenterService<T>() where T : class, IUriAugmenterService
{
UriAugmenterService = typeof(T);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
@Html.Raw(Html.CreatePlatformNavigationMenu())
<noscript>You need to enable JavaScript to run this app.</noscript>
<div @Html.Raw(Html.ApplyPlatformNavigation()) style="z-index:auto;">
@RenderBody()
</div>

@RenderBody()
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
Expand Down
4 changes: 2 additions & 2 deletions src/Geta.Optimizely.Sitemaps/Utils/UrlFilter.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -49,7 +49,7 @@ private static bool IsPathInUrl(string url, ICollection<string> paths, bool must

private static string AddTailingSlash(string url)
{
if (url[url.Length - 1] != '/')
if (!string.IsNullOrWhiteSpace(url) && url[url.Length - 1] != '/')
{
url = url + "/";
}
Expand Down
Loading