I have written in the past about some good WordPress plugins to create an XML sitemap, but obviously, not everybody uses WordPress to create their sites. This step by step guide will help you create an XML Sitemap from scratch. This process will require you to use Excel or Numbers and the ability to crawl a site.
Let’s get started.
Step 1 – Crawl Your Site
This can be done using several different programs. My personal preference is Link Sleuth by Xenu. It is very simple to use. You can download it from the link above. Once the scan is complete, you will need to export the file into Excel. Once you have the file in Excel, that’s when the fun begins.
Step 2 – Clean Up Your URL’s
Once you have all of the HTML URL’s, it is important that you delete any sort of duplicates. For example, if the same product has several different URL paths because it is listed in different categories on the site, you will only want one URL (preferably the URL that is your canonical URL).
Do not rush through this part. This is going to be the most time consuming part, but it’s well worth it in order to not have duplicates. Once you have your clean list of URL’s it’s time to set up your Excel file.
Step 3 – Setting Up Your Excel File
An XML sitemap file has a specific format that you must follow. Each URL will end up looking like this:
Since we can use a formula within Excel, it is going to be pretty easy to set up this formatting. Treat each part as it’s own column. For example:Column A – <url> Column B – <loc> Column C – [URL] Column D – </loc> Column E – <changefreq> Column F – [insert frequency – daily, weekly, monthly] Column G – </changefreq> Column H – <priority> Column I – [priority number, 1.0, 0.9, 0.8, etc.] Column J – </priority> Column K – </url> Column L (This column is a formula to add up all the others) – =A2&B2&C2&D2&E2&F2&G2&H2&I2&J2&K2 Column M – Copy and Paste Special – Values to get clean text
Step 4 – Gather XML Sitemap URL’s
Now that you have your Excel file setup and you have all of your URL’s from your crawl, all you have to do is paste them into Column C. Be sure to fill down the other columns and formula to make sure that you are getting all of your URL’s into the XML Sitemap URL. Column L is going to hold all of your final URL’s, but they are within a formula, so you are going to need to copy them and paste special – values into Column M to get them as a text URL that you will need for the XML file.
Step 5 – Create XML Sitemap Text File
Now that we have the URL structure correct for the sitemap, we have to create the text file with the proper format and data that needs to be included. Every sitemap has to follow the same protocol. The file should look like this:
<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”>
[ALL URL’S SHOULD BE PASTED HERE]
That’s it. You now have your sitemap all set up. Just one final step to create the file.
Step 6 – Save As .XML and Test
This is the easiest part of the whole process. Simply save your text file as an .xml file. Once you have the file saved, open up a browser (testing in several browsers is better), open up the file and it should open up with no errors. If there are any errors, the browser will tell you what line the errors are on.
That’s it, you now have your XML Sitemap created. Now all you have to do is upload the file.
Step 7 – Upload sitemap.xml file to Root Directory
You will want to name the file “sitemap.xml” and upload to the root directory so the URL for the XML sitemap would be “www.domain.com/sitemap.xml”
You’re done. Congrats, you just created an XML Sitemap from scratch. You will now want to submit this sitemap URL to Google Webmaster Tools and also include it in your robots.txt file.