Extension:PageProperties

PageProperties allows to easily edit display title, language and content model of a page. To associate semantic properties to pages without having to manually annotate them (provided that Semantic MediaWiki is installed), and to set SEO meta data for the entire wiki or specific pages.

The extension adds an action on the top menu of Wiki articles and then authorized users can set all the relevant properties of the page.

Since version 1.2.0 PageProperties includes a OOUI interface through which to easily create SMW properties and property definitions without to deal with property pages, and is completely based on slots!

Currently the extension adds a link in the navigation menu and a link on the sidebar, within the "Tools" section: their visibility can be handled using the parameters below





Installation

 * Download and place the file(s) in a directory called  in your   folder.
 * Add the following code at the bottom of your LocalSettings.php
 * optionally run  in the extension's folder, this will install the required libraries to annotate JSON-LD within the page (see section below to find out more)
 * ✅ – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Migration from previous version (1.0.3 and below)
 * Run  (this will migrate all properties stored in the dedicated table, to a special slot of related pages)

Version 1.2.1 improvements:
 * new special page "Manage Properties" where to create/edit properties as in this picture and to create/edit categories with emphasis for semantic data (i.e. in order to easily associate them to an item of an external vocabulary)
 * support for the assignment of categories to wiki pages through a user friendly interface
 * support for the input International Telephone Input for telephone_number data type

Version 1.2.2 improvements:
 * a complete GUI for semantic import (currently of csv files). Even large files can be uploaded on the browser, and then imported in the wiki incrementally. The GUI also allows to map csv fields to local properties. Server-side is based on the standard Wiki importer (adapted for the semantic import using slots) and it allows to use wikitext and parser functions to handle pagenames and categories when based on the csv fields.

Main tab
From the main tab you can edit the display title of the page, language and content model. The display title can be left blank to hide the title completely without having to deal with css tricks.



Version 1.1.0 improvements:
 * support for default values of display title and language
 * language is correctly shown in the Page information page
 * display title is added to the Page props table so that it can be autonomously handled by other extensions, like Display Title
 * Tracking category "Pages with PageProperties"
 * if content model is "plain text", the font of page content will be set to monospace, and white spaces (like new lines) will be preserved unless when necessary to fill line boxes (css: )

Version 1.2.0 improvements:
 * added "html" content model
 * enhanced data structure (default keys now use the kebab-case convention) and it is unlikely that the present data structure will change in future
 * properties can be shown within their dedicated slot under a dedicated tab on the navigation (Attention: currently the content model of the slot is correctly displayed only on Mediawiki 1.38 and above, in other versions the content of additional slots will be shown using the content model of the main slot)
 * the accessibility of the PageProperties special page can be managed through the dedicated rights "Can edit page properties (Page Properties)" and "Can manage property declarations (Page Properties)" (in case that Semantic MediaWiki is installed). By default sysops and bureaucrats have both privileges. (see section )

(for this tab to be shown, set the parameter  to true)

-

Semantic properties tab
From the Semantic properties tab you can assign semantic properties to wiki pages without annotating them manually. Since version 1.2.0 properties can be created or added to the page through a OOUI interface which in future versions of PageProperties might be saved as Page forms (so that a specific set of properties can be reused for other pages).

Set properties will be visible on the SMW FactBox and they will be correctly handled by askqueries.



Version 1.1.0 improvements:
 * no edit of the Semantic MediaWiki source code necessary
 * fields type are automatically shown as placeholder, also for imported properties
 * properties are stored using a dedicated slot (that means that properties are stored next to the standard revisions of the page, and they will be preserved even if the extension will be uninstalled)
 * property definitions can be created using the "Manage Properties" special page (this page has been removed on the current version, 1.2.0)
 * JSON-LD automatically created from set properties (also if manually annotated in the page as usual)

Version 1.2.0 improvements:
 * properties are handled through a more robust interface/design
 * each property can be associated with a preferred input type (see next picture) based on their datatype
 * each input can have multiple fields, or it can allow the insertion of multiple values, like OO.ui.TagMultiselectWidget
 * Mediawiki's custom inputs supported, like for instance,  ,  , plus a discrete number of other OOUI inputs (other might be added in future)
 * All the SMW special properties related to properties can be managed/assigned to a property through a helpful interface

Here is the main panel with properties associated to the page. The settings icon besides fields allows to define a property, its datatype, the preferred input, and more. It is only visible to sysops, bureaucrats and to users with the right "Can manage property declarations (Page Properties)".



Once that the properties have been defined, they can be added to a specific page through the dropdown below:



