demosthenes.info

I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter or add me on Google+.

web developer guide

my books

Book cover of Pro CSS3 AnimationPro CSS3 Animation, Apress, 2013

my projects

A Sass color keyword system for designers. Replaces CSS defaults with improved hues and more memorable, relevant color names.

CSSslidy: an auto-generated #RWD image slider. 3.8K of JS, no JQuery. Drop in images, add a line of CSS. Done.

tipster.ioAutomatically provides local tipping customs and percentages for services anywhere.

Generate an XML Sitemap

html / search engines

Estimated reading time: 3 minutes, 6 seconds

An example of a traditional site map at Apple.comIntroduced in the earliest days of the web, site maps were traditionally an overview, often in list format, of pages in a website, with links to each page. HTML site maps are still around – Apple’s site map is a good example – and are still useful to visitors for a website with more than a dozen or so pages. (If your site has nine or fewer pages, every page should be linked to every other, precluding the need for a site map).

However, traditional site maps have several drawbacks:

  • As static HTML pages, they are a pain to keep updated, especially on a busy site: every new page that is uploaded to the site must also be entered as a link on the site map page. (This can be alleviated to some degree by utilizing or another server-side language).

  • In complex and dynamic sites, files that are missing from the site map and not linked to from any other page might be missed by search engines when they index the site.

  • Traditional Sitemaps (note the capital S) give no indication of the relative importance of pages, nor how frequently they are changed or updated.

  • They also do not list resources, such as images and video, that have become vital to web searches.

The answer to these problems are XML site maps (note the lowercase s). These site maps are not intended to be read by visitors: rather, they are guides for search engines to the resources on your site. XML site maps are supported by Google, Bing, and Yahoo.

I will use a portion of the site map for this blog as an example:

<?xml version="1.0" encoding="UTF-8"?>
<urlset 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"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.sitemaps.org/schemas/sitemap-image/1.1">
<url>
<loc>http://demosthenes.info/blog/217/CSS3-Vendor-Prefixes</loc>
<lastmod>2010-11-14</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://demosthenes.info/blog/112/Lowell-Observatory-Arizona</loc>
<image:image>
<image:loc>http://demosthenes.info/assets/images/lowell-observatory.jpg
</image:loc>
<image:geo_location>Lowell Observatory, Flagstaff, Arizona, United States of America</image:geo_location>
<image:caption>Telescope at Lowell Observatory</image:caption>
<image:license>http://creativecommons.org/licenses/by-nc-sa/2.5/ca/
</image:license>
</image:image>
<lastmod>2010-06-20</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>

As you can see, the xml site map goes into far greater depth than a standard traditional Sitemap, and supplies far more information that is useful to a search engine. It is important to note that priority is not an indication to the search engine on how high to rank your page, but on the page’s relationship to the purpose of the site as a whole.

Obviously writing a complete XML site map is a serious undertaking for a even a moderately complex website. Fortunately there are tools to help you:

  • The sitemaps.org website provides a good overview of the site map schema.

  • XML-Sitemaps can automatically generate a free site map for your site, covering up to 500 pages. (It does not include images or videos by default – that is a paid option).

Once your site map is complete, upload it to the root of your site (typically with the filename sitemap.xml), alongside your index page. While search engines should find the file automatically and use it to help index your site, there is nothing wrong with directing Google, Bing and Yahoo to your site map in order to prompt an indexing attempt, or when the file changes significantly.

  • Google can be alerted about your site map at Google WebMaster. (You will need a Google account to sign in, and may need to place a special verification meta tag in your index page to prove that you are the owner of the site).

  • Bing accepts sitemaps at its Webmaster Tools sub-site.

  • Yahoo accepts sitemaps at Yahoo Site Explorer.

By themselves, XML site maps do not guarantee higher ranking in search engines, or even that the search engine will use every piece of information presented in the site map. They can certainly help lead search engines to resources on your site that might otherwise be overlooked, and supply more contextual information about your site as a whole… and that is always a good thing.

comments powered by Disqus

This site helps millions of visitors while remaining ad-free. For less than the price of a cup of coffee, you can help pay for bandwidth and server costs while encouraging further articles.