DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:metaheaders

MetaHeaders Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" yes
  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes

plugin Lets you add/remove meta headers dynamically

Last updated on
2020-08-05
Provides
Action
Repository
Source

Similar to description, meta

Tagged with htmlheaders, meta

Needed for zerolinecss

About

“MetaHeaders” allows to add/remove meta headers dynamically to your Wiki pages.

Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Repository (for developers)

The source code of this plugin is available as Git repository.

Verify download (for geeks)

See CHECKSUMS.asc for MD5, SHA-1 and SHA-256 checksums. The file is signed with the GnuPG/PGP key (0x423B2839). You can use gpg --verify ./CHECKSUMS.asc to check/validate it.

Support

If you need help:

If you found nothing helpful, ask your question at the DokuWiki forum (preferred) or IRC channel.

Contact

If you think you have found a bug or have a useful idea (a.k.a. “feature request”), create an issue on GitHub (preferred), or contact us by mail.

Feel free to submit patches as GitHub pull requests (preferred) or by mail as well. However, please try to respect the DokuWiki coding style as this plugin follows its rules.

Update

Simply install the newest version over the existing one. If you got any problems, remove the plugin and re-install it. The configuration file holding your data and the plugin itself are stored separately. This means you can remove, update or re-install this plugin without loosing your MetaHeaders config data.

Usage

At the moment, there is no graphical interface available to modify the configuration of this plugin. For now you have to edit the configuration file with an UTF-8 capable text editor of your choice.

After you've installed the plugin you have to create a file named <dokuwiki>/conf/metaheaders.conf.php. The plugin uses simple PHP arrays to hold the data for interacting with the meta headers.

Removing Meta Headers

To remove some headers, for example if you like to replace them with your own (like RSS feeds for example) you have to use the $clear array. Each array item will be matched against the used metaheaders, only if all “keywords” match the header is removed from the output.

The following example will remove all RSS feed headers from the headers output.

$clear[] = array ('type' => 'application/rss+xml');

The following example will remove only the RSS feed for the recent changes (because it will also match against the “title”).

$clear[] = array ('type' => 'application/rss+xml', 'title' => 'Recent Changes');

The plugin also supports a cond (condition) array key. This one can be set to a regular expression which will be matched against the current page id. The following example will remove all RSS headers for pages in the namespace blog.

$clear[] = array ('type' => 'application/rss+xml', 'cond' => '^blog:*');

Adding Meta Headers

The plugin uses the $headers array in the configuration for adding new meta headers. This array holds two subarrays link and meta for those two header types.

The following example adds a new RSS header to every page.

$headers['link'][] = array('type'  => 'application/rss+xml',
                           'rel'   => 'alternate',
                           'title' => 'Blog RSS',
                           'href'  => 'https://feeds.feedburner.com/blog_feed');

You can also use the cond array key to add a header only for a given page/namespace. The following will add the above RSS header only for pages in the namespace blog.

$headers['link'][] = array('type'  => 'application/rss+xml',
                           'rel'   => 'alternate',
                           'title' => 'Blog RSS',
                           'href'  => 'https://feeds.feedburner.com/blog_feed',
                           'cond'  => '^blog:*');

The following example will add a new meta header DC.title to every page on the Wiki.

$headers['meta'][] = array('name' => 'DC.title', 'content' => 'yourdomain.org');

Again you can use the cond array key to restrict the addition of the header to certain pages/namespaces.

$headers['meta'][] = array('name' => 'DC.title', 'content' => 'yourdomain.org', 'cond' => '^blog:.*');

Finally you can use substitution patters in each value of the array items in the $header array which will be replaced with the appropriate content (if however, the values are empty the headers will not be added!).

The following patterns are supported. All values are looked up in the global $INFO array, if they're not present the header isn't added!

Pattern Replace Value
@ID@ The Wiki Page ID
@AUTHOR@ The author name
@CREATED@ The creation date of the page
@LASTMOD@ Last modification date
@ABSTRACT@ The first paragraph of the current page
@TITLE@ The page title
@RELATION@ Pages that link back to the viewed page
@CONTRIBUTORS@ Comma separated list of Wiki users who have contributed to a page

( I am thinking of a more dynamic way for these replacements so that this plugin can be used with all information which is hold in a page meta data or optionally set with the meta plugin )

The following example adds a new header with the abstract description of a page.

$headers['meta'][] = array ('name' => 'description', 'content' => '@ABSTRACT@');

FAQ

How can I check which version is currently installed?

Simply have a look at /lib/plugin/metaheaders/VERSION. This is a textfile containing the version you are using (e.g. 2012-03-07). Or have a look at the Extension manager.

Version history

Older releases are no longer recommended for usage and are listed for reference only.

MetaHeaders version Download Designed for and tested on DokuWiki Comment
2014-02-09 Release 2013-12-08 “Binky”,
2012-10-13 “Adora Belle”
No functional changes, just some minor doc and coding style updates.
2012-03-07 Release 2012-01-25 “Angua”,
2011-05-25b “Rincewind”
No functional changes, just some minor doc and coding style updates.
Pre 2012-03-07 ≤ 2010-11-07a “Anteater” All older versions were maintained and developed by Michael Klier. There will be no more support for them, please follow the update instructions to get a supported version.

Latest changes

For a complete change log, see the commits on GitHub.

plugin/metaheaders.txt · Last modified: 2023-09-05 07:25 by s-sahara

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki