Community Documentation

Adding Views pages to the XML sitemap

Last updated September 10, 2009. Created by Dave Reid on July 1, 2009.
Edited by dbeall. Log in to edit this page.

Adding custom links, such as Views pages is only available in the 6.x-2.x version of the XML sitemap module.

Option 1:

  1. Enable the 6.x-2.x XML sitemap custom sub-module.
  2. Manually add the links to your views at admin/settings/xmlsitemap/custom

Option 2:

  1. Enable the 6.x-2.x XML sitemap menu sub-module.
  2. Create a new menu at admin/build/menu/add with the menu name xmlsitemap and title XML sitemap. Make sure that the 'Include this menu in the sitemap.' checkbox is selected.
  3. Edit your view's page view, and add the view to the 'XML sitemap' menu under the 'Page settings'.

Comments

how do you do this in drupal 7?

how can this be achieved in 7.x-2.x?

Drupal 7

The pathes are changed in Drupal 7
Option 1:

  1. Enable XML sitemap custom module
  2. add custom pages to xml sitemap on the following path:

    /admin/config/search/xmlsitemap/custom/add

Option 2:

  1. Enable XML sitemap menu module
  2. Administer the menus: /admin/structure/menu
  3. Alternatively you can enable the desired menu to appear in the xml sitemap here:

    /admin/config/search/xmlsitemap/settings

Views with pagination

How to add all paginated pages to the XML sitemap?

Drupal 7 and Views with Pagination

Just did this in Drupal 7. We had 13 pages of pagination, around 600 products to get into sitemap.xml.

The steps:

  1. Modules/XML Sitemap: Check "XML sitemap node" (Adds content links to the sitemap.)
  2. Configuration/Search and Metadata/XML sitemap/Settings: Click on the "Content" tab. Go to your View created content, click on it.
  3. In the XML sitemap tab, set Inclusion to Included. Save.
  4. Back to Configuration/Search and Metadata/XML sitemap/ - click on Rebuild Links. You'll now have all of the Views created pages listed in sitemap.xml

Thanks you for the

Thanks you for the information but I'm sorry, I think you are mistaken here...
As far as I know what you get with your instructions is your 600 articles listed in your xmlsitemap, not your views listing pages.
I don't know how to get /blog, /blog?page=2 /blog/page=3 ... to be included in the site map but the way you mention has nothing to do with this (AFAIK)

I'm not able to find any information about this...

Anyone out there?

any solution?

I agree with @neurojavi... anybody has a solution?

No solution right now

It is just a subscribe...

drupal+me are capable of: automotive community, jewelers portfolio

Maybe my tricky solution

Maybe my tricky solution would help someone. For views pages i've used hook in custom module, which automatically adds views pages to xmlsitemap on open. It uses xmlsitemap_custom module storage. These pages can be viewed in admin/config/search/xmlsitemap/custom. It is not good way, but it can be basic for further modification or as quick temporary solution.

<?php
/**
* Implements hook_views_post_render().
*/
function MYMODULE_views_post_render(&$view, &$output, &$cache) {
  if(
$view->name == 'display_products') {
   
$loc = '';
   
// you can get path here for your needs, it is specific to project. i'm using clean urls on views
   
if(substr($_GET['q'], 0, '8') == 'catalog/') $loc = $_GET['q'];
    if(
substr($_GET['q'], 0, '7') == 'catalog' && isset($_GET['page'])) $loc = 'catalog?' . $_SERVER['QUERY_STRING'];
    if(
$loc) {    
      if (!
db_query_range("SELECT 1 FROM {xmlsitemap} WHERE loc = :loc AND status = 1 AND access = 1 AND language = :language", 0, 1, array(':loc' => $loc, ':language' => LANGUAGE_NONE))->fetchField()) {
       
$link = array(
         
'type' => 'custom',
         
'loc' => $loc,
         
'id' => db_query("SELECT MAX(id) FROM {xmlsitemap} WHERE type = 'custom'")->fetchField() + 1,
        );
       
xmlsitemap_link_save($link);
      }     
    }
  }
}
?>

Don't forget to add dependencies to module info file:

dependencies[] = xmlsitemap
dependencies[] = xmlsitemap_custom
dependencies[] = views

Subscribing

Subscribing

Page status

About this page

Drupal version
Drupal 6.x

Site Building Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here