]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/meta.pm
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[git.ikiwiki.info.git] / IkiWiki / Plugin / meta.pm
index 8dcd73a1a847683747c247068259255b6d905078..5f046cb2a06e90fdc53939ae2d2b3490d2d4d30e 100644 (file)
@@ -20,6 +20,7 @@ sub getsetup () {
                plugin => {
                        safe => 1,
                        rebuild => undef,
                plugin => {
                        safe => 1,
                        rebuild => undef,
+                       section => "core",
                },
 }
 
                },
 }
 
@@ -88,7 +89,7 @@ sub preprocess (@) {
        # Metadata collection that needs to happen during the scan pass.
        if ($key eq 'title') {
                $pagestate{$page}{meta}{title}=HTML::Entities::encode_numeric($value);
        # Metadata collection that needs to happen during the scan pass.
        if ($key eq 'title') {
                $pagestate{$page}{meta}{title}=HTML::Entities::encode_numeric($value);
-               # fallthrough
+               return "";
        }
        elsif ($key eq 'description') {
                $pagestate{$page}{meta}{description}=HTML::Entities::encode_numeric($value);
        }
        elsif ($key eq 'description') {
                $pagestate{$page}{meta}{description}=HTML::Entities::encode_numeric($value);
@@ -121,6 +122,10 @@ sub preprocess (@) {
                $pagestate{$page}{meta}{authorurl}=$value if safeurl($value);
                # fallthrough
        }
                $pagestate{$page}{meta}{authorurl}=$value if safeurl($value);
                # fallthrough
        }
+       elsif ($key eq 'permalink') {
+               $pagestate{$page}{meta}{permalink}=$value if safeurl($value);
+               # fallthrough
+       }
        elsif ($key eq 'date') {
                eval q{use Date::Parse};
                if (! $@) {
        elsif ($key eq 'date') {
                eval q{use Date::Parse};
                if (! $@) {
@@ -141,10 +146,9 @@ sub preprocess (@) {
                return;
        }
 
                return;
        }
 
-       # Metadata collection that happens only during preprocessing pass.
+       # Metadata handling that happens only during preprocessing pass.
        if ($key eq 'permalink') {
                if (safeurl($value)) {
        if ($key eq 'permalink') {
                if (safeurl($value)) {
-                       $pagestate{$page}{meta}{permalink}=$value;
                        push @{$metaheaders{$page}}, scrub('<link rel="bookmark" href="'.encode_entities($value).'" />', $destpage);
                }
        }
                        push @{$metaheaders{$page}}, scrub('<link rel="bookmark" href="'.encode_entities($value).'" />', $destpage);
                }
        }
@@ -236,6 +240,10 @@ 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).
+                       '" content="'.encode_entities($value).'" />';
+       }
        else {
                push @{$metaheaders{$page}}, scrub('<meta name="'.encode_entities($key).
                        '" content="'.encode_entities($value).'" />', $destpage);
        else {
                push @{$metaheaders{$page}}, scrub('<meta name="'.encode_entities($key).
                        '" content="'.encode_entities($value).'" />', $destpage);
@@ -260,7 +268,7 @@ sub pagetemplate (@) {
                $template->param(title_overridden => 1);
        }
 
                $template->param(title_overridden => 1);
        }
 
-       foreach my $field (qw{author authorurl permalink}) {
+       foreach my $field (qw{author authorurl description permalink}) {
                $template->param($field => $pagestate{$page}{meta}{$field})
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
        }
                $template->param($field => $pagestate{$page}{meta}{$field})
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
        }