Creating and registering a sitemap to Google for a WSS 3.0/SharePoint 2007 site.

If you develop or maintain internet facing websites, then you already know what a sitemap is and does. I create and maintain site maps for several sites. I recently added a sitemap to my WSS 3.0 site. With other web technologies this can be a 10 minute process. With SharePoint this turned out to have a few wrinkles.

The 1st thing that I did was generate a sitemap of my SharePoint site using a free Sitemap Generator. Then I logged into my Google account to access my webmaster tools. The 1st challenge was to verify my site, the next challenge would be to get Google to download the sitemap from my site.

Verifying my site
This is Google’s way of making sure that you are authorized to manage the site. Currently, Google lets you do this 2 ways:

  • This first way, involves placing an HTML file on your site using an Google generated HTML file name.
    This must be placed in the root directory of you site.
  • The 2nd way involves placing a Google generated meta tag in your site’s default webpage.

Based upon my previous experience with SharePoint, I tried the HTML file first. Using Internet Services Manager I determined the physical directory that was mapped to the virtual directory for my SharePoint site. Next, I created an HTML file in that directory using the name that Google provided and “viola”, I figured that I was done. Unfortunately, the way SharePoint sites are registered into IIS, a SharePoint site would not render my HTML file from this location. This results in a 404 error. On to the meta tag option.

My 1st attempt at the meta tag option was to create a hidden “Content Editor Webpart” on my site’s home page and place the meta code in it. I suspected that this would not work as the meta tag needs to go into the head section of the HTML page before the body section. Sure enough, it did not work.

My next approach was to determine which file that I could modify to place my meta tag in.
I’m sure that there is a SharePoint Designer way to do this. However, if you are using the free version of SharePoint 2007, then I figure you may not want to buy SharePoint Designer.

SharePoint sites open with a default.aspx file that is based on the site type. There is are seperate default.aspx for Team Sites, Blog Sites, etc. Each of these default.aspx files include a default.master. The default master can be overridden on a site by site basis by editing the default.master in your site’s “Master Page Gallery” by accessing “Site Actions” –> “Site Settings” and then selecting the “Master Pages” Link in the “Galleries” section. Rather than change the default.aspx which would affect all sites of a type running on my server, I decided to change the default master for my site.

To change the default.master, you will:

  • check it out.
  • download a copy
  • edit it with notepad (or some other text editor) and place your meta tag
    I chose to place my Google meta tag just below the
    <META HTTP-EQUIV=”Expires” content=”0″>
  • upload the update
  • check-in the file

You can verify that this is correct by visiting your site’s homepage and then viewing the page source via your Web Browser. If you can see your verify code, you are ready to verify your site with Google and move to publishing your sitemap.

Getting my sitemap into google
In order to get Google to download my sitemap, the sitemap file, sitemap.xml in my case, would need to be anonymously accessible form a url on your site that Google lets you specify. I already knew that I could not simply place the sitemap file into the root directory of my website. My solution was to create a SharePoint document library in my site, provide anonymous read access and upload the sitemap.xml file to that library.
Then I entered the sitemap url into Google.

[ad#ad-4]

Be Sociable, Share!
This entry was posted in google, SharePoint, WSS and tagged , , , , . Bookmark the permalink.