From 6ee5ebe5b1ed2abe2565e36568c082caec464f51 Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Mon, 4 May 2020 09:57:43 +0200
Subject: [PATCH] [BUGFIX] Make rendering of priority option optional in XML
 sitemaps
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

According to https://www.sitemaps.org/de/protocol.html the option
`priority` is optional. If a SitemapProvider doesn't provide a priority
information the tag must be avoided to have a valid XML structure.

Resolves: #91286
Releases: master, 9.5
Change-Id: I0bd4379633359321ad39726e4357773880c15638
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64397
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Christian Eßl <indy.essl@gmail.com>
Tested-by: Josef Glatz <josefglatz@gmail.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Richard Haeser <richard@maxserv.com>
Reviewed-by: Christian Eßl <indy.essl@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Josef Glatz <josefglatz@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Richard Haeser <richard@maxserv.com>
---
 .../seo/Resources/Private/Templates/XmlSitemap/Sitemap.xml    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/seo/Resources/Private/Templates/XmlSitemap/Sitemap.xml b/typo3/sysext/seo/Resources/Private/Templates/XmlSitemap/Sitemap.xml
index f359bbbe4451..366cfc78884c 100644
--- a/typo3/sysext/seo/Resources/Private/Templates/XmlSitemap/Sitemap.xml
+++ b/typo3/sysext/seo/Resources/Private/Templates/XmlSitemap/Sitemap.xml
@@ -9,7 +9,9 @@
                 <f:if condition="{item.changefreq}">
                     <changefreq>{item.changefreq}</changefreq>
                 </f:if>
-                <priority>{item.priority}</priority>
+                <f:if condition="{item.priority}">
+                    <priority>{item.priority}</priority>
+                </f:if>
             </url>
         </f:if>
     </f:for>
-- 
GitLab