It would be great to add support in a future version of Linkchecker to scan menu blocks (or scan the underlying menus) to find broken links. We have a use case where we are using the Linkchecker data tables to examine internal links and find orphaned pages, and it would be great to take into account menu links. It's very easy for menu links to point to nowhere or become broken links over time as a site ages.

Has this ever been discussed? Anyone else interested? Does anyone have a patch or some code to start on?

Comments

calebtr’s picture

Issue summary: View changes

I can think of two use cases for this:

- external links in your menus!
- menu links to views with contextual filters that could return no results (you'd have to set the view to return a 404 in this instance however)

It seems doable and I am working on this from the "scan the underlying menus" approach. I'll share when I can.

calebtr’s picture

Status: Active » Needs review
StatusFileSize
new538 bytes

I've set up a sandbox for a Linkchecker Menu sub-module, which extends Linkchecker to scan menus for links.

It is required to also patch Linkchecker, attached, so that hook_query_TAG_NAME_alter can be invoked. Without the patch, Linkchecker will remove menu links from the database as part of routine garbage collection.

Menu links are a little different from links in nodes, comments and custom blocks in that they aren't owned by a particular user. Broken menu links will only show on the main "broken links" page. That page does not check access for menu links, which I will work on next.

I also opted to not batch the adding/deleting of links when a single menu link is inserted in, updated in, or deleted from a menu.

I didn't do any Drush integration.

If the module maintainer is up for it, I can convert the sub-module into a patch for Linkchecker.

quadrexdev’s picture

Status: Needs review » Closed (outdated)

D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.

If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.

Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.