Sitemap.xml
From pixyWiki
What is a sitemap?
To help get your blog known to the world and indexed properly by search engines, it's a good idea to add an XML sitemap. An XML sitemap is a simple XML document which lists all the pages of your site so that search engines (specifically Google) knows about them. A simple example of a Sitemap can be seen below:
<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://demo.pixyblog.com/</loc>
<lastmod>2008-05-28</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://demo.pixyblog.com/page/Archives</loc>
<lastmod>2007-06-23</lastmod>
<changefreq>monthly</changefreq>
<priority>0.4</priority>
</url>
<url>
<loc>http://demo.pixyblog.com/page/About</loc>
<lastmod>2008-03-31</lastmod>
<changefreq>monthly</changefreq>
<priority>0.4</priority>
</url>
</urlset>
For more information about why you should have a sitemap and how to tell Google about your sitemap, check-out the following links:
Adding a sitemap to your PixyBlog
Fortunately we make it easy for you to add your own sitemap. You can simply create a new page template named sitemap.xml and copy-and-paste the code below into the template. You should now be able to access your sitemap.xml file on the URL:
- yoursite.pixyblog.com/page/sitemap.xml (it will also be accessible at the root level; yoursite.pixyblog.com/sitemap.xml).
The code will dynamically generate a valid XML Sitemap which gets updated as you add new entries, galleries, tags and pages to your site. You have complete control over the generated XML, so you can change the weight/importance of a page as you desire.
Finally you will then need to tell Google about your Sitemap. Visit http://www.google.com/webmasters/tools/ (you will need a Google account).
<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
## Main page
#createUrlXml($url.home $utils.formatDate($model.weblog.lastModified, "yyyy-MM-dd") "daily" "1.0" )
## Weblog pages
#foreach($iPage in $model.weblog.pages)
#if (!$iPage.hidden && $iPage.navbar)
#createUrlXml($url.page($iPage.link) $utils.formatDate($iPage.lastModified, "yyyy-MM-dd") "monthly" "0.4")
#end
#end
## Tags pages
#set($tags = $model.weblog.getPopularTags(-1, 100))
#foreach ($tag in $tags)
#createUrlXml($url.tag($tag.name, "search") $utils.formatDate($model.weblog.lastModified, "yyyy-MM-dd") "monthly" "0.2")
#end
## Galleries
#set($galleries = $model.weblog.getWeblogGalleries())
#foreach($gal in $galleries)
#subGalleries($gal)
#end
## Entries
#set($pager = $model.getWeblogEntriesPager('nil', 100))
#set($map = $pager.getEntries())
#foreach($day in $map.keySet())
#set($entries = $map.get($day))
#foreach($entry in $entries)
#createUrlXml($url.entry($entry.anchor) $utils.formatDate($day, "yyyy-MM-dd") "weekly" "0.6")
#end
#end
</urlset>
#macro(createUrlXml $loc $lastMod $changeFreq $priority)
<url>
<loc>$loc</loc>
<lastmod>$lastMod</lastmod>
<changefreq>$changeFreq</changefreq>
<priority>$priority</priority>
</url>
#end
#macro(subGalleries $gal)
#createUrlXml($url.gallery($gal.path,'Galleries') $utils.formatDate($gal.website.lastModified, "yyyy-MM-dd") "weekly" "0.3")
#set($subgals = $gal.weblogGalleries)
#foreach($subgal in $subgals)
#subGalleries($subgal)
#end
#end

