Repair Wiki Links

Last modified by Clemens Robbenhaar on 2021/03/17 21:43

cogRepairs absolute links to wiki pages which are copy & paste'd in the editor
TypeXAR
CategoryApplication
Developed by

Clemens Robbenhaar

Rating
0 Votes
LicenseBSD license
Compatibility

This extension does no longer work with XWiki since 7.2 (no nested pages support). If you have the time to fix it, be very welcome to upload an updated version.

Installable with the Extension Manager

Description

Repair links on the fly

This extension is a little page tucked away in the "XWiki" space, which observes when someone saves a wiki page and then goes through all the absolute links in that page, looking for those which point to the another page in the same wiki, and turns them into an (internal) wiki link.

This is useful if you have wiki editors who use the WYSIWYG editor, and who do not like to use the "Link" tool in the editors toolbar but copy and paste the links e.g. from some other browser tab. If one does it that way, the link will be an external link. This has the disadvantage of not showing a backlink in the information tab of the target page, and not being updated when the target page (or the complete wiki) is moved. This extension silently fixes this by changing these links into internal links as good as possible, every time the page is saved.

Repair links on already existing pages

Also if you already have a lot of these links, visit the page at XWiki.RepairWikiLinksOnPageSave and you can run that repair in a batch over all pages on your wiki.
(This might run a long time if you have a large wiki; and the current implementation is very basic, so you might not see the results due to browser timeouts. If you have a large wiki you are encouraged to edit that page to make the repair in smaller chunks.) 

Deactivation

Currently you cannot deactivate this repair action temporarily (i.e. in case you positively want to keep one link absolute). Instead you have to uninstall the extension or delete the page XWiki.RepairWikiLinksOnPageSave.

ToDo List

  • add screenshots to the documentation
  • do the same repair with images
  • update the link text, if it looks an URL, too (happens when you copy it from the browser status bar)
  • make the "batch"-repair script scalable for large wikis

Know Issues

If you find any issues with this extension, please edit this section instead of leaving a comment, and describe the issue here.

If you have any question, ask on the Mailing List or try to catch the author of this extension on IRC.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Release Notes

v1.0.1

  • slightly better documentation in comments in the code

Dependencies

Dependencies for this extension (clemensrobbenhaar:repairwikilinks 1.0.1):

Get Connected