Posted By

nielsenrc on 02/03/11


Tagged

cmsms


Versions (?)

CMS Made Simple Google Sitemap


 / Published in: Apache
 

URL: http://forum.cmsmadesimple.org/viewtopic.php?f=4&t=39258

Simple way to generate dynamic sitemap with CMS Made Simple

  1. //Add to HTACCESS
  2. RewriteCond %{REQUEST_FILENAME} !-f [NC]
  3. RewriteCond %{REQUEST_FILENAME} !-d [NC]
  4. RewriteRule ^sitemap.xml$ index.php?page=sitemap&showtemplate=false [L]
  5. RewriteRule ^sitemap.html$ http://www.domain.com/index.php [R=301,L]
  6.  
  7. //CREATE PAGE CALLED SITEMAP AND INSERT THIS SMARTY TAG
  8.  
  9. {menu template='google_sitemap' show_all=1 collapse=0}
  10.  
  11. <?xml version="1.0" encoding="UTF-8"?>
  12. <urlset
  13. xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  14. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  15. xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
  16. http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
  17. {if $count > 0}
  18. {assign var='now' value=$smarty.now|strtotime}
  19. {foreach from=$nodelist item=node}
  20. {if $node->alias !== "sitemap"}
  21. <url>
  22. <loc>{$node->url}</loc>
  23. <lastmod>{$node->modified|date_format:'%Y-%m-%dT%T-08:00'}</lastmod>
  24. <changefreq>daily</changefreq>
  25. <priority>0.5</priority>
  26. </url>
  27. {/if}
  28. {/foreach}
  29. {/if}
  30. </urlset>

Report this snippet  

You need to login to post a comment.