Extension:PageProperties

From mediawiki.org
This page is a translated version of the page Extension:PageProperties and the translation is 29% complete.
Other languages:
MediaWiki 拡張機能マニュアル
OOjs UI icon advanced-invert.svg
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
作者 (thomas-topway-itトーク)
最新バージョン 1.1.0 (2022-08-29)
MediaWiki >= 1.35.0
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
translatewiki.net で翻訳を利用できる場合は、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.1.0 PageProperties includes an additional special page where to create SMW property definitions without to deal with property pages, and is completely based on slots!

PageProperties-screenshot-menu.png

If Semantic MediaWiki is installed it also adds a section in the sidebar

Pageproperties-menu-sidepanel-c.jpg

(otherwise it will add an entry in the Tools section).

インストール

  • Download and place the file(s) in a directory called PageProperties in your extensions/ 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 within the page (see section below to find out more)
  • Yes 完了 – 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 php extensions/PageProperties/maintenance/MigrateProperties.php (this will migrate all properties stored in the dedicated table, to a special slot of related pages)

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.

PageProperties-screenshot-main-update-b.jpg

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 extesions, 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: font-family: monospace; white-space:pre-wrap; word-wrap:break-word; )

Semantic properties tab

From the Semantic properties tab you can register semantic properties to wiki pages without annotating them manually. Same properties can have multiples values, and they will be handled correctly by askqueries and shown on the FactBox.

PageProperties-screenshot-semantic-properties-update-b.jpg

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 (see below)
  • JSON-LD automatically created from set properties (also if manually annotated in the page as usual)

PageProperties-screenshot-semantic-properties-factbox-update.jpg


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.

PageProperties-screenshot-SEO-update.jpg

PageProperties-screenshot-SEO-dropdown-update.jpg


available combobox when the Extension:wikiSEO extension is installed

Manage Properties

The Manage Properties special page allows to create, edit, remove and rename properties without to deal with property pages. Renamed properties already annotated will be automatically updated in all the pages which make use of them. Manage Properties supports properties imported through imported vocabularies and handles correctly their types.

PageProperties-screenshot-manage-properties.jpg

PageProperties-screenshot-manage-properties-dropdown.jpg


List of available property types: they depend both on the default SMW datatyes and the imported vocabulary like schema.org: so it is completely up to you!



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 a subset of the following vocabulary (typically you should include the items and types relevant to your wiki)
  • go to the special page Manage Properties, create a property named for instance "Book title" and assign to it the type schema:name
  • associate a category named for instance Books to the schema.org item type "book" entering [[Imported from::schema:Book]] in the category's page (in a coming version of PageProperties this will be handled by the extension itself)
  • repeat the previous step for all the properties which define a book based on the schema.org reference
  • 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!



設定

The extension works at its best when used in conjunction with Semantic MediaWik, WikiSEO and Display Title. However, none of them are necessary, when used without Semantic Mediawiki the semantic tab will be omitted (as well as the Special page Manage Properties), 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
$wgPagePropertiesAuthorizedEditors single value, comma separated list, or array with groups or users allowed to edit page properties (all tabs)
$wgPagePropertiesAuthorizedAdmins single value, comma separated list, or array with groups or users allowed to manage page properties (i.e. to create/edit properties definitions)

Known issues

  • If you have a lot of properties registered on the wiki, or you are importing a lot of properties from external vocabularies (like for instance the following), the page Manage Properties will take a while to be ready client-side due to OOUI infusion. This can be temporarily solved importing only the required subset of properties from external vocabularies. A coming version of PageProperties will offer an alternate design in order to solve the issue without any requirement or work-around.
  • 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 propose/commit a patch as soon as possible to the official 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.


See also