Erweiterung:Metadata
Appearance
Freigabestatus: experimentell |
|
|---|---|
| Beschreibung | Adds #metadata parser function to set page properties, and expose them via <meta> tags and a REST API endpoint |
| Autor(en) | SophivorusDiskussion |
| Letzte Version | 4.0 |
| MediaWiki | >= 1.39.4 |
| Licence | GNU General Public License 3.0 oder neuer |
| Herunterladen | |
| Übersetze die Metadata-Erweiterung, wenn sie auf translatewiki.net verfügbar ist | |
The Metadata extension adds the #metadata parser function to set page properties, and exposes them via <meta> tags and a REST API endpoint.
Installation
- Die Erweiterung herunterladen und die Datei(en) in ein Verzeichnis namens
Metadataim Ordnerextensions/ablegen.
Entwickler und Code-Beitragende sollten stattdessen die Erweiterung von Git installieren, mit:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Metadata
- Folgenden Code am Ende deiner LocalSettings.php-Datei einfügen:
wfLoadExtension( 'Metadata' );
Erledigt – Navigiere zu Special:Version in deinem Wiki, um zu überprüfen, ob die Erweiterung erfolgreich installiert wurde.
Verwendung
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}
