Extension:Metadata/ja

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
MediaWiki 拡張機能マニュアル
Metadata
リリースの状態: 実験的
説明 Adds #metadata parser function to set page properties, and expose them via ‎<meta> tags and a REST API endpoint
作者 Sophivorustalk
MediaWiki
ライセンス ライセンス未指定
ダウンロード
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
translatewiki.net で翻訳を利用できる場合は、Metadata 拡張機能の翻訳にご協力ください

The Metadata extension adds the #metadata parser function to set page properties, and exposes them via ‎<meta> tags and a REST API endpoint.

インストール

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/Metadata/ja</tvar>|Download]] and move the extracted <tvar name=name>Metadata/ja</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Metadata%2Fja
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'Metadata/ja' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

使用法

To set a simple key-value pair for the current page:

{{#metadata:key=value}}

And to set multiple key-value pairs in a single call:

{{#metadata:
| key = value
| foo = bar
| baz
}}

Keys with no value will be assigned a "1" value.

Once set, the properties will be accessible via the HTML <meta> tags, like so:

<meta name="key" content="value" />
<meta name="foo" content="bar" />
<meta name="baz" content="1" />

And also, via the "props" endpoint introduced by this extension to the MediaWiki REST API, with the following URL pattern:

/w/rest.php/v1/page/{title}/props

Finally, the properties can also be accessed via the Properties module of the MediaWiki Action API, with the following URL pattern:

/w/api.php?action=query&prop=pageprops&titles={title}

関連項目