2 # Ikiwiki metadata plugin.
3 package IkiWiki::Plugin::meta;
13 IkiWiki::hook(type => "preprocess", id => "meta",
14 call => \&preprocess);
15 IkiWiki::hook(type => "pagetemplate", id => "meta",
16 call => \&pagetemplate);
19 sub preprocess (@) { #{{{
25 my $value=$params{$key};
27 my $page=$params{page};
30 eval q{use CGI 'escapeHTML'};
34 $meta{$page}='' unless exists $meta{$page};
35 $meta{$page}.="<link href=\"".escapeHTML($value)."\" ".
36 join(" ", map { escapeHTML("$_=\"$params{$_}\"") } keys %params).
41 push @{$IkiWiki::links{$page}}, $value;
44 elsif ($key eq 'title') {
45 $title{$page}=escapeHTML($value);
48 $meta{$page}='' unless exists $meta{$page};
49 $meta{$page}.="<meta name=\"".escapeHTML($key)."\" content=\"".escapeHTML($value)."\" />\n";
55 sub pagetemplate ($$) { #{{{
59 $template->param(meta => $meta{$page}) if exists $meta{$page};
60 $template->param(title => $title{$page}) if exists $title{$page};