Although Drupal is a great CMS, it has not a way to generate the XML Sitemap by default, however, there is a module that makes everything so easy that you would think I am cheating you, the XML Sitemap module generates automatically the XML Sitemap of all the content depending on the options previously configured by the user, it can even send the XML Sitemap to the Search Engines (Google, Bing, ...) automatically. In this tutorial, we are going to see how to use this module to generate the XML Sitemap on Drupal.
The Installation ...
The first step is to install the module, the installation must be done as any other installation, either you can use Drush or Install it through Drupal's module administration page, in order to install it using Drush you just have to type the following commands in the shell on the Drupal installation path:
- > drush dl xmlsitemap
by typing that command you would be installing the XML Sitemap module, you can also try to install the module through the Drupal's module administration page, in order to do it, you must go to the module administration page and click the "install new module" link, then you can either download the module and upload it to Drupal or provide the FTP path to let Drupal download the module for you (this is the FTP path to install XML sitemap on Drupal 7: http://ftp.drupal.org/files/projects/xmlsitemap-7.x-2.0-rc2.tar.gz, the FTP paths are the download links in the module page), click the "Install" button and you will have installed the XML Sitemap module.
Enabling the proper sub-modules
The XML Sitemap module is based on multiple sub-modules that work together, in order to make it work, we have to enable the XML sitemap module along with the other modules, we have to select which of those modules should be active and which not, here is a possible list with all the sub-modules:
- XML Sitemap; the main module, make sure to add the other modules because if not you will only see a sitemap with the link of the home page, just that.
- XML Sitemap custom; this sub-module can let you add custom links to the sitemap.
- XML Sitemap engines; this sub-module will upload the sitemap to the search engines automatically.
- XML Sitemap internationalization; this sub-module enable the sitemaps on multi-lingual Drupal installations.
- XML Sitemap menu; It enables the menu links to be in the sitemap.
- XML Sitemap node; It enables the nodes (the content, content types and everything related) to be in the sitemap, do not forget to enable this sub-module, it is really important.
- XML Sitemap taxonomy; this sub-module can add the taxonomy term links to the sitemap.
- XML Sitemap user; it adds the user profile to the sitemap.
As you can see in the list above, although the XML Sitemap module is just one, there are many sub-modules with different task, however, there are key sub-modules that you should enable, for example, if you do not enable the XML Sitemap node sub-module, then the content of the whole sitemap is not going to be shown (it has no sense), if you have a multi-lingual Drupal installation and you do not activate the XML Sitemap internationalization sub-module then you are more likely to have only one sitemap with every link (with all the languages), it is really important that, at least, you activate the XML Sitemap node sub-module.
How does this module works
Depending on the sub-modules that you have enabled, every group of content and all its children are going to have a new option identified as "XML Sitemap", normally, if a group of content is enabled all its children will be enabled as well, for example, the XML Sitemap menu sub-module adds the options to the menus and each menu link, if a menu is enabled, all its menu links will be enabled by default, the XML Sitemap taxonomy sub-module adds the options to the taxonomy term lists and each taxonomy term, if a taxonomy term list is enabled, then all its terms will be enabled by default, the XML Sitemap node sub-module adds the options to the content types and each node, if a content type is enabled, then all its nodes will be enabled by default. There are two options, the first one is the "Inclusion" option, this options lets the content be included in the sitemap, it has a default value set to "Excluded", once the content is included, the "priority" option may appear, it has a default value of "0.5", however, this value (as all the values) can be changed.
Adding the content to the sitemaps
If you have the required modules available, you can add the content to the sitemaps (the nodes more specifically), in order to do it, you should set the options at the content types, you can enable the content type to be written in the sitemaps and set the priority for all that kind of content.
If you enable the content type, all the related content will be written in the sitemaps, however, you can still change the configuration of each node, so if you want every node to be sent but one node, you can enable the content type and disable the node.
Adding the menus (navigation) to the sitemaps
You can also add the menu links to the sitemaps, in order to do that, just do the same as described before, every menu (and all its links) in the Menu administration page of Drupal will have a new option, you can either include the whole menu in the sitemaps
or include just a single link,
if you add the whole menu, all its links are going to be included too, you can change the options for each link if desired.
Adding the taxonomy term lists to the sitemaps
The taxonomy term lists can also be included to the sitemaps, the procedure is just the same, you can include either the whole taxonomy term list
or a single taxonomy term,
if you include the whole taxonomy term list then all its taxonomy terms will be included by default, if not you have to include every single taxonomy term manually.
The configuration options of the XML Sitemap module (and all its modules) are located in the configuration options of Drupal, here you can add custom links (with the proper module previously enabled), customize the upload process to the search engines, rebuild the links of the sitemaps, and perform any other configuration activity related to this module.
You can add a custom link to the sitemaps in the "Custom Links" tap, in order to add a custom link, the supplied path must be accessible, additionally, it must be based on the URL of the website, this is for situation that an external webpage must be added within Drupal, for example, if I want to add a webpage of a free software project in my website that I could not built in Drupal, I can still add the webpage by giving access to a specific path in my domain and adding that link to the sitemaps through this configuration panel.
The XML Sitemap module has the capability to upload the sitemaps to the search engines, you can customize how often the sitemaps should be uploaded and which search engines should receive the sitemap, however, there are some details to be warned of, first you are more likely to need the "Site verification" module in order to verify the ownership with the search engines, additionally, you must be sure that the Drupal cron runs regularly.