Jump to content

Manual:Interface/Wikibase-SortedProperties

From mediawiki.org

Background

[edit]

By default, sites that use structured data from Wikibase display those statements in the order in which they were added: the first statement added to the entity appears at the top, and the last statement added appears at the bottom.

Implementation

[edit]

Wikis that want to override the default sorting can do so by creating a page with a list of properties sorted as desired. By default, this page is in the MediaWiki namespace with the title Wikibase-SortedProperties. For best results, you can follow the formatting conventions present in Wikidata's Wikibase-SortedProperties page.

Any properties not listed in MediaWiki:Wikibase-SortedProperties will appear in the order in which they were added, from oldest to newest.

Wikibase-SortedProperties pages on individual wikis should be protected and editable only by site admins.

See also the low-level client documentation on the setting.

Categories and labels

[edit]

As seen on Wikidata's page linked above, you can add helpful categories and labels to the list, which are ignored by Wikibase but useful for humans who may not be able to memorize hundreds of P-values.

However, the labels on this page are not dynamically updated if the actual P-value is renamed. For some wikis this might cause some serious confusion; as a result, properties may also be listed on this page using templates which dynamically present the current label, again only for human reference.

Example:

* P7
* [[Property:P8]]
* {{NiceTemplate|P8}}

All rows not starting with * are ignored, so the page can contain elements such as == Titles ==, useful for the human reader, but ignored by the processor.[1]

LocalSettings.php

[edit]

Creating a page on your wiki named MediaWiki:Wikibase-SortedProperties and populating it with the content of your choice is sufficient to gain the benefit of the SortedProperties functionality.

If you would like to override that default page name and choose another name, you may do so by referencing it in your client LocalSettings.php as in the example below, replacing EXAMPLE_PAGE_NAME with the wiki page title of your choice:

$wgWBClientSettings['propertyOrderUrl'] = $wgServer . $wgScriptPath . '/index.php?title=EXAMPLE_PAGE_NAME&action=raw&sp_ver=1';

Theoretically this setting can point to any web page on the internet (though it would be pointless unless its content matches the regex[1]) and is not limited to wikis.

The query parameter sp_ver has no functional impact and is a convention for informational purposes such as analytics tracking.

Purging the cache

[edit]

Changes made to the Wikibase-SortedProperties page may not immediately take effect. To purge the cache, load the page with the following appended as a query string: ?action=purge. Otherwise, the pages will reflect the new sort order the next time their cache is invalidated automatically or after an edit.

Process for community requests to change the statement order

[edit]

Use the discussion page for Wikibase-SortedProperties to request that properties be added to the ordered list or that the existing order be modified. Visit the Wikibase-SortedProperties talk page on Wikidata for some examples of best practices and common requests.

For sites that use Wikidata properties via Wikibase Federation

[edit]

For consistency across Wikibase projects that only use properties from Wikidata via federation, keep in mind the existing order of properties on Wikidata and make only minimal changes as needed.

See also

[edit]

Notes

[edit]
  1. 1.0 1.1 For details on how the text is processed, please refer to the regular expression definition in the source code.