Published:
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.
Creating an accurate sitemap is a necessity for seo. In addition it serves as an important usability feature for your website. However building a sitemap manually can be a tedious job, and if you have a dynamic site (such as a blog) it can be even harder to keep your sitemap accurate.
Fortunately by using url rewriting and coldfusion we can create a dynamic site map which is built directly by our database on loading. Further we can apply this technique to styling the sitemap using xsl. Here's how.
Before creating a sitemap dynamically let first create one manually to detail the structure.
Step 1: Understanding the XML Sitemap Structure
A standard xml file consists of the follow components.
- XML declaration: This is a standard declaration for a xml file.
- URLset: This serves as a wrapper for the url nodes.
- URL Nodes: A url node is a declaration for a specific page address on the site and consists of the following 4 child nodes.
- loc: The actual web address of a particular page
- lastmod: The data the page was last modified in the format "yyyy-mm-dd"
- changefreq: (optional) How often the page is updated always(changes each view),hourly,daily,weekly,monthly,yearly or never.
- priority: (optional) Priority you assign this page relative to the rest of the site. A value in the range 0.0 - 1.1 (default 0.5).
As you can see it really is not that complicated to create a sitemap. Here is a simple sitemap listing the home page and a blog page.
<?xml version="1.0" encoding="UTF-8"?>
<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">
<url>
<loc>http://www.neiland.net/</loc>
<lastmod>2011-03-05</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
<url>
<loc>http://www.neiland.net/blog/</loc>
<lastmod>2011-03-05</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
Reader Comments
@PensionExpert
Friday, December 18, 2015 at 3:37:43 PM Coordinated Universal Time
Are you available for assignment to redefine out sitemap code for the website as listed above?
David Tananbaum, Pesident
AtPrime media Services