We have a site which has multiple 301 redirects in place for pages which once existed on their own but are now redirected elsewhere using the redirect module.

These original pages no longer exist in the CMS or are unpublished.

The generated XML sitemap retains these now redirected links in the sitemap.xml file generated. An external SEO agency has instructed the client that this is bad practice and the XML sitemap entries which are 301 redirects need to be removed.

Does anyone have any ideas on how I could omit these?

Thanks,
Gary

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

garyh created an issue. See original summary.

garyh’s picture

Issue summary: View changes
garyh’s picture

Issue summary: View changes
thebumik’s picture

I've provided an integration with Redirect. So you can easily skip the nodes/pages which are 301 redirected.

thebumik’s picture

Status: Active » Needs review
cyberlily’s picture

What's needed to get this patch released? Happy to help since we need it too.

Chris Matthews’s picture

Version: 7.x-2.3 » 7.x-2.x-dev
Status: Needs review » Needs work
Issue tags: +Needs reroll

The patch in #4 to xmlsitemap.admin.inc and xmlsitemap.generate.inc does does not apply to the latest xmlsitemap 7.x-2.x-dev and if still applicable needs a reroll.

Checking patch xmlsitemap.admin.inc...
Hunk #1 succeeded at 314 (offset 1 line).
error: while searching for:
  //  '#type' => 'value',
  //  '#value' => $node->xmlsitemap['changecount'],
  // );
  // @codingStandardsIgnoreEnd 
  // Add the submit handler to adjust the default values if selected.
  $form += array('#submit' => array());
  if (!in_array('xmlsitemap_process_form_link_options', $form['#submit'])) {

error: patch failed: xmlsitemap.admin.inc:866
error: xmlsitemap.admin.inc: patch does not apply
Checking patch xmlsitemap.generate.inc...
Hunk #1 succeeded at 207 (offset 1 line).
Den Tweed’s picture

renatog’s picture

Status: Needs work » Needs review
artem_sylchuk’s picture

Thanks for the patch.
I've tried it and it works, but redirect_fetch_rids_by_path has the third argument which controls if the disabled redirects are returned or not.
By default it returns disabled redirects too.
Updated patch to exclude the disabled ones. This also has the performance impact as the status column is the part of the index.

aamortimer’s picture

Tested patch #10 and all is working for me, thanks for the patch really useful.

rpayanm’s picture

Issue tags: -Needs reroll
darrell_ulm’s picture

Also tested patch #10 and appears to work.

darrell_ulm’s picture

Status: Needs review » Reviewed & tested by the community
alex_optim’s picture

Good for me too.

pifagor’s picture

pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.