]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/meta.pm
improve warning message for multiple sources for page
[git.ikiwiki.info.git] / IkiWiki / Plugin / meta.pm
index 7ea70b5d19e17595e2a6b611dee1178347da7a81..ea099f955ac1c486cdd2baf6636e330a8eae569c 100644 (file)
@@ -121,6 +121,18 @@ sub preprocess (@) {
                add_link($page, $value);
                return "";
        }
+       elsif ($key eq 'enclosure') {
+               my $link=bestlink($page, $value);
+               if (! length $link) {
+                       error gettext("enclosure not found")
+               }
+               add_depends($page, $link, deptype("presence"));
+
+               $value=urlto($link, $page, 1);
+               $pagestate{$page}{meta}{enclosure}=$value;
+               $pagestate{$page}{meta}{enclosurefile}=$link;
+               # fallthrough
+       }
        elsif ($key eq 'author') {
                $pagestate{$page}{meta}{author}=$value;
                if (exists $params{sortas}) {
@@ -282,6 +294,7 @@ sub preprocess (@) {
        elsif ($key eq 'name') {
                push @{$metaheaders{$page}}, scrub('<meta name="'.
                        encode_entities($value).
+                       '" '.
                        join(' ', map { "$_=\"$params{$_}\"" } keys %params).
                        ' />', $page, $destpage);
        }
@@ -318,6 +331,10 @@ sub pagetemplate (@) {
                $template->param(title_overridden => 1);
        }
 
+       if (exists $pagestate{$page}{meta}{enclosure}) {
+               $template->param(enclosure => HTML::Entities::encode_entities(IkiWiki::urlabs($pagestate{$page}{meta}{enclosure}, $config{url})));
+       }
+
        foreach my $field (qw{authorurl}) {
                eval q{use HTML::Entities};
                $template->param($field => HTML::Entities::encode_entities($pagestate{$page}{meta}{$field}))