1 I'd like to define [[plugins/meta]] values to apply across all pages
2 site-wide unless the pages define their own: default values for meta
3 definitions essentially.
5 Here's a patch[[!tag patch]] to achieve this (also in the "defaultmeta" branch of
6 my github ikiwiki fork):
8 diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
9 index b229592..2894e08 100644
10 --- a/IkiWiki/Plugin/meta.pm
11 +++ b/IkiWiki/Plugin/meta.pm
12 @@ -13,6 +13,7 @@ sub import {
13 hook(type => "needsbuild", id => "meta", call => \&needsbuild);
14 hook(type => "preprocess", id => "meta", call => \&preprocess, scan => 1);
15 hook(type => "pagetemplate", id => "meta", call => \&pagetemplate);
16 + hook(type => "scan", id => "meta", call => \&scan);
20 @@ -302,6 +303,20 @@ sub match {
24 +my @metatypes = qw/title description license copyright link
25 + author authorurl date permalink stylesheet
26 + openid redir robots guid updated/;
30 + my $page = $params{page};
32 + foreach my $type (grep { exists $config{"meta_$_"} } @metatypes) {
33 + $pagestate{$page}{meta}{$type} = $config{"meta_$type"}
34 + unless defined $pagestate{$page}{meta}{$type};
38 package IkiWiki::PageSpec;
40 sub match_title ($$;@) {
41 diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn
42 index 000f461..200c4b2 100644
43 --- a/doc/ikiwiki/directive/meta.mdwn
44 +++ b/doc/ikiwiki/directive/meta.mdwn
45 @@ -12,6 +12,12 @@ also specifies some additional sub-parameters.
46 The field values are treated as HTML entity-escaped text, so you can include
47 a quote in the text by writing `"` and so on.
49 +You can also define site-wide defaults for meta values by including them
50 +in your setup file, e.g.
52 + meta_copyright => "Copyright 2007 by Joey Hess",
53 + meta_license => "GPL v2+",