]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/meta.pm
update info on my split-view setup, and ask for plugin advice
[git.ikiwiki.info.git] / IkiWiki / Plugin / meta.pm
index cd6fa20bab87e3d74a0480e4eefaee08bbd74e2b..28b1a1ad6e69624791492a8582dce79360acee89 100644 (file)
@@ -217,6 +217,13 @@ sub preprocess (@) {
                                'content="'.encode_entities($url).'" />';
                }
        }
                                'content="'.encode_entities($url).'" />';
                }
        }
+       elsif ($key eq 'foaf') {
+               if (safeurl($value)) {
+                       push @{$metaheaders{$page}}, '<link rel="meta" '.
+                               'type="application/rdf+xml" title="FOAF" '.
+                               'href="'.encode_entities($value).'" />';
+               }
+       }
        elsif ($key eq 'redir') {
                return "" if $page ne $destpage;
                my $safe=0;
        elsif ($key eq 'redir') {
                return "" if $page ne $destpage;
                my $safe=0;
@@ -268,13 +275,12 @@ sub preprocess (@) {
                push @{$metaheaders{$page}}, '<meta name="robots"'.
                        ' content="'.encode_entities($value).'" />';
        }
                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') {
                        '" 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);
                        encode_entities($value).
                        join(' ', map { "$_=\"$params{$_}\"" } keys %params).
                        ' />', $page, $destpage);
@@ -301,23 +307,25 @@ sub pagetemplate (@) {
        }
        if (exists $pagestate{$page}{meta}{title} && $template->query(name => "title")) {
                eval q{use HTML::Entities};
        }
        if (exists $pagestate{$page}{meta}{title} && $template->query(name => "title")) {
                eval q{use HTML::Entities};
-               $template->param(title => encode_numeric($pagestate{$page}{meta}{title}));
+               $template->param(title => HTML::Entities::encode_numeric($pagestate{$page}{meta}{title}));
                $template->param(title_overridden => 1);
        }
 
                $template->param(title_overridden => 1);
        }
 
-       foreach my $field (qw{author authorurl permalink}) {
+       foreach my $field (qw{author authorurl}) {
                $template->param($field => $pagestate{$page}{meta}{$field})
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
        }
 
        foreach my $field (qw{permalink}) {
                $template->param($field => $pagestate{$page}{meta}{$field})
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
        }
 
        foreach my $field (qw{permalink}) {
-               $template->param($field => IkiWiki::urlabs($pagestate{$page}{meta}{$field}, $config{url}))
-                       if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
+               if (exists $pagestate{$page}{meta}{$field} && $template->query(name => $field)) {
+                       eval q{use HTML::Entities};
+                       $template->param($field => HTML::Entities::encode_entities(IkiWiki::urlabs($pagestate{$page}{meta}{$field}, $config{url})));
+               }
        }
 
        foreach my $field (qw{description}) {
                eval q{use HTML::Entities};
        }
 
        foreach my $field (qw{description}) {
                eval q{use HTML::Entities};
-               $template->param($field => encode_numeric($pagestate{$page}{meta}{$field}))
+               $template->param($field => HTML::Entities::encode_numeric($pagestate{$page}{meta}{$field}))
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
        }
 
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
        }