A property is defined by its name or label (i.e. the name of the page in the "Property:" namespace), its type, and additional options (which will be automatically saved in the property page by the extension) which define it. Namely, any imported vocabulary available on the wiki, whether the property allows for multiple fields, and the preferred input. All that is internally handled and you don't need to manually deal with property declarations and special properties related to properties !



List of available inputs. The list interactively changes based on the property datatype, the state of the toggle "multiple inputs", and other options assigned to a property (see below)



Additional options for properties. Namely the field Allows value allows to set predefined values for the input, therefore enabling additional input types, like, 		 , ,,.



The list of available properties can be viewed and navigated through the following datatable. Properties can be edited through the above mentioned window, deleted and renamed. Note the switch editor icon indicated by the arrow, to switch between panels.



When you delete/rename a property all the pages containing that property will be affected as well, and the property will be either deleted or renamed on all relevant pages, so take into account the following tip!

-

SEO
From the SEO tab you can easily add meta tags or properties to specific pages or the entire wiki.

If the extension Extension:wikiSEO is installed, PageProperties will show a combobox with the parameters allowed by the extension, and they will be internally handled by the WikiSEO extension itself without the need to manually annotate them on the page.

Note that the checkbox "apply to entire wiki" will be only shown if the properties are related to the Main Page of the wiki.



available combobox when the Extension:wikiSEO extension is installed

JSON-LD
JSON-LD (JavaScript Object Notation for Linked Data) is a method of encoding linked data using JSON (from Wikipedia). PageProperties automatically includes the ontology associated with the page, if any, in the following form { "@context": { "name": "http://xmlns.com/foaf/0.1/name", "homepage": { "@id": "http://xmlns.com/foaf/0.1/workplaceHomepage", "@type": "@id" },   "Person": "http://xmlns.com/foaf/0.1/Person" }, "@id": "https://me.example.com", "@type": "Person", "name": "John Smith", "homepage": "https://www.example.com/" }

This feature is available when PageProperties is used in conjunction with Semantic MediaWiki, and is especially useful, for the purpose of search engine optimization, when the wiki contains pages describing schema.org items, like Person, Book, Organization and more.

See here for more information how Google handles that. As an example, here are the properties expected by Google for an item of type "book", so in order to have a wiki page recognized by Google as a book, you have to do the following steps:


 * create a page with title MediaWiki:Smw_import_schema in your wiki and add all or a subset of the following vocabulary
 * go to the special page "Manage Properties" and create one or more properties associating them to a schema.org property in the imported field. For instance the property "Book title" could be associated to the schema property "schema:name". (see here for all the properties which define a book based on the schema.org reference)
 * go on the "categories" tab on the same special page (available since PageProperties 1.2.1) and create one or more categories (one for each kind of item you want to represent) as above, associating to them a schema.org item using the "imported" field (for the "Books" category the corresponding schema.org item is "schema:book")
 * now create one or more wiki pages representing a book (either a book edition, or a work and associate to them the relevant properties created before through the special page "Page Properties", "semantic properties" tab
 * that's it! Now your book item in the wiki is fully recognizable by search engines or other platforms for linked data and highly accessible on the Web!

Configuration
The extension works at its best when used in conjunction with Semantic MediaWiki, WikiSEO and Display Title. However, none of them are necessary, when used without Semantic MediaWiki the semantic tab will be omitted, when used without WikiSEO meta tags have to be entered without a dropdown, and when used without Display Title it is possible that the alternate page title cannot be used for linking.

Global parameters

(if both  and   are set to , the PageProperties special page will be not accessible)

Rights and privileges
The extension creates the user rights "Can edit page properties (Page Properties)" and "Can manage property declarations (Page Properties)" and the group memberships "editor of page properties (Page Properties)" and "editor of property declarations (Page Properties)".

Sysops and bureaucrats are assigned to such groups by default. If you want to grant regular users the right to manage the properties related to pages or to manage property declarations (where SemanticMediaWiki is installed), use the special page Special:UserRights.

Known issues

 * Since version 1.2.0 PageProperties works well with wikis containing up to a few hundreds of property declarations (i.e. pages in the "Property:" namespace). If the wiki contains thousands of property declarations, you could experience slow downs.
 * The combobox of Mediawiki's OOUI library does not display optgroups correctly on menus (i.e. they will not show as in this picture). I will report the issue to the authors of the library.

Support & bugs
Please post error messages in the Talk page of the extension. Updates will be posted on the Semantic MediaWiki user list and occasionally in the MediaWiki's Wikitech mailing list.