Wiki Link URL Normalizer

Last modified by Admin on 2023/07/24 00:23

cogConvert local URLs into wiki links
Recommended
TypeXAR
CategoryAPI
Developed by

Vincent Massol, Clément Aubin, Thomas Mortagne

Active Installs20
Rating
3 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

When saving wiki pages and XObjects, convert all links having absolute URLs into local wiki links if they point to the local wiki.

Features:

  • Supports normalizing both page content and TextArea xproperties (when they're of type "fullyrendered", i.e. when they can contain wiki markup)
  • Supports normalizing links inside Macros for some well-known macros: {{message}}, {{warning}}, {{info}}, {{error}}, {{success}}, {{cache}}, {{context}}, {{box}}, {{comment}}, {{container}}, {{todo}}. Since 1.3
  • Supports normalizing local "view" URLs
  • Supports normalizing local "download" URLs
  • Supports subwikis and URL aliases
  • Doesn't support normalizing URLs with anchors, see Limitations section below

Example of entering a full URL in wiki syntax:

before-wiki.png

After save, if you edit the page again in wiki syntax:

after-wiki.png

Note that this also works in WYSIWYG. For example, you get the same result if you enter the following:

before-wysiwyg.png

Custom filters

While the extension already convert a lot of URLs on its own, it's also possible to provide custom reference conversion. This allows disabling an automated conversion or convert references which are not matched by the standard conversion.

You can manipulate custom filters in the administration:

customfilters.png

Limitations

  • The full content is also normalized and not just the URLs. This means that you might see some differences in the diff. For example:

    If you have originally:

    {{info}}Hello{{/info}}

    After normalization you'll get:

    {{info}}
    Hello
    {{/info}}

    Reason is that the canonical form for a macro is to have those extra new lines.

  • If there's an URL reference (aka anchor) used in a local URL, then no normalization is performed.

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.8.1

v1.8.0

v1.7.0

v1.6.0

v1.5

v1.4

v1.3

v1.2

v1.1.5

Added debug logs for easier debugging in production

v1.1.4

v1.1.3

v1.1.2

v1.1.1

v1.1

v1.0

Dependencies

Dependencies for this extension (org.xwiki.contrib:application-urlnormalizer-ui 1.8.1):

  • org.xwiki.contrib:application-urlnormalizer-script 1.8.1

Get Connected