summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2012-08-04 13:21:56 +0200
committerJonas Smedegaard <dr@jones.dk>2012-08-04 13:21:56 +0200
commitef61d50693dc4e1b828160194436e75cc067f350 (patch)
treefd95fc75235b55d3c841570d80b4a706950dff6f /IkiWiki
parenta2facf37a91aa84133a3956ab14741c758182502 (diff)
Sync with ikiwiki 3.20120516.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/meta.pm21
1 files changed, 14 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 220fff9..421f1dc 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -275,17 +275,23 @@ sub preprocess (@) {
push @{$metaheaders{$page}}, '<meta name="robots"'.
' content="'.encode_entities($value).'" />';
}
- elsif ($key eq 'description') {
- push @{$metaheaders{$page}}, '<meta name="'.
- encode_entities($key).
+ elsif ($key eq 'description' || $key eq 'author') {
+ push @{$metaheaders{$page}}, '<meta name="'.$key.
'" content="'.encode_entities($value).'" />';
}
elsif ($key eq 'name') {
- push @{$metaheaders{$page}}, scrub('<meta '.$key.'="'.
+ push @{$metaheaders{$page}}, scrub('<meta name="'.
encode_entities($value).
join(' ', map { "$_=\"$params{$_}\"" } keys %params).
' />', $page, $destpage);
}
+ elsif ($key eq 'keywords') {
+ # Make sure the keyword string is safe: only allow alphanumeric
+ # characters, space and comma and strip the rest.
+ $value =~ s/[^[:alnum:], ]+//g;
+ push @{$metaheaders{$page}}, '<meta name="keywords"'.
+ ' content="'.encode_entities($value).'" />';
+ }
else {
push @{$metaheaders{$page}}, scrub('<meta name="'.
encode_entities($key).'" content="'.
@@ -312,8 +318,9 @@ sub pagetemplate (@) {
$template->param(title_overridden => 1);
}
- foreach my $field (qw{author authorurl}) {
- $template->param($field => $pagestate{$page}{meta}{$field})
+ foreach my $field (qw{authorurl}) {
+ eval q{use HTML::Entities};
+ $template->param($field => HTML::Entities::encode_entities($pagestate{$page}{meta}{$field}))
if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
}
@@ -324,7 +331,7 @@ sub pagetemplate (@) {
}
}
- foreach my $field (qw{description}) {
+ foreach my $field (qw{description author}) {
eval q{use HTML::Entities};
$template->param($field => HTML::Entities::encode_numeric($pagestate{$page}{meta}{$field}))
if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);