by
potato » Mon Sep 24, 2012 4:32 pm
hi, I finally got round to implementing the dynamic sitemap.php (having just tested it out locally) ... I used KK's posted sitemap.php template.
I didn't want the client to see sitemap in the Admin Panel so I added
- Code: Select all
<cms:template title='Site map' clonable='0' hidden='1' commentable='0' executable='1' order='1000' />
I initially got a 404 response on submitting the sitemap via Google Webmasters - this was because I had set executable to '0'. I wonder if this could solve the problem for you too Martijn?
I also had to remember to slightly adapt KKs template so that the events with published date in the future were included in the sitemap:
- Code: Select all
<cms:pages masterpage=k_template_name show_future_entries='1'>
I ended up excluding quite a number of templates from within <cms:pages> so decided to list the static pages of the site in the sitemap and then dynamically generate those from the 2 templates where the client will be adding content:
- Code: Select all
<cms:template title='Site map' clonable='0' hidden='1' commentable='0' executable='1' order='1000' />
<cms:templates order='asc' >
<cms:pages masterpage=k_template_name show_future_entries='1' id='NOT 29, 9'>
<cms:if (k_template_name eq 'events.php') || (k_template_name eq 'musings.php') >
<url>
<loc><cms:show k_page_link /></loc>
<lastmod><cms:date "<cms:if k_page_modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show k_page_modification_date /></cms:if>" format='Y-m-d\TH:i:s+00:00' gmt='1' /></lastmod>
<changefreq>daily</changefreq>
</url>
</cms:if>
</cms:pages>
</cms:templates>
Just edited my posting because I did get a 404 error from Google even after I'd changed "executable" to '1' (initially it all looked OK when I clicked on "test sitemap" - no errors found). So I got the 404 error when I clicked on "submit sitemap" BUT I then refreshed the page and the error message disappeared and the status of the php sitemap is now 'pending' and looking OK. A bit unsatisfactory I know, as I can't really tell you what happened.Hope this all makes sense!