Random Page Naming Strategy

Last modified by Admin on 2026/02/26 15:43

cogGenerate random unique page names by using UUIDs
TypeJAR
CategoryOther
Developed by

Clemens Robbenhaar, XWiki Development Team

Active Installs0
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Success

Installable with the Extension Manager

Description

This extension allows to create pages with unique, random looking page names, so users do not have to care if there is a page with the same name in the current parent page or not.

Instead in the the "Create Page" dialog, the name will be shown as a standard serialization of an UUID:

create_page_with_random_name.png

(only if the user clicks the pencil icon to edit the location manually - otherwise they do not have to notice how the page names are formed unless they look at the URL in their browsers status bar.)

Installation

The extension is implemented as a page naming strategy, so after installation of the extension it can be enabled via the "Name Strategies" section in the "Editing" category of the wiki administration:

admin_random_page_names.png

For Developers

  • this extension uses the java-uuid-generator library
  • if the choosen UUID generator is not suitable, one can change this programmatically, at least on java level code, like:
    import org.xwiki.model.validation.EntityNameValidation;
    import org.xwiki.contrib.validation.uuidpages.UUIDEntityNameValidation;
    import com.fasterxml.uuid.Generators;
    
    [...]
    
    @Component
    public class SomeOtherComponent implements Initializable
    {
    
      [...]
    
      @Inject
      @Named("UUIDEntityNameValidation")
      EntityNameValidation nameValidator;
    
      [...]
      public void initialize()
      {
            UUIDEntityNameValidation uuidNameValidator = (UUIDEntityNameValidation)nameValidator;
            uuidNameValidator.setUuidGenerator( Generators. randomBasedGenerator() );
      }
    
      [...]
    }
    Currently one must inject a com.fasterxml.uuid.NoArgGenerator. Generators taking an argument (i.e. com.fasterxml.uuid.StringArgGenerator are not supported yet.)

 

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

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Versions

Dependencies

Dependencies for this extension (org.xwiki.contrib:api-random-page-names 1.1):

Get Connected