Jump to content

Automatic internal link checker?


gerritvanaaken
 Share

Recommended Posts

I’m searching for a proper solution for the following problem:

My client has a lot of pages with internal links. We do not use CK Editor but a standard textarea with Markdown and some Hanna Code. We even have a Hanna Code for internal links, like so 

[[link id="42" text="Some internal page"]]

Anyway. My client does not want to have broken internal links, so he asked me either

  • "Before I delete a page, it would be nice to know if this page is linked from any other page within the system."

or

  • "Is there a link checker/crawler module, which detects broken internal links in and which I can fire up globally in the admin"

Has anyone similiar problems? How would you solve this?

Cheers,
/Gerrit

Link to comment
Share on other sites

I think you will need to modify your system / setup for this.

One possible solution could be:

  • add a hidden field to all templates / pages that may contain internal links
  • hook into saveReady, check / collect all internal links from the current page
  • save the current page id into the hidden field of each internal linked page

Simplest solution to inform your client, is not to hide the "hidden field", but to show it readonly. If there are entries visible (that could be direct clickable links that open that page for editing into modals!), he has to change the content in that pages before.

Additionally, you can hook into before page delete / page trash, and check the hidden field for entries programatically, to avoid accidental deletions before correcting the internal links.

Another solution could be some sort of centralized maintained list / collection of all link relations. But your client seems to be enough tech savy so that the simple solution may fit already.

  • Like 2
Link to comment
Share on other sites

1 hour ago, gerritvanaaken said:

"Is there a link checker/crawler module, which detects broken internal links in and which I can fire up globally in the admin"

Oh, but there is: 

It's not just for internal links, though you could probably configure it for that.

  • Like 6
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...