Persistent Page Identifiers

Stable unique identifiers for your wiki pages
Reference your pages with UUIDs or PURIs

Example of persistent identifier parser function usage in MediaWiki

On this page

External links

Persistent Page Identifiers for MediaWiki

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.

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.

Persistent Page Identifiers can be used together with both Semantic MediaWiki and Wikibase.

It is possible to configure how your IDs are displayed.

Professional Wiki created Persistent Page Identifiers. We are MediaWiki developers that provide professional MediaWiki services.

We thank Meemoo and Podiumkunsten for funding initial development.

MediaWiki page information showing persistent identifier

Usage documentation

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

Semantic MediaWiki users can store the ID with {{#set:PPID={{#ppid:}}}}, where PPID is the name of their semantic property.

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

Requirements

  • PHP 8.1 or later
  • MediaWiki 1.39 or later

Load and enable

Load the extension using Composer:

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

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
// Becomes something like 123e4567-e89b-12d3-a456-426614174000

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';
    // Becomes something like wiki_123e4567-e89b-12d3-a456-426614174000

More MediaWiki Extensions

View all our extensions

Professional MediaWiki Services

MediaWiki services by the authors of Persistent Page Identifiers

Software Development icon
Software Development

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

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.

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.

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.

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.

MediaWiki Upgrades icon
MediaWiki Upgrades

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