Previously, in the general support forum, I asked if this feature is available, and I was told that it wasn’t, so I’m now officially adding it to my wishlist:
I would like to see a method built into MODx that looks through content to make sure that the internal links are not broken. For example, if I have 30 links to [~125~] and if I delete the item with id=125, that would be a problem. Ideally, I’d want to be warned that there is a problem and I’d like to be prompted for a new id, or new url, or other methods of fixing the problem. Another example would be if I no longer want the links to go to [~125~], but I want them to go to [~126~].
-
MODX Staff
- 12,272 Posts
Please file this as a feature request in our bugtracker. Thanks!
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
I filed it in the bugtracker.
Thanks.
Great suggestion indeed, thanks for the input
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
Woah. I must admit, I tend to use the alias in links as it’s considerably easier to swap them around.
The above pretty much assumes that there is a simple way of searching documents for a particular link!
- All that I can think of would be a simple list of pages that have [~125~] in their content, but then there’s snippets, templates...
- Changing [~125~] to [~126~] is similar to Search & Replace functionality which has been recently proposed. This seems feasible.
- Removing links is much much harder to achieve! Whilst you can match <a href="[~125~]" ... > ... </a> to catch most of the links (but not javascript, form submissions etc) this doesn’t mean that it will make any sense to remove the links - you’d really need to visit all the pages in the list manually. Again, this could be done with advanced Search & Replace functionality
- If you really want to maintain the link text somewhere, then personally I’d write a snippet that pulled the menutitle if you passed it a doc ID (and didn’t display a link if the doc didn’t exist) and used another field for the hover label. That would be a better way of imposing standardisation.
- So, run through all the content to see if links are valid? Nice.
I like the core idea of a sanity-check for deleting a document which lists links, but I think that the other functions would be best served as part of a RegExp-capable Search & Replace facility rather than a dedicated Link Manager. The limitations would also be clearer that way. And the final "broken links" bit would probably work better as part of something that also checked for missing snippets and chunks.
It strikes me that the following would be more useful:
- Change ID of document (so 126 can just be renumbered 125).
- A redirect document with logging (which could be assigned to [~125~], redirecting people to [~126~] and keeping a log of the referral URLs so that you can find out what pages have the wrong URL.
Quote from: PaulGregory at Sep 13, 2006, 05:53 AM
- Change ID of document (so 126 can just be renumbered 125).
There is a replace page module that does this, I think..
Quote from: PaulGregory at Sep 13, 2006, 05:53 AM
- A redirect document with logging (which could be assigned to [~125~], redirecting people to [~126~] and keeping a log of the referral URLs so that you can find out what pages have the wrong URL.
I like this idea
alot!
And I agree that 100% solid link manager would be very hard to do, because links can come from snippets, plugins, TV’s etc.. and doc id’s to build links are taken as snippet parameters or made in the code.. so how these could be changed automatically, i wonder.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
MODX Staff
- 12,272 Posts
I’m guessing it’d be a relatively intense update query on many tables using just the [~NNN~] bit. Intense job indeed, fraught with potential for errors and omissions it seems at first brush. But a killer idea indeed.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
Have you guys thought of using the cache as a way to check links? Most of the information is already there, and it can be cross-checked with the ids, even though I do realize that the cache has been stripped of the ids. There are obviously some technical details to work out there, and it may not be 100% fool-proof due to the many possible variations in TVs, snippets, etc, but I don’t think these are insurmountable to the point that it should kill the whole idea.
Maybe a combination of the cache, ids/aliases, and logged 404 errors would work.