[TASK] Make XML Sitemap cachable 17/58417/3
authorRichard Haeser <richard@maxserv.com>
Thu, 27 Sep 2018 18:42:08 +0000 (20:42 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Thu, 27 Sep 2018 20:33:37 +0000 (22:33 +0200)
Cache the XML Sitemaps for 15 minutes by default.

Resolves: #86060
Releases: master
Change-Id: Ia8ded8d0885565e636519bcd92f51154e0817946
Reviewed-on: https://review.typo3.org/58417
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Riny van Tiggelen <info@online-gamer.nl>
Tested-by: Riny van Tiggelen <info@online-gamer.nl>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/seo/Configuration/TypoScript/XmlSitemap/setup.typoscript
typo3/sysext/seo/Resources/Private/Templates/XmlSitemap/Index.xml
typo3/sysext/seo/Tests/Functional/XmlSitemap/XmlSitemapIndexTest.php

index 338f685..a0b44b6 100644 (file)
@@ -3,6 +3,7 @@ seo_sitemap {
   typeNum = 1533906435
 
   config {
+    cache_period = 900
     disableAllHeaderCode = 1
     admPanel = 0
     removeDefaultJS = 1
@@ -13,7 +14,7 @@ seo_sitemap {
     }
   }
 
-  10 = USER_INT
+  10 = USER
   10.userFunc = TYPO3\CMS\Seo\XmlSitemap\XmlSitemapRenderer->render
 }
 
index a2eacac..e8a23b3 100644 (file)
@@ -3,7 +3,7 @@
 <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
     <f:for each="{sitemaps}" as="sitemap">
         <sitemap>
-            <loc><f:uri.page additionalParams="{type: type, sitemap: sitemap.key, page: sitemap.page}" absolute="true" noCacheHash="true" /></loc>
+            <loc><f:uri.page additionalParams="{type: type, sitemap: sitemap.key, page: sitemap.page}" absolute="true" noCacheHash="false" /></loc>
             <lastmod>{sitemap.lastMod -> f:format.date(format: 'c')}</lastmod>
         </sitemap>
     </f:for>
index dc22dba..eaa1071 100644 (file)
@@ -64,10 +64,9 @@ class XmlSitemapIndexTest extends AbstractTestCase
             ])
         );
 
-        $expectedContent = '<loc>http://localhost/?type=1533906435&amp;sitemap=pages&amp;page=0</loc>';
         $this->assertEquals(200, $response->getStatusCode());
         $this->assertArrayHasKey('Content-Length', $response->getHeaders());
         $this->assertGreaterThan(0, $response->getHeader('Content-Length')[0]);
-        $this->assertContains($expectedContent, (string)$response->getBody());
+        $this->assertRegExp('/<loc>http:\/\/localhost\/\?type=1533906435&amp;sitemap=pages&amp;page=0&amp;cHash=.+<\/loc>/', (string)$response->getBody());
     }
 }