Extension:Metadata

This page is a translated version of the page Extension:Metadata and the translation is 80% complete.
MediaWiki 拡張機能マニュアル
Metadata
リリースの状態: 実験的
説明 Adds #metadata parser function to set page properties, and expose them via ‎<meta> tags and a REST API endpoint
作者 Sophivorusトーク
最新バージョン 4.0
MediaWiki >= 1.35.0
ライセンス GNU 一般公衆利用許諾書 3.0 以降
ダウンロード
Quarterly downloads 3 (Ranked 146th)
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.

インストール

  • ダウンロードして、ファイルをextensions/フォルダー内のMetadataという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Metadata
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'Metadata' );
    
  •   完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

使用法

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}

関連項目