Extension:PageProperties/Legacy
PageProperties Release status: stable |
|
---|---|
Implementation | Hook , Special page |
Description | Allows users to easily edit the display title, language and content model of a page; to associate semantic properties with pages without having to manually annotate them (provided that Semantic MediaWiki is installed); and to set SEO metadata for the entire wiki or for specific pages |
Author(s) | thomas-topway-it (thomas-topway-ittalk) |
Latest version | 1.2.5c (2023-03-27) |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | >= 1.35.0 |
License | GNU General Public License 2.0 or later |
Download | |
|
|
|
|
Quarterly downloads | 31 (Ranked 102nd) |
Translate the PageProperties/Legacy extension if it is available at translatewiki.net | |
PageProperties allows users to easily edit the display title, language and content model of a page; to associate semantic properties with pages without having to manually annotate them (provided that Semantic MediaWiki is installed); and to set SEO[1] metadata for the entire wiki or for specific pages.
The extension adds an action to the top menu of wiki articles through which authorized users can set all the relevant properties of the page.
Since version 1.2.4 PageProperties features a complete GUI for the creation of semantic properties, semantic categories and semantic forms, completely based on OOUI[2] and slots !
The extension adds a tab "Edit semantic" to the page navigation, a section "Page Properties" in the sidebar, and adds a link "More > Properties" to the page menu action. The visibility of each of them can be managed using the parameters below
Installation
- Download and place the file(s) in a directory called
PageProperties
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php
wfLoadExtension( 'PageProperties' );
- optionally run
composer update --no-dev
in the extension's folder, this will install the required libraries to annotate JSON-LD[3] within the page (see section below to find out more) - Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Page Properties
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.
Key features
- set 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
- optional tracking category "Pages with PageProperties"
- support for html content model and enhanced support for plain text content model (in this case, the font of page content will be set to monospace, and white spaces/new lines will be preserved unless when necessary to fill line boxes)
- properties are recorded within a dedicated slot on the related page and can be shown through the tab "properties" on the page menu (Attention: currently the content model of the slot is correctly displayed only on MediaWiki 1.38 and above, in other versions it will use the content model of the main slot)
(this tab is shown when the parameter $wgPagePropertiesShowSlotsNavigation
is set to true
or the user has pageproperties-canmanagesemanticproperties
right)
SEO tab
From the SEO[1] tab you can easily add meta tags or meta properties to specific pages or the entire wiki.
If the extension Extension:wikiSEO is installed, PageProperties will provide 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 wikiSEO extension is installed
Edit semantic
(this feature is only available when Semantic MediaWiki is installed)
From the "Edit semantic" tab you can interactively assign semantic forms and single semantic properties to wiki pages without using parser functions and without annotating them manually on the page.
Set properties will be visible on the SMW FactBox and they will be correctly handled by askqueries.
Here are the two "entry-points" to respectively add/remove forms to/from a page and add/remove single properties (unrelated to a specific form) to/from a page. Each property is associated to a OOUI input widget and can allow multiple fields.
This is a form once added to a page. The form is composed of properties defined through the "Manage properties" special page (see below) and then grouped in a form defined through the same page. Forms can be also used to create new articles as in Extension:PageForms (see also Manual:Forms ).
The relevant sections for creating properties, categories, and even forms, are accessible from the "Edit semantic" tab itself, through the following icon (except for the tab "Semantic import" which is only accessible from the "Manage properties" special page)
Key-features
- multiple forms and single properties can be interactively added to any wiki page
- each form can feature their own default categories, pagename formula (only for new pages) and content model. When different between each other the user is provided with a radio input, to select the desired values
- a large set of native OOUI inputs are available and can be added to a form through a simple interface
- properties and forms can be edited/created seamlessly, without to leave the interface
- supports the upload of multiple files
Manage properties
From the "Manage properties" special page you can create/edit semantic properties, semantic categories, semantic forms and even to perform a semantic import based on csv files.
Properties tab
This is where you can define a property. Supported options:
- property type (any of those listed here)
- imported vocabulary (see here)
- multiple fields
- preferred input
- all options related to properties listed here
A large set of native Mediawiki's, and OOUI native inputs are supported, like:
- mw.widgets.DateInputWidget
- mw.widgets.datetime.DateTimeInputWidget
- mw.widgets.CategoryMultiselectWidget
- mw.widgets.TitlesMultiselectWidget
- mw.widgets.UsersMultiselectWidget
- OO.ui.MultilineTextInputWidget
- OO.ui.TagMultiselectWidget
- OO.ui.ComboBoxInputWidget
- OO.ui.SelectFileWidget
- International Telephone Input for telephone_number data type
This demos page allows you to create web-applications using OOUI in JS or PHP Try it!
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!
Tip Either execute continuously maintenance/runJobs.php through a cronjob, or set $wgJobRunRate to a high value, for instance 50, to ensure property definitions are updated in real time |
Categories tab
This is where you can define a category. Supported options:
- each category can be associated with any imported vocabulary saved on the wiki.
Forms tab
This is where you can define a form. Supported options:
- pagename formula or title widget input
- show/hide free text input
- default categories
- default content model
This is where (in the same window) you can assign fields to a form. Fields can be rearranged and through buttons located besides each of them you can access the related property window, and the field window.
This is where you can define the property/field assigned to a form. Supported options:
- required and default values
- custom label (can override the property label with a localized message)
- custom help text (can override with a localized message the property description if any)
- preferred input (can override the same attribute of the related property)
- option-values for multiple choice inputs retrieved from property declaration, hard-coded values, wikilist or an ask query (see here)
- mapping-formula - for inputs that are multiple choices, allow you to modify how they are displayed in the form, without modifying the actual property value, similar to mapping template in the PageForms extension.
- multiple values (can override the same attribute of the related property)
- on create only (whether the input should be used only to compose the form pagename formula)
Created forms will be listed in a dedicated section in the sidebar, as follows:
Import tab
From the "Import" tab you can import in your wiki csv files, mapping their fields to semantic properties defined or to be defined in the wiki. Also large set of csv lists can be incrementally imported and even previewed before the actual import through the interface. A page will be created for each csv entry, with a large set of options in order to define the target pagename, the page content, values separator, defined categories, and more !
Here is where you can upload/drop the cvs file to be imported.
Here is where you can check the consistency of your data and to set/remove the heading.
Here is where you can map the csv fields to semantic properties recorded in the wiki and even to create new properties on the fly.
Here is where you can preview the import, so to avoid or to minimize mistakes: note indeed that by default a single wiki page will be created for each csv entry.
Parser functions
Function #pagepropertiesform
The #pagepropertiesform
parser function can be used to display multiple forms in any wiki page, each of them composed by multiple forms (handled as form sections).
Simply create a form through the interface as shown above, then use the following wikitext to render a composite form on the page.
{{#pagepropertiesform: Form a
|Form b
|Form c
}}
where "Form a", "Form b" and "Form c" are the names of different forms. After you have placed the forms on an article of your choice, a form submission will either create a new article based on the form's pagename formula or the title entered by the user in the form itself, or will trigger an error in case that an article with the same title already exists. By contrast, in order to edit the semantic properties of the current article, just use the Edit semantic tab. Finally, through this parser function, an arbitrary number of forms can be inserted in any article in the desired position.
Function #pagepropertiesformbutton
The #pagepropertiesformbutton
parser function can be used to display a link button pointing to a new form rendered in a special page.
The new form, as above, can in turn be composed by multiple forms.
{{#pagepropertiesformbutton: text
|Form a
|Form b
|Form c
|button-type=
|class=
}}
where "text" is the button's text, "Form a", "Form b" and "Form c" are the forms to be rendered on the special page, "button-type" is an optional parameter to determine whether the form button will be rendered as button or as text (use the values "button" and "text"), and class is an optional parameter to add to the button link one or more classes.
Function #pageproperties
The #pageproperties
parser function can be used to easily display the semantic properties associated to a page, using templates, both for the given set of properties, and for each value of a given property (useful when a property contains multiple values, for instance pictures to be rendered in some way)
Example 1
{{#pageproperties: {{FULLPAGENAME}}
|?First name
|?Email
|values-separator=,<nowiki> </nowiki>
|separator=<br>
}}
Example 2
{{#pageproperties: {{FULLPAGENAME}}
|?Organization name
|?Email
|template=Organization
|template?Logo=Organization logo
}}
Here the parser function will retrieve the value of the semantic property Organization name
, Email
, will display the Logo
using the template "Organization logo", and will display such parameters using the template "Organization" (the value of the property Logo is translated using the desired template)
JSON-LD
JSON-LD[3] is "a method of encoding linked data using JSON" (source: w:JSON-LD). 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.
Be sure to run composer update --no-dev in the extension's folder to enable this feature! |
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
variable | description | default |
---|---|---|
$wgPagePropertiesDisableJsonLD |
disable creation of JsonLD from semantic properties to be added in the source code of the page | false
|
$wgPagePropertiesShowSlotsNavigation |
show slots tabs on the navigation panel | conditional (n) |
$wgPagePropertiesAddTrackingCategory |
add the Tracking category "Pages with PageProperties" on pages containing properties | false
|
$wgPagePropertiesDisableSidebarLink |
hide the link to the PageProperties special page on the sidebar | false
|
$wgPagePropertiesDisableNavigationLink |
hide the link to the PageProperties special page on the navigation panel | false
|
$wgPagePropertiesOpenExternalLinksInNewTab |
inserts an attribute target="_blank" to all external links, so they open in a new tab |
false
|
$wgPagePropertiesDisplayAlwaysUnprefixedTitles |
display unprefixed titles for all namespaces, also those not explicitly set through the extension | false
|
$wgPagePropertiesCreateJobsWarningLimit |
number of jobs created without emitting a notice | 0
|
$wgPagePropertiesDisableVersionCheck |
disable version check of the extension | false
|
(n) true
if user has right pageproperties-canmanagesemanticproperties
, otherwise false
(if both $wgPagePropertiesDisableSidebarLink
and $wgPagePropertiesDisableNavigationLink
are set to true
, the PageProperties special page will be not accessible from the interface)
Rights and privileges
The extension creates the following user rights. They can be both included manually in the LocalSettings.php or to be managed through the interface (special page Special:UserRights). Sysops and bureaucrats are assigned with the complete set of permissions by default.
Rights
variable | description |
---|---|
pageproperties-caneditpageproperties |
Can edit page properties |
pageproperties-caneditsemanticproperties |
Can edit semantic properties |
pageproperties-canmanagesemanticproperties |
Can manage semantic properties |
pageproperties-cancomposeforms |
Can compose forms |
pageproperties-canaddsingleproperties |
Can add single properties |
Example configuration
$wgPagePropertiesDisableJsonLD = true;
$wgGroupPermissions['*']["pageproperties-caneditpageproperties"] = false;
$wgGroupPermissions['*']["pageproperties-caneditsemanticproperties"] = true;
$wgGroupPermissions['*']["pageproperties-canmanagesemanticproperties"] = false;
$wgGroupPermissions['*']["pageproperties-cancomposeforms"] = false;
$wgGroupPermissions['*']["pageproperties-canaddsingleproperties"] = false;
Groups
group (pageproperties-) | Can edit page properties | Can edit semantic properties | Can manage semantic properties | Can compose forms | Can add single properties |
---|---|---|---|---|---|
admin |
|||||
editor |
|||||
pagepropertieseditor |
|||||
semanticpropertieseditor |
Known issues
- Subsequent edits of the name of a file through the specif implementation of
OO.ui.SelectFileWidget
do not yet update the name of the published file. This will be fixed on a coming version. - rename of properties does not yet reflect on form descriptors
- if the dedicated slot does contain unregistered properties, they won't be shown in the Edit semantic special page. This could change in future.
Demo & testing
You are welcome to test the extension on wikienterprise.org Try it !
Latest improvements
pagepropertiesform
andpagepropertiesformbutton
parser functions (forms can be inserted in any wiki article)- native input validation (with regard of the required attribute) for all OOUI inputs
- dynamic option values for multiple choice input widgets, based on user's entered values, wiki-lists, and ask queries
- hidden inputs
- value-formula (keeps track of the original value, to be used for subsequent edits)
- renaming/deletion of properties through the interface automatically updates all pages and forms with that property, with a notice about the jobs to be executed
- categories created by the GUI are correctly handled in ask queries
- optimized loading of required data
- additional input widgets, namely Rating and ButtonMultiselectWidget
Roadmap
- option-inputs with search api and infinite scroll (for long lists)
- editable input label (done in version 1.2.5c)
- subitems or subobjects
- form sections (just add an option on the form panel "is form section" to disable other form main parameters, and inherit from the parent form, then add "form group")
- searchable properties in slots and preload content
- dedicated window for options of each available input, as outlined here (OO.ui.TextInputWidget as an example), consistent across Manage Properties and (Form edit's) Edit field
- bulk edit
- additional inputs, like tree and rating (done in version 1.2.5c: rating and multiple toggle buttons)
- support Extension:Semantic Interlanguage Links
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.
For professional support please use this Contact form (an Extension:CIForms 's form)
See also
References
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |