Table of Contents
Meta Plugin
Compatible with DokuWiki
- 2024-02-06 "Kaos" unknown
- 2023-04-04 "Jack Jackrum" unknown
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" yes
Similar to custommeta, description, htmlmetatags, keywords, metaeditor, metaheaders, pagetitle
Needed for pagetemplater
Description
This plugin allows you to set metadata for a page. This is useful for overriding default DokuWiki metadata, for example if you want to display someone else than the user who pasted the text into the wiki as the author of a blog entry.
Syntax
~~META: key = value ~~
key | the metadata element to set | required |
---|---|---|
value | the metadata element content | required |
You can set more than one element at once by using an &
delimiter. Further, to set a child element, separate key and subkey with a space. Additional whitespace is allowed. Dates should be entered in the form YYYY-MM-DD hh:mm:ss
. Two dates with an arrow (->
) in between are considered as a period.
An example
~~META: creator = Esther Brunner &date valid = 2006-04-15 -> 2006-10-15 ~~
Data Structure
It is mandatory to use Dublin Core element names as keys for all metadata that might be interesting for external use. These are:
Element | Child Elements | Type | Comments |
---|---|---|---|
title | — | string | will be used for window title and links if $conf['useheading'] is on; defaults to the first heading |
creator | — | string | indicates the primary author of a page; defaults to the full name of the user who created the page |
subject | — | string | used by the blog plugin / tag component: list of space separated tags; not set by default |
description | tableofcontents, abstract | array | tableofcontents is an array of the TOC items with keys hid (header ID), title , type and level ; abstract is 250 to 500 char raw text from the beginning of the page used for the RSS feed |
publisher | — | string | not used |
contributor | — | array | a list of all users who have made non-minor contributions to the page; every item has the user ID as key and the full name as value |
date | created, valid, available, issued, modified | array | a timestamp (or an array of the timestamps start and end for a period); date created is filled with the creation date by default, date modified with the date of the last non-minor edit; the rest is not set by default |
type | — | string | not set, but defaults to “text” when exported; recommended values are: collection, dataset, event, image, interactiveresource, movingimage, physicalobject, service, software, sound, stillimage or text |
format | — | string | a MIME type is expected; not set, but defaults to “text/html” when exported |
identifier | — | string | a unique ID of the page; not set, but defaults to the page ID when exported |
source | — | string | not used |
language | — | string | a two-letter language code is expected; not set, but defaults to the chosen language for DokuWiki when exported |
relation | isversionof, hasversion, isreplacedby, replaces, isrequiredby, requires, ispartof, haspart, isreferencedby, references, isformatof, hasformat, conformsto | array | each of the child elements can contain a list of pages that stand in the indicated relation to the current page; the page ID serves as key, the existence of the page as value; in references, DokuWiki keeps track of which pages are linked by the current page; |
coverage | spatial, temporal | array | not used |
rights | accessrights, license | array | not set, but accessrights default to “public editable”, “public viewable” or “private” with respect to current ACL settings; license defaults to the Creative Commons license if set |
Bugs / Feature Requests
Please report bugs or feature requests at the Bug tracker.
Further Resources
Changes
- Version upped (2024-08-07 23:50)
- Merge pull request #14 from fiwswe/fiwswe-patch-1 (2024-08-07 20:56)
- Fix typo (2024-08-07 19:27)
- Merge pull request #13 from fiwswe/fix_issue_12 (2024-08-07 12:46)
- remove deprecated require_once and more (2024-08-06 19:28)
- Update plugin.info.txt (2021-10-16 16:22)
- Update plugin.info.txt (2021-10-16 16:22)
- add type void in unit test (2021-10-16 16:22)
Discussion
This is quite nice. I'm thinking being able to set metadata on pages would be much more useful if combined with searching facilities to then display stuff based on those searches.
Sorry but this is completely out of the scope of this plugin. — Michael Klier 2008/04/19 22:08
Perfect plugin - almost :) It seems that the feed.php of DokuWiki does not care about the META Tag. Is this a bug or a feature?
Secondly: wouldn't it be nice to be able to overwrite the “original” metadata of DokuWiki with the contents of the META Tag? Or is it out of scope?
Has this plugin gone the way of the Dodo Bird? I'd like to use it, but clicking the download link gives me a 404. — tony baldwin 2011/05/04 20:45
This should have been fixed as it is working perfectly right now. — Olivier Humbert 2015/07/25 12:31
DublinCore and plugin limitations
You should change “It is recommended to use Dublin Core element names as keys…” to something in the lines of “It is mandatory for keys of added metadata to be part of the set of allowed Dublin Core element names…”; this given that, as the DokuWiki metadata parser will only accept DublinCore keys and no custom keys, any uninformed attempt to add metadata to a page will fail miserably. I assume that's what has happened in the comment above.
You're right of course. I've changed it. — Michael Klier 2008/04/19 22:08
It's rather sad, as even through the plugin's syntax can be easily adapted to also accept http-equiv
metadata (such as Refresh or Encoding), the DW parser itself will not allow it. Otherwise, thanks for this plugin. — This comment 2008-02-10 by ryan.chappelle
at his site
Complications
Hi, I don't get the Plugin to work.[…].— This comment 2008-05-05 by david
I found the Error myself. It was a outdated Template that I used.— This comment 2008-05-05 by
david
It did not work on my site (latest release - incognitek template), it did not change my pages … How can I proceed to see what's wrong ? This comment 2008-11-01 by Julien
It does work right now. Is it still wrong for you ? Olivier Humbert - 2015-07-25 12:33
I wonder how to make the array definitions - is there a bug or am I doing something wrong? I tried it in PHP style because the source looked as it would be treated that way:
~~META: relation haspart = array("testpage" => "1") ~~
and just got PHP execution errors This comment 2009-05-22 by Marcel Lemke
This is not how this was supposed to work, now you can use~~META:relation haspart=testpage~~
and the plugin will automatically determine if the page exists and set the metadata appropriately. — Michael Hamann 2015-07-24 21:50
Hi, i want to set keywords for the searchengines but it do not work … only change the META:title will work.
What will be wrong?
~~META: title = titletext &keywords = keyword1 keyword2 keyword3 &audience = alle &page-topic = topic of the pages ~~
This comment 2016-01-02 08:08 by Wolf
Simple patch that allows to use Metadata in your pages
--- syntax.php.orig 2019-08-15 16:10:59.057459368 -0400 +++ syntax.php 2019-08-16 02:29:46.258100543 -0400 @@ -43,4 +43,6 @@ function render($mode, Doku_Renderer $renderer, $data) { - if ($mode == 'xthml') { - return true; // don't output anything + if ($mode == 'xhtml') { + global $ID; + foreach($data as $key=>$value) + if($key && (!$value or is_array($value) && !current($value))) $renderer->doc .= strtr(p_get_metadata($ID, $key.' '.($value?key($value):'')), $data[(string) NULL]?:array()); } elseif ($mode == 'metadata') { @@ -89,3 +91,3 @@ // no special treatment for the rest - } else { + } elseif( $key && $value ) { $renderer->meta[$key] = $value;
Now you can put to your pages something like:
My creator is ~~META:creator~~! ~~META:creator & superadmin=Yay, page created by superadmin! & shyuser=Oh, page created by very modest user.. ~~
And don't forget that DokuWiki allows you to store any custom Metadata!
— ann. / OÜ Narayana 2019-08-16 06:55
How to use the plugin
Please read http://forum.dokuwiki.org/post/15988 about how to use the plugin. Rolf Hemmerling 2009-12-05