| Download | meta_yaml.zip (12.4KB) |
|---|---|
| Version | 2009-06-28 |
This plugin requires PHP 5.2.3 or later
This plugin is still experimental.
This plugin sets and shows DokuWiki meta data. It can also modify the meta headers such as 'description' or 'keywords' of a specific page. This plugin may be attractive for template designers and plugin developers.
There was a similar plugin, 'meta plugin'. But the functionalities were limited and it didn't support array data. Since array data is essential for meta data, this plugin applies a YAML format for a syntax of meta data.
YAML - Official site
What should be concerned about YAML
You can describe any kind of meta data with YAML between <meta_yaml> and </meta_yaml>.
You can display YAML-formatted meta data of the page by using 'list' or 'print_r' command.
<meta_yaml>
# Hashed data (block)
Sites:
Site1: http://www.google.com/
Site2: http://www.yahoo.com/
# Hashed data (inline)
Sites: { Site1: http://www.google.com/, Site2: http://www.yahoo.com/ }
# Collection (block)
SiteNames:
- Google
- Yahoo
# Collection (inline)
SiteNames: [Google,Yahoo]
# Show those data in the page as print_r format
command:
- { print_r:Sites }
- { print_r:SiteNames }
</meta_yaml>
After save the page, you can see meta data that you set above.
-----------------------
Meta YAML plugin output
-----------------------
-------------
print_r Sites
-------------
Array
(
[Site1] => http://www.google.com/
[Site2] => http://www.yahoo.com/
)
-----------------
print_r SiteNames
-----------------
Array
(
[0] => Google
[1] => Yahoo
)
---------------
list
The 'list' command shows specific/all meta data with YAML format.
<meta_yaml>
command:
- { list:description }
- { list:all }
</meta_yaml>
The array of meta data will be shown by YAML format. You can see that YAML format is human-friendly format.
----------------
list description
----------------
tableofcontents:
- { hid: meta-yaml_plugin, title: 'meta-YAML plugin', type: ul, level: 1 }
- { hid: introduction, title: Introduction, type: ul, level: 2 }
- { hid: what_it_can_do, title: 'What it can do', type: ul, level: 1 }
- { hid: why_yaml, title: 'Why YAML ?', type: ul, level: 2 }
...
print_r
The 'print_r' command is similar to the list command, it shows meta data with print_r format instead.
<meta_yaml>
command:
- { print_r:description }
- { print_r:all }
</meta_yaml>
The array of meta data will be shown by print_r format of PHP.
-------------------
print_r description
-------------------
Array
(
[tableofcontents] => Array
(
[0] => Array
(
[hid] => meta-yaml_plugin
[title] => meta-YAML plugin
[type] => ul
[level] => 1
)
[1] => Array
(...
You can replace or append some data to meta-header such as 'description', 'keywords', etc. Set key-value sets in a 'meta-headers' array.
If you use '%abstract%' or '%keywords%', they are replaced by a first section or tags from Tag plugin.
<meta_yaml> # Abstract for the page meta-headers: description: This is an instruction page for the meta_yaml plugin. </meta_yaml> <meta_yaml> # Using first section as an abstract of the page meta-headers: description: %abstract% # Tag plugin put the tags in 'keywords' meta-header. You can append some keywords to tags. meta-headers: keywords: %subject%,plugin,instruction </meta_yaml>
Download and extract meta_yaml.zip and place it in lib/plugins/ directory.