Drupal 8 SEO: Simple XML Sitemap module

02 Okt 2015

The Simple XML Sitemap module was originally created by gbyte as a temporary replacement for the non-functioning Drupal 8 XML Sitemamp Module. After putting some more work into it however, we decided to keep using it in our D8 projects, as it is very lightweight, simple to use and most importandly, adheres to a newer xml sitemap standard.

The new 2.x branch features most of the functionality of the heavier XML Sitemap module while also featuring hreflang XML sitemaps, which is a new Google standard for creating multilingual XML sitemaps that should improve SEO even more.

Here is the description from the module page:

Every webpage needs an automatic XML sitemap generator for SEO reasons. This module aims to be a replacement for the xmlsitemap module for Drupal 8.
Simple xml sitemap is lighter than xmlsitemap in terms of resources and usability. Its functionality differs from xmlsitemap, see this post for details.

Sitemaps generated by this module adhere to the new Google standard regarding multilingual content by creating hreflang sitemaps. Googlebots will thank you later.

Upgrade path

Please do not forget to run update.php after every update.
Branch 8.x-1.x is no longer supported. As there is no upgrade path between major releases, please uninstall 8.x-1.x before installing 8.x-2.x.

Functionality

The module generates a multilingual sitemap for entities and custom links. Out of the box it supports most of Drupal's content entity types including:

  • nodes
  • taxonomy terms
  • menu links
  • users
  • ...

Contributed entity types like commerce products or media can be indexed as well. Inclusion and priority settings can be set for bundles and overridden on a per-entity basis.

Here is a sample of the XML markup it generates. Do not forget to view the page source (ctrl+u).

Feel free to grab the module from the module page.

If you are unsure whether to get simple_sitemap or xmlsitemap, check out this comparison on the two modules.

Comments

Hi John,

you can include content into the sitemap by adjusting the settings on the corresponding entity type edit pages (e.g. admin/structure/types/manage/[type] for content types and admin/structure/taxonomy/manage/[vocabulary] for taxonomy vocabulary pages).

There is also the possibility of adding custom links, however this requires exporting the simple_sitemap configuration, altering it and importing it back. I may add an UI for that in the future.

I'm confused. I navigated to each of my content types and enabled (checked) "Index content of this type." I then navigated to "Configuration > Simple XML Sitemap Settings" and pressed the "Regenerate Content" button and -- after processing the request -- Simple XML Sitemap reported " The XML sitemap has been regenerated for all languages." I then loaded http://www.MyDomain.com/sitemap.xml which resulted in this...

http://MyDomain.com/
1.0

Where is the mapping to all of my content?

In addition, there does not appear to be any sitemap.xml file located in my site's root directory (when I look with my FTP client).

What am I doing wrong?

Hello,

I installed this module and i configured. but i want add a menu in footer "sitemap". when click on sitemap it will display all links in that page. what is the path to add as menu item ?

Thanks,
Ramesh S

Hi Ramesh,

the path to the sitemap is /sitemap.xml and putting it into a menu would work.

However, this is an XML sitemap and usually not used by people - it is used by search engines for indexing all pages of your website (SEO).

What you are probably after is a traditional sitemap, check out this module: https://www.drupal.org/project/sitemap

After installing the module and doing all the necessary configs, I got the below error, anyone please assist.

An error has occurred. This may result in an incomplete XML sitemap.
Please continue to the error page

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /batch?id=34&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText: {}

Hi,

I just install your Drupal 8 module, configure it by adding a post type, and click the "Regenerate sitemap" .

The XML is updated, but i get an error on the admin page :

Warning: Illegal string offset 'path' in Drupal\simple_sitemap\SitemapGenerator->getCustomUrlsData() (line 102 of modules/simple_sitemap/src/SitemapGenerator.php).
Drupal\simple_sitemap\SitemapGenerator->getCustomUrlsData() (Line: 84)
Drupal\simple_sitemap\SitemapGenerator->startGeneration() (Line: 538)
Drupal\simple_sitemap\Simplesitemap->generateSitemap() (Line: 120)
Drupal\simple_sitemap\Form\SimplesitemapSettingsForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('simple_sitemap_settings_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Can you help me ? Is it a code error or a bad configuration ?

Thanks for your help and for your good job.

z2m

I forgot the more important, the configuration of the module

Im using Drupal 8.2.4, and the module have the default configuration :

Regenerate the sitemap on every cron run : checked
Exclude duplicate links : chacked
Skip non-existent translations : unckecked
Maximum links in a sitemap : 2000
Refresh batch every n links : 1500

Thanks

Unfortunately this module does not work with the Domains module at the time of this writing. Articles that are marked as "Send to All Affliates" will show in the sitemap, but that will have urls of different domains. If you remove the "Send to All Affliates" then NO pages will be in your sitemap. Ugg... also there's a caching issue for multiple domains that require you to override the caching logic.

Hi,

I just install your Drupal 8 module, configure it by adding a post type, and click the "Regenerate sitemap" .

The XML is updated, but i get an error on the admin page :

Warning: Illegal string offset 'path' in Drupal\simple_sitemap\SitemapGenerator->getCustomUrlsData() (line 102 of modules/simple_sitemap/src/SitemapGenerator.php).
Drupal\simple_sitemap\SitemapGenerator->getCustomUrlsData() (Line: 84)
Drupal\simple_sitemap\SitemapGenerator->startGeneration() (Line: 538)
Drupal\simple_sitemap\Simplesitemap->generateSitemap() (Line: 120)
Drupal\simple_sitemap\Form\SimplesitemapSettingsForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmit gry do pobrania Form(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('simple_sitemap_settings_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Can you help me ? Is it a code error or a bad configuration ?

Neuen Kommentar schreiben

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.

Restricted HTML

  • Zulässige HTML-Tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h4 id> <h5 id> <h6 id>
  • HTML - Zeilenumbrüche und Absätze werden automatisch erzeugt.
  • Web page addresses and email addresses turn into links automatically.

Angebot innerhalb von 24 Stunden

Ob ein großes kommerzielles System, oder eine kleine Business Seite, wir schicken ein Angebot ab innerhalb von 24 Stunden nachdem Sie diese Taste drücken: Angebot anfordern