View Full Version : XML Sitemap generator for small sites
sarahk
Jun 5th 2005, 8:29 pm
When I first started creating sites I used a tool called Xenu (http://home.snafu.de/tilman/xenulink.html) to verify that my site indexed ok and that all was well.
I still use it when I'm trying to find my way around the sites of people I'm considering link exchanges with. Sometimes everything is ok but I'm darned if I can find the navigation path.
Anyway, I have a small site which isn't updated so often (despite how often I growl at my husband who is responsible for the content) so I don't want to write elaborate queries to trawl through the site.
So, out comes Xenu to crawl the site and generate the site map. Xenu already does this in part and hopefully Tilman will extend it to include Google's sitemap.
In the meantime this spreadsheet is prepopulated with some of the output from "Export to TAB separated file". Then just run the macro called "CreateGoogleSiteMap" and you'll find in the same location a file called sitemap.xml. It's in the zipped attachment.
I'm no expert in Excel's version of VBA but it's fast and while I am sure it could be better written it'll do me. Let me know if you've found it useful.
Sarah
Will.Spencer
Jun 5th 2005, 9:16 pm
Wow! Extra cool! XENU rocks and the Google script doesn't. :)
sarahk
Jun 5th 2005, 9:37 pm
small change to one of the subs so that it can handle parameters
Sub writeLink(url As String, fDate As String)
url = Replace(url, "&", "&")
Print #1, "<url>"
Print #1, "<loc>" + url + "</loc>"
Print #1, "<lastmod>" + fDate + "</lastmod>"
Print #1, "<changefreq>Daily</changefreq>"
Print #1, "<priority>0.8</priority>"
Print #1, "</url>"
End Sub
Bear in mind that Xenu doesn't obey robots.txt so it will capture local pages you may not want in your sitemap. The best way to handle this is to set up the "don't index" part of xenu which remembers the pages you want excluded. Easier than changing the excel file or the xml file each time :)
Sarah
marktse
Jun 5th 2005, 9:53 pm
Thanks for the info. Trying it for my site now.
Mark
stephenmunday
Jun 5th 2005, 10:00 pm
Great tool!
Cheers
passat
Jun 6th 2005, 3:29 am
cool. thanks!
jumble
Jun 6th 2005, 4:57 am
Hi sarah,
Where is the sitemap saved once the macro is run? I could not find it.
I have made a sitemap using excel also but I am no programmer. So I used a less elegant method. I will describe it here if anyone is interested. This method is useful if you have a forum (in my case I use Invision Power Board) and the topics have the following structure -
http://www.domain.net/forums/index.php?showtopic=1
http://www.domain.net/forums/index.php?showtopic=2
http://www.domain.net/forums/index.php?showtopic=3
etc...
To create the hundreds of required url's in a sitemap format, I created 3 columns in excel.
Column 1 contains
<loc>http://www.domain.net/forums/index.php?showtopic=
(repeating in every row)
Column 2 contains -
1
2
3
etc...
(the numbers incrementally increasing on each line - you achieve this by putting in a 1, 2..then selecting them and dragging the controller in the bottom right corner)
Column 3 contains
</loc></url><url>
Then in column 4 I combine these using the "concatenate" function. The result will look as follows -
<loc>http://www.domain.net/forums/index.php?showtopic=1</loc></url><url>
You can then cut and paste them into a file as follows -
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://www.domain.net/forums/index.php?showtopic=1</loc></url><url>
<loc>http://www.domain.net/forums/index.php?showtopic=2</loc></url><url>
<loc>http://www.domain.net/forums/index.php?showtopic=3</loc></url><url>
</urlset>
Don't forget to delete the red <url> (see above) entry from the end of the last url line!
Now you have a valid XML file to submit.
Cheers :)
EDIT: I have provided some additional explanation here (http://www.adsenseforums.net/index.php?showtopic=42).
Canadianbacon
Jun 6th 2005, 5:03 am
Very sweet
crumpelfungus
Jun 13th 2005, 8:49 am
Love it! Great work.
So, basically we:
1) Download your spreadsheet
2) Add the new code (posted in a subsequent thread) to the Macro VBA
3) Get Xenu and run the report, save it as a tab-delimited file
4) Import the Xenu report into MS Excel (either into a new workbook or add a worksheet to your "template" or replace your information altogether)
5) Ta-dah! Done.
By default, the sitemap.xml file gets saved to MY DOCUMENTS.
If you want the sitemap.xml file to be saved to the same directory in which the current MS Excel file is located, change the top of Sub OpenIt() as follows:
Sub OpenIt(cBase As String)
Dim fSitemapPath As String
'GET THE CURRENT FILE'S LOCATION
fSitemapPath = ActiveWorkbook.Path
Dim fSitemap As String
'Now create the tags file.
fSitemap = fSitemapPath & "/sitemap.xml"
The attached MS Excel spreadsheet is a mildly revised version of Sarah's original, including all discussed and disclosed changes up to this point.
Thanks for your pioneering in this direction, Sarah!
PS: Hmmm...the upload feature seems to be temporarily down. Instead, feel free to download the revised MS Excel file with Sarah's macro from:
http://www.humdinger-media.com/sitemap/rev_pagemap.zip
mizt
Jun 13th 2005, 1:26 pm
Umm don't use this on big forums. Its a nice bandwidth killer. Just used a 1 gb in like 2 mins.
Blue
Jun 13th 2005, 4:21 pm
Nice tool thanks!
wirnik
Oct 29th 2007, 7:30 am
Thank you for sharing, good tool.
trichnosis
Oct 29th 2007, 8:04 am
i was using xmenu to check my broken links until now.
it's great tip to use:)
Zanswer
Oct 30th 2007, 12:11 am
This is a two-year old thread that got bumped up today. but the technique stills works for smaller sites.
Personaltrainer
Oct 30th 2007, 3:08 am
Thanks for sharing this. Great tool.
baybossplaya
Dec 21st 2007, 1:41 am
very useful
Gallito
Dec 21st 2007, 6:57 pm
This thread is ancient but if OP is still around thanks, my site has 9 pages and I still need to make a sitemap =)
enous
Dec 21st 2007, 7:42 pm
Ya,good tools...
britishguy
Jan 21st 2008, 1:36 am
Hi Mods
Please help quickly
Thanks
Best Regards
Pete
britishguy
MBrain
Feb 7th 2008, 7:25 am
Thanks.. nice tool
PaddyL
Mar 1st 2008, 9:05 am
Thanks for the tip. I've used Xenu for years (it's easy and does what it says), and I didn't know it had this new feature.
Time for me to update my copy!
Abiao25
Mar 3rd 2008, 12:07 am
cool I like it very much!
yantomulia
Jun 28th 2008, 3:35 pm
great tool.. thanks for sharing
depositlaw
Aug 17th 2008, 2:30 pm
This is a lot better than what I was trying to accomplish on my own.
Despite the large attachment, I think this is well-worth the bandwidth it's taking up.
I wouldn't have found the attachment or the thread if it hadn't been bumped. Thank you
MikePrice
Aug 17th 2008, 10:47 pm
Ow... I was searched to any web but there is here. Thanks a lot.
seondesign
Jan 19th 2009, 3:53 am
Thats a pretty nice tool, i really like it. Thanks!
Hadi
aspardeshi
Jan 27th 2009, 2:21 am
phpsitemapng is also a good one for small and big sites, but I cannot judge the suitability in your scenario. try it.
Wanted Now (http://www.indiacontents.com/auction/)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.