The ISA-Bus

One blog to bind them all.

Creating a sitemap

So far I had never created a full sitemap for Download Central. Now I searched for a tool that could do that for me. There are a number of sites that offer this as a free service, unfortunately it seems that they all use the same script, and this script is case insensitive—it converts the URLs completely to lower case.

So, what to do?

The solution was quite simple: a standard Windows directory listing, and a few global replaces with a regex-capable tool. That it turned out to be so simple was however only due to the file structure that I use, where every page is a directory. All I had to do was this:

dir /s index.shtml > sitemap.xml

That gave me a list with entries like this one:

Directory of I:\htdocs\dlc\Amiga\Games\A\ASokoban-3

2011-03-10  12:44             2,569 index.shtml
1 File(s)          2,569 bytes

These entries had to be converted to this format:

    <url>
    <loc>http://www.download-central.ws/Amiga/Games/A/ASokoban-3/</loc>
    <lastmod>2011-03-10</lastmod>
    </url>

This is not particularily difficult, but it only worked because it was the directories I was after, not the files. Note that each page now even has its correct modification date!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: