by
KK » Sat Nov 10, 2012 12:20 am
Thanks for the creds.
I had a look. Your sitemap was trying to display nearly 300 pages (which is ok for output meant to be read by Google. For humans, we always use pagination after 10-20 pages).
Anyways, doing so made PHP run out of memory and ergo the error.
For a fix, I have added a
skip_custom_fields='1' parameter to the cms:pages loop.
This makes Couch skip trying to load the custom fields, which is ok in our case as the sitemap generation only requires the system fields of a page (its title, date etc.). This saves memory for us.
The rectified markup is this (I have already made the changes to your site's template so you don't have to apply this):
- Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<cms:templates order='asc' >
<cms:pages masterpage=k_template_name show_future_entries='1' skip_custom_fields='1'>
<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:pages>
</cms:templates>
</urlset>
<?php COUCH::invoke(); ?>
Things are working for now but sometime in the future, as the number of your pages keep growing, it is inevitable that you'll hit the memory mark again (maybe at about 3000 pages).
It could also be that you first hit the maximum script execution time permitted first while listing all these pages.
http://www.html-sitemap.com/html-sitema ... avigation/ suggests (and I concur) that
If your website is very large and you start to have above 100-200 links on a sitemap page, you should consider splitting your sitemap across multiple pages. Even if your users can navigate the HTML sitemap, search engines such as Google and Yahoo may start ignore links if you have thousands on a single page.
For very large number of pages, we can use 'Sitemap index file' method suggested by Google itself -
http://support.google.com/webmasters/bi ... 35655&rd=1Hope this helps.