Drupal 7 XML Sitemap module

By shane
Wed, 2013-01-02 21:02
Daily Dose of Drupal Episode #79

Share with Others

The Drupal 7 XML Sitemap module generates an XML sitemap and can be configured to submit it to the Google and Bing search engines. This can be useful to help balance your SEO strategy by assisting search engines in indexing and crawling the content on your Drupal 7 website.

In this episode you will learn:

  • How to configure the Drupal 7 XML Sitemap
  • How to set up the XML Sitemap to be submitted to Google and Bing
  • How to include Content, Menu, Links, and Taxonomy in your XML Sitemap

Hello everyone and welcome to another Daily Dose of Drupal, today we’re on Episode Number 79, I’m Shane as always, you can follow me on Twitter at smthomas3, you can also go to codekarate.com and check out the other Daily Dose of Drupal videos, sign up for the newsletter and check out the other blog post and see what’s going on over there.

Today we’re going to be talking about the XML Sitemap Module. The XML Sitemap Module basically allows you depending on whether you want your post, your content of your site, your users, your taxonomy, your menus, any of that different type of data or pages or anything that you could submit to the search engines for them to index can be done to this XML Sitemap Module.

Basically it builds an XML document that is then submitted to the search engines, in this case we’re going to submit it to Google and Bing and that helps the search engines better index your site. So we’re going to go ahead and get started; I have our test site here, I’m going to go to the modules page, I already have the XML Sitemap Module downloaded, I’m going to go ahead and start turning some of these on.

I’m going to show you quite a few of them, you don’t necessarily need them all, just determine based on your sites which ones you need. For instance if you don’t have user accounts or user profiles you probably don’t need this Sitemap User Module but I’m going to go ahead and turn.

The first one on which is XML Sitemap, that’s the based one that’s needed, I’m also going to turn on XML Sitemap engines because you can’t do much without that one, I’ll go ahead and turn on the menu, node, taxonomy and user. And each one of these is responsible for adding items to the sitemap based on obviously this 3rd name here; menu, node, taxonomy or users from your Drupal site.

So go ahead and hit Save, I’m not going to go over the XML Sitemap custom but I will go over thus basic ones. So we’ll go ahead and come back and you’ll see there’s obviously Configure links, I’ll go ahead and click on the Configure link here. You can see there’s a URL for Sitemap XML, there’s currently nothing there, it’s never been updated, you can see a couple messages up here. It says there’s a couple of problems with this sitemap configuration. First; in order to list user profile links on the sitemap, anonymous user must have the View User Profiles Permissions so I’m going to go ahead and set that.

So if I scroll all the way down anonymous users are going to need to be able to view user profile in order for the search engines to actually be able to index them. So go ahead and save that and we will come back to the XML Sitemap page and now you can also see the XML cache files are out of date so you need to run Cron manually to regenerate the files. So click that link and let this run, you can see now it has been updated.

This time it tells you there’s one and has one page. So you can of course edit it but doesn’t let you do anything with it right now, you can delete this sitemap but basically; we need to figure out why there’s only one page here. So what this allows you to do is it allows you to change the settings based on what you want included in this sitemap. So a couple of options here for the minimum sitemap lifetime, it says the recommended value is one day but you can change that based on the need of your site, there’s also some advance settings that you can go through.

Most of these you shouldn’t have to touch generally and here’s where it gets interesting; here’s where you can actually set different settings for what’s included in your sitemap. So by default the front page is always included and it’s the highest priority, you also can set how often that generally changes and all the priority in the change frequency values do is basically tell or inform the search engines which content on your site issued index or crawl first.

It doesn’t really have any ranking or it doesn’t really have any ranking at all on how your pages appear in the index or when someone searches for example your front page isn’t necessarily going to show up higher than a more specific page just because of your priority but it is a good rule for which page will be indexed and crawled first by the search engines. So we’ll go into Menu links; let’s say for instance we wanted to include our main menu in the XML Sitemap.

You can simply click here on Main Menu, change the settings to include it, we can give it a priority whatever we want and click Save. Now you can see when we come back it’s been included, it tells you that there’s one available, zero have been indexed and zero are visible. You can do the same which each different content type; you can come and click on the article.

All this does is bring it to the content type edit page, that’s the same as going to structure content types and clicking on the edit link on the article content type, we come into this sitemap settings and you can change this to include it of course, you can change the priority to whatever you want depending on how you want the search engines to index your site and you can save it.

So we’ll come back to the XML Sitemap configuration, you can do the same with taxonomy. As you can see it’s very simple; you basically set what you want to be included in this sitemap and then of course you can do the same with users. The other thing you need to look at is the search engines. This tab allows you to select which search engines you want to submit the sitemap do.

So I’m going to select both, say that I don’t want to submit more often than every day and only submit if it’s been updated, so I’ll save that. Another thing you may want to consider doing and I would recommend is going to either Bing Webmaster or Google Webmaster Tools and making sure that you submit your sitemap through those tools and I go over those or the basics of those in the site verification module Drupal video so if you want to take a look at that I don’t really touch on submitting a sitemap of course but I touch on using those simple tools or those webmaster tools to help get your site verified with the search engines. So let’s go ahead and come back to rebuild links. It says the sitemap is up to date and it doesn’t need to be rebuilt but I’m going to click rebuild anyways just so you can see what it does.

You can see it has three links one page, if I click on it it will then show me this sitemap. It says there’s three URL’s in the sitemap and of course this is the human readable CSS file that is in these settings here. So you can turn that off and that should I believe make it, I guess it doesn’t but basically you can change that settings to include a style sheet for humans. So as formatting and tables and makes it easier to view the sitemap instead of just viewing the raw XML.

Search engine of course don’t care about the style, they just care about the XML data so you don’t have to worry about that either way, I usually just leave it on. So that’s really all there is to it, it does a lot but really it’s simple. All it does is it generates and XML file but it can work with your nodes, your menus, your taxonomy, your users. So go ahead and give it a try and start submitting your content to the search engines through an XML Sitemap I highly recommend it on almost all Drupal sites.

I used it on almost all Drupal sites in which I want to get organic search traffic from the search engines. So I’d go ahead and give it a try and see what you think. As always; follow me on Twitter and let me know if you have any questions. Thanks for watching the Daily Dose of Drupal.