We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22797
    • 134 Posts
    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~].
      • 25663 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
        • 22797
        • 134 Posts
        I filed it in the bugtracker.

        Thanks.
          • 6726
          • 7,075 Posts
          Great suggestion indeed, thanks for the input smiley
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 22797
            • 134 Posts
            Here’s a variation on the previous suggestion: create a separate feature of the manager interface called the Link Manager.

            The Link Manager would be able to do things like:

            • Show a list of all pages linking to a certain document. For example, if you want to find out how many (and which) pages are linking to [~125~]
            • Change the id of a link sitewide. For example, change the link destination to [~126~] instead of [~125~] across the whole site
            • Remove all links to a particular document sitewide, with the option of keeping the (previously) linked text or deleting it
            • Editing or standardizing the linked text to a particular id sitewide. For example, I might want the link text to always say "MODx" if the link itself goes to a specific document about MODx, say [~125~].
            • Flag any broken links to deleted or nonexistent ids
            And so on, though I think those would be the most obvious and most useful features.

            I’ll add this to the bugtracker too.
              • 22815
              • 1,097 Posts
              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.
                No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                Forum: Where to post threads about add-ons | Forum Rules
                Like MODx? donate (and/or share your resources)
                Like me? See my Amazon wishlist
                MODx "Most Promising CMS" - so appropriate!
                • 7923
                • 4,213 Posts
                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."
                  • 25663 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
                    • 22797
                    • 134 Posts
                    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.