diff --git a/src/SeoToolkit.Umbraco.Sitemap.Core/Common/SitemapGenerators/SitemapGenerator.cs b/src/SeoToolkit.Umbraco.Sitemap.Core/Common/SitemapGenerators/SitemapGenerator.cs index a813bb08..3e189216 100644 --- a/src/SeoToolkit.Umbraco.Sitemap.Core/Common/SitemapGenerators/SitemapGenerator.cs +++ b/src/SeoToolkit.Umbraco.Sitemap.Core/Common/SitemapGenerators/SitemapGenerator.cs @@ -178,7 +178,7 @@ private IEnumerable ToXmlElements(IEnumerable nodes) var selfItem = new XElement(_namespace + "url"); selfItem.Add(new XElement(_namespace + "loc", node.Url)); if (node.LastModifiedDate != null) - selfItem.Add(new XElement(_namespace + "lastmod", node.LastModifiedDate.Value.ToString("yyyy-MM-dd"))); + selfItem.Add(new XElement(_namespace + "lastmod", node.LastModifiedDate.Value.ToString(_settings.LastModifiedFormat))); if (!string.IsNullOrWhiteSpace(node.ChangeFrequency)) selfItem.Add(new XElement(_namespace + "changefreq", node.ChangeFrequency)); if (node.Priority != null) diff --git a/src/SeoToolkit.Umbraco.Sitemap.Core/Config/Models/SitemapAppSettingsModel.cs b/src/SeoToolkit.Umbraco.Sitemap.Core/Config/Models/SitemapAppSettingsModel.cs index 5507fff7..ad3e378b 100644 --- a/src/SeoToolkit.Umbraco.Sitemap.Core/Config/Models/SitemapAppSettingsModel.cs +++ b/src/SeoToolkit.Umbraco.Sitemap.Core/Config/Models/SitemapAppSettingsModel.cs @@ -12,6 +12,7 @@ public class SitemapAppSettingsModel public string PriorityFieldAlias { get; set; } = "priority"; public string ReturnContentType { get; set; } = "application/xml"; + public string LastModifiedFormat { get; set; } = "yyyy-MM-ddTHH:mm:sszzz"; public string[] DisabledModules { get; set; } = Array.Empty(); } } diff --git a/src/SeoToolkit.Umbraco.Sitemap.Core/Config/Models/SitemapConfig.cs b/src/SeoToolkit.Umbraco.Sitemap.Core/Config/Models/SitemapConfig.cs index eb756723..f77882f1 100644 --- a/src/SeoToolkit.Umbraco.Sitemap.Core/Config/Models/SitemapConfig.cs +++ b/src/SeoToolkit.Umbraco.Sitemap.Core/Config/Models/SitemapConfig.cs @@ -12,6 +12,7 @@ public class SitemapConfig public string PriorityFieldAlias { get; set; } = "priority"; public string ReturnContentType { get; set; } = "application/xml"; + public string LastModifiedFormat { get; set; } = "yyyy-MM-ddTHH:mm:sszzz"; public string[] DisabledModules { get; set; } = Array.Empty(); } } diff --git a/src/SeoToolkit.Umbraco.Sitemap.Core/Config/SitemapConfigurationService.cs b/src/SeoToolkit.Umbraco.Sitemap.Core/Config/SitemapConfigurationService.cs index 6c8d84dd..08d21b35 100644 --- a/src/SeoToolkit.Umbraco.Sitemap.Core/Config/SitemapConfigurationService.cs +++ b/src/SeoToolkit.Umbraco.Sitemap.Core/Config/SitemapConfigurationService.cs @@ -23,6 +23,7 @@ public override SitemapConfig GetSettings() ChangeFrequencyFieldAlias = settings.ChangeFrequencyFieldAlias, PriorityFieldAlias = settings.PriorityFieldAlias, ReturnContentType = settings.ReturnContentType, + LastModifiedFormat = settings.LastModifiedFormat, DisabledModules = settings.DisabledModules }; }