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>
Archives Blog Listing
- 2012
- May
- April
- March
- February
- January
- 2011
- December
- November
- September
- August
- July
- June
- Understanding The Different CFC Instantiation Behaviours
- Dont Call Us PIIGS
- Be Careful With ColdFusion Date Validation
- CF9 CF8 Railo Multiserver Install Under JRUN
- Your Privacy vs Technology
- How To Install CouchDB On Slackware
- Fixing Retweet.js
- Programmers Put Down The Keyboard
- How To Create A Virtual CFIDE Directory Mapping In Apache
- May
- April
- March
- February
- January
- 2010
- December
- November
- October
- September
Tag Listing
- CFML
- Database
- Front End Design & Development
- Linux
- Other
- Tools & Testing