Persistent Page Identifiers

Stable unique identifiers for your wiki pages

Reference your pages with UUIDs or PURIs

On this page

Overview Usage documentation Installation Configuration

External links

Release notes Issue tracker Source code

Overview

Reference your wiki pages with stable, unique identifiers that remain unchanged even when pages are renamed, moved, or deleted and restored.

Each page automatically receives a unique persistent ID upon creation. You can configure the format of your IDs.

The extension generates UUID v7 IDs. Future versions might add support for other ID types, such as nanoid-style IDs. UUIDs (Universally Unique Identifiers) are 128-bit numbers represented as 32 hexadecimal digits separated by hyphens. Example: 123e4567-e89b-12d3-a456-426614174000

You can access the identifiers via the page information tab (action=info), parser functions, and the REST API.

MediaWiki page information showing persistent identifier

Parser Function

To display a page's persistent identifier within the page content, use the parser function {{#ppid:}} .

Example of persistent identifier parser function usage in MediaWiki

API

Get persistent identifiers via the REST API by MediaWiki page ID:

GET /persistent-page-identifiers/v1/pages?ids=123|456
                        
                            {
                                "identifiers": {
                                    "123": "00000000-0000-0000-0000-000000000042",
                                    "456": "00000000-0000-0000-0000-000000000043"
                                }
                            }
                        
                    

Generate IDs for Existing Pages

For wikis with existing pages that were created before installing this extension, you can generate persistent identifiers using the maintenance script:

php maintenance/GenerateMissingIdentifiers.php

The script will only generate identifiers for pages that don't already have one, processing them in batches for optimal performance.

Installation

Platform requirements:

  • PHP 8.1 or later
  • MediaWiki 1.39 or later

Install the extension using Composer:

                        
                            COMPOSER=composer.local.json composer require --no-update professional-wiki/persistent-page-identifiers:~1.0
                        
                    
                        
                            composer update professional-wiki/persistent-page-identifiers --no-dev -o
                        
                    

Enable the extension by adding the following to your LocalSettings.php:

wfLoadExtension( 'PersistentPageIdentifiers' );

You can verify the installation by checking your wiki's Special:Version page.

If you already have wiki pages, you probably want to generate IDs for them.

Configuration

Persistent Page Identifiers only has optional configuration. Change configuration via LocalSettings.php.

Persistent Identifier Format

This format affects how identifiers are displayed everywhere in the extension, including the page information tab, parser function output, and API responses.

$wgPersistentPageIdentifiersFormat = "$1";  // Default value

The $1 placeholder is replaced with the persistent ID.

Example usage:

  • PURIs (Persistent Uniform Resource Identifiers):
    
                                    $wgPersistentPageIdentifiersFormat = 'https://example.com/id/$1';
                                    // Becomes something like https://example.com/id/123e4567-e89b-12d3-a456-426614174000
                                
  • Add a prefix or suffix:
    $wgPersistentPageIdentifiersFormat = 'wiki_$1';

Professional MediaWiki Services

MediaWiki services by the authors of this extension

Software Development icon Software Development

Get superior results from the best MediaWiki developers with a proven track record of creating MediaWiki extensions & integrations.

Explore Mediawiki Development
Theme Development icon Theme Development

Make your wiki look great! Use a time-tested responsive MediaWiki theme, or have us create a custom MediaWiki skin for you.

Style Your Wiki
MediaWiki Hosting icon MediaWiki Hosting

Let us take care of your wiki. We are MediaWiki hosting experts and provide cloud hosting, dedicated hosting, and on-premise hosting.

Find the Perfect Wiki Hosting Plan
MediaWiki Consulting icon MediaWiki Consulting

Bring your wiki to the next level by leveraging our MediaWiki expertise. From strategic planning to wikitext, we have you covered.

Explore Our Consulting Services
MediaWiki Migration icon MediaWiki Migration

Migrate your wiki with confidence. We move your MediaWiki to a new home, or we help you migrate from another system to MediaWiki.

Migrate Your Wiki
MediaWiki Upgrades icon MediaWiki Upgrades

Keep your MediaWiki up-to-date and secure. We offer MediaWiki maintenance services to keep your wiki running smoothly.

Secure & Update Your Wiki