New contrib extension: Wanted Pages

Hey, XWiki community,

A few days ago, I asked if there were a way to get a list of “wanted pages”—basically, a list of non-URL links on the wiki that point to nonexistent documents—on XWiki, sort of like MediaWiki’s “Special:WantedPages” page. I was reassured that, while the functionality obviously does not exist out of the box, it would not be difficult to implement.

So I got to work! After many hours of trial and error, I managed to code up something that gets the job done:

As of now, it does not support localisation, meaning that it is only available in English—all non-generated text in the document is currently hardcoded—but I may adapt it to be localisable in the future, especially if there is enough demand. I also doubt it properly supports a multi-wiki setup at the moment, as I expect that it would pull links from all wikis on the same server. Finally, the stylesheet attached to the page currently assigns a hardcoded color to a couple of classes instead of a theme variable because I am new to LESS and was just trying to get it to look good on my wiki for now. (My wiki uses the default Flamingo Iceberg skin.)

All of which is to say that I am calling this v0.1. Depending on demand, I can make improvements over time.

I am creating this topic because I would like some assistance with publishing this extension. I was trying to follow the official documentation, but having never used Maven before, I am still confused as to how to get it set up. I saw there is a “Maven XAR Plugin”, with some XML to paste into a POM, but it doesn’t specify which POM. Also, I am not sure if I need to publish this to an official XWiki repo and/or if I should have “org.xwiki…” in the groupId field instead of my own domain. Oh, and I am not sure what the directory structure of the XAR should look like: since I only have the one wiki page, should it just be a top-level file, or does it need to be in a directory…and if it is the latter, what should the directory be named?

If someone could give me some step-by-step instructions on how to get this extension out to the public, as if I have never used Maven before (which is the case), I would be incredibly grateful. I have installed Maven and created a root directory for the Maven project, and I created a Git repo out of it, too.

Many thanks in advance!

1 Like

Hello @SightSpirit,

First thanks a lot for wanting to contribute, that’s greatly appreciated.

Regarding your questions:

If your code is publicly stored somewhere fell free to share, that we’ll be easier to discuss specific issues that way.

1 Like

Thanks for the response, @mleduc!

I just posted the XML file with the entire thing (the page and the extension objects) on Gist. Feel free to take a look when you have time.

Line 35 and 36 can be simplified, you can do #set ($createLink = $xwiki.getURL($link[0], 'create'))

Instead of:

#set ($pageTitle = $link[0].replace('.WebHome',''))
#set ($createLink = $xcontext.getURLFactory().getServerURL($xcontext.context) + $xwiki.getURL($link[0],'create'))

Line 44 can be simplified in the same way.

Also note that once this document is placed inside a maven project, you’ll be able to call mvn xar:format.
This will cleanup the document by removing or replacing some metadata as well as removing the 
 (among other things).

At the end, you project hierarchy should look like this:

  • pom.xml
  • src/main/resources/WantedPages/WantedPagesCode.xml

And the pom.xml like this:

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
1 Like

Thanks for your continued help, @mleduc.

I use that $pagetitle variable to display the wanted links without “.WebHome”. That’s a personal preference of mine, but I could change it or make it configurable at some point. I did update my code (not on Gist yet) to get rid of that unnecessary URLFactory, however.

I have also created three additional pages for the application in anticipation of a public release, one each for: code, translations—what is there now should be fully compatible with localization efforts—and application entry (to add a link to the Applications Panel).

I followed your advice and arranged my hierarchy as you suggested, and I created a POM file based on the template you provided here. However, when I attempt to run mvn xar:format, I get errors saying that “” is not a recognized tag. I put it inside <dependencies> tags, but now it says that “xar” is “unknown packaging.” I’ve tried putting in a <parent> block like I see in most POM files on wiki-contrib, but it says, “Failure to find org.xwiki.platform:xwiki-platform-core:pom:13.10.3”.

Am I missing anything here?

On another note, I think I will go ahead and request a contrib project.

EDIT: Here is my temporary upstream in the meantime: GitHub - SightSpirit/xwiki-wantedpages-application: An XWiki application that provides a page listing dead, non-URL links on your wiki.

I think you can have a look at:

You can also remove parent-platform from the dependencies section of your pom, it is only useful in the parent section.

1 Like

Thanks, that was everything I needed! I have a working XAR now!

The release is here, again for now. I would love to have a project on Contrib and get this on the Extension Manager, if that would be appropriate.

Please follow the Requesting a project steps if you wish to make this a contrib extension :slight_smile:

1 Like

Alright, well, I think I’ve already covered the basics of what I was originally trying to accomplish here. As for the other stuff, I think I’ll need a GitHub repo—my username is SightSpirit; feel free to fork my existing repo if that makes sense, and I’ll treat that as my main repo from now on—a JIRA project, and a thing on the Weblate instance so people can localize my extension. I would also like to create a page on, but I am not sure how to import from the XWiki Maven repo, assuming I can do that already.

For GitHub, the name I am thinking of is application-wantedpages.

Would a CI job make sense, too? I have never dealt with CI before.

I hope that’s enough information! Thanks in advance, and I look forward to being part of the larger XWiki community! created

You should have received an invitation.

I let you:

Loading... created. What’s you jira username so that I can add you as project lead?

For weblate please ping me when the code is migrated. I need to be able to link to the translation file path for it.

For the CI you just have to follow the instructions. Ping me once is done and I’ll trigger the synchronization with the CI.

1 Like


Thanks so much!

My code is fully migrated—the translation file is WantedPagesTranslations.xml—and my JIRA username is EdenBiskin.

I have decided to pass on CI for the time being, but that may change in the future.

You are now project lead :slight_smile:

And here is the weblate project XWiki Contrib/Wanted Pages Application @ Weblate

You’ll receive a pull request with a single key french translation (I did as a test) at some point today.
Note that this PR is currently with an empty french translation file, and should not be merged as is (this will happen every time a new language is added). The PR will be updated with an actual content later, when weblate scheduler processes the new translation and produces the xml file content.