- $template->param(permalink => $permalink{$page})
- if exists $permalink{$page} && $template->query(name => "permalink");
- $template->param(author => $author{$page})
- if exists $author{$page} && $template->query(name => "author");
- $template->param(authorurl => $authorurl{$page})
- if exists $authorurl{$page} && $template->query(name => "authorurl");
-
- if ($page ne $destpage &&
- ((exists $license{$page} && ! exists $license{$destpage}) ||
- (exists $copyright{$page} && ! exists $copyright{$destpage}))) {
- # Force a scan of the destpage to get its copyright/license
- # info. If the info is declared after an inline, it will
- # otherwise not be available at this point.
- IkiWiki::scan($pagesources{$destpage});
- }
-
- if (exists $license{$page} && $template->query(name => "license") &&
- ($page eq $destpage || ! exists $license{$destpage} ||
- $license{$page} ne $license{$destpage})) {
- $template->param(license => htmlize($page, $destpage, $license{$page}));
- }
- if (exists $copyright{$page} && $template->query(name => "copyright") &&
- ($page eq $destpage || ! exists $copyright{$destpage} ||
- $copyright{$page} ne $copyright{$destpage})) {
- $template->param(copyright => htmlize($page, $destpage, $copyright{$page}));
+
+ foreach my $field (qw{author authorurl permalink}) {
+ $template->param($field => $pagestate{$page}{meta}{$field})
+ if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
+ }
+
+ foreach my $field (qw{license copyright}) {
+ if (exists $pagestate{$page}{meta}{$field} && $template->query(name => $field) &&
+ ($page eq $destpage || ! exists $pagestate{$destpage}{meta}{$field} ||
+ $pagestate{$page}{meta}{$field} ne $pagestate{$destpage}{meta}{$field})) {
+ $template->param($field => htmlize($page, $destpage, $pagestate{$page}{meta}{$field}));
+ }