Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using the module http://drupal.org/project/special_menu_items
Menu items with should not be inserted in the sitemap.
Comment | File | Size | Author |
---|---|---|---|
#26 | xmlsitemap-1993034-26.patch | 1.85 KB | aquaphenix |
#11 | xmlsitemap-1993034-11.patch | 1.83 KB | gapple |
#1 | xmlsitemap-not_include_special_menu_items-1993034-1.patch | 912 bytes | vidorado |
Comments
Comment #1
vidorado CreditAttribution: vidorado commentedHere a patch to not include all special menu item links in XML Sitemap (those whose link_path starts with a "<" and ends with a ">")
It applies to 7.x-2.0-rc2
Comment #2
vidorado CreditAttribution: vidorado commentedForgot to change the issue status
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedDave does this one line patch look correct to you?
Comment #4
FiNeX CreditAttribution: FiNeX commentedThe patch seems correct.
Comment #5
jippie1948 CreditAttribution: jippie1948 commentedI used the patch to update the 2.0 version and everything works fine!
My question is: Why is this patch against version 7.x-2.0-rc2 not implemented in the final version 7.x-2.0?
Thanks,
JP
Comment #6
sebi CreditAttribution: sebi commentedI've applied this patch and it too works in the latest 2.0 stable. Reminder to those searching that you need to rebuild your sitemap links for this fix to take effect.
Comment #7
Agileware CreditAttribution: Agileware commentedWorks. Let's get this patch committed.
Comment #8
Dave ReidWould it be better just to check if
strpos($menu_item['link_path'], '<') === 0
rather than running a regex on each individual menu link? Would it also be good to change xmlsitemap_menu_xmlsitemap_index_links() to exclude these from the query?Comment #9
Dave ReidComment #10
Dave ReidComment #11
gappleHere's a patch to move things along; I've also included an update hook to remove existing records for special items.
A remaining task is indicating that the sitemap files need to be recreated afterwards, ideally conditional on any items actually being deleted.
There is also a gap in that if a menu item is changed to a special item, it will not be removed from the xmlsitemap table.
Comment #12
dxx CreditAttribution: dxx commentedPatch #11 worked for me with current Commerce Kickstart 2.x (and special_menu_items).
Simply need to rebuild the XML sitemap after patching (admin/config/search/xmlsitemap/rebuild).
Comment #13
Clemens Sahs CreditAttribution: Clemens Sahs commented#11 works fine for me. Merge after review.
Comment #14
romansta CreditAttribution: romansta commented#11 works for me.
Comment #15
Sreenivas Bttv CreditAttribution: Sreenivas Bttv commentedHi,
Child menu links are not adding to sitemap. Please give me solution. I already updated this issue at https://www.drupal.org/node/2485337, but not received any update.
Comment #16
perelesnyk CreditAttribution: perelesnyk commentedComment #17
JAINV18 CreditAttribution: JAINV18 as a volunteer commented#11 not working for me. Using the version 7.x-2.2 of xmlsitemap module.
Comment #18
Nick Robillard CreditAttribution: Nick Robillard commented#11 works as expected.
Comment #19
Dave ReidUpdate hooks for 7.x-2.x should start with 72XX. This is also missing a flag to regenerate the sitemap if it does delete any records that were visible.
Does this affect the performance of the query at all? Should it be something that just stays in xmlsitemap_menu_xmlsitemap_process_menu_links() instead?
<front>
will no longer appear? I assume that's ok since we manually add in the front page.<none>
or another invalid value, should affect the state of the row in the xmlsitemap table, which it seems like this patch does not account for. Instead of "skipping" these records, we should likely be setting $link['access'] to FALSE if the link_path is not a valid item.Comment #20
robbdavis CreditAttribution: robbdavis as a volunteer commentedSo.. #19 suggests this patch isn't quite ready.
In the meantime, can anyone see any issues with using this to simply pull links out of the sitemap:
It seems to work.
Comment #21
naczus CreditAttribution: naczus as a volunteer commentedApplied patch #11 on project version 7.x-2.3 and modified query to apply the scape character '\' on NOT LIKE clause query:
Now, rebuild sitemap links and special menu items are excluded from sitemap.
I hope it helps!
Comment #22
Aritra Banerjee CreditAttribution: Aritra Banerjee as a volunteer and commentedHi folks, better hook for removing element without db query is hook_xmlsitemap_link_alter. I am providing one sample code where element lists are removed by checking the path alias. Though if it can be managed by disabling that specific content type from back-end, that would be best. Suggestions are welcome.
Comment #23
weavie CreditAttribution: weavie commentedI am also using a custom module like #20. As far as I can tell it works fine. Thanks.
Comment #24
gravisrs CreditAttribution: gravisrs commented#20 is not exact hook (&$link is an array). Try this:
<nolink>,<separator> - are from Special menu items module
<view> - is from Menu Views module
<firstchild> - is from Menu Firstchild module
Comment #25
agelospanagiotakisalso add
<block>
it's from megamenu module
Comment #26
aquaphenixRe-rolling #11 since it doesn't apply to release 7.x-2.7