ExpressionEngine Google Sitemaps
I had a little bit of trouble making a sitemap for Google for this page. The ExpressionEngine tutorials didn’t seem to make much sense to me, for some reason. Eventually, I stumbled on to the official sitemap specification at sitemaps.org. Once I read through that, everything made a lot more sense.
Anyway, here’s what I put in my EE template to produce my Google sitemap. You can see its results by going to http://lukemcreynolds.com/sitemapgroup/. If you look at the source, you’ll see that it’s all legit XML.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>{homepage}</loc>
<lastmod>{exp:stats}{last_entry_date format="{DATE_W3C}"}{/exp:stats}</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
{exp:weblog:entries weblog="front_blog" limit="100"
disable="categories|custom_fields|member_data|pagination|trackbacks"
rdf="off" dynamic="off" status="Open"}
<url>
<loc>{homepage}content/{url_title}</loc>
<lastmod>{gmt_edit_date format="{DATE_W3C}"}</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
{/exp:weblog:entries}
{exp:weblog:entries weblog="static_pages" limit="500" disable="categories|custom_fields|member_data|pagination|trackbacks"
rdf="off" dynamic="off" status="Open"}
<url>
<loc>{homepage}static/{url_title}</loc>
<lastmod>{gmt_edit_date format="{DATE_W3C}"}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
{/exp:weblog:entries}
</urlset>
This is in the “index” template of the “sitemapgroup” template group. If you’re going to be using this for yourself, remember to set the template type as XML.
Incidentally, I submitted this site’s RSS feed to Google, as well. Now, whenever I post a new article, Google is automatically notified. Isn’t that convenient?
Let me know by e-mail or in the comments if you find any errors or optimizations for this.
EDIT 1/7/2009: I’ve updated this sitemap to work with EE’s Pages module. (This one works with EE Core’s Tome module.) ExpressionEngine Google Sitemaps Using the Pages Module
Posted on Oct 18, 2008 - 06:01 PM
