From: Joey Hess Date: Tue, 27 Jan 2009 01:05:36 +0000 (-0500) Subject: Merge commit 'smcv/updated' X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/848ff1bf5e218c57cc738a85ed02d7e1396c1d22?hp=1f3f33fa67ade3bbc219f5bdc4f8e411162f3f28 Merge commit 'smcv/updated' --- diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index d8b5f8548..2205ebffc 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -519,9 +519,15 @@ sub genfeed ($$$$$@) { mdate_3339 => date_3339($pagemtime{$p}), ); - if (exists $pagestate{$p} && - exists $pagestate{$p}{meta}{guid}) { - $itemtemplate->param(guid => $pagestate{$p}{meta}{guid}); + if (exists $pagestate{$p}) { + if (exists $pagestate{$p}{meta}{guid}) { + $itemtemplate->param(guid => $pagestate{$p}{meta}{guid}); + } + + if (exists $pagestate{$p}{meta}{updated}) { + $itemtemplate->param(mdate_822 => date_822($pagestate{$p}{meta}{updated})); + $itemtemplate->param(mdate_3339 => date_3339($pagestate{$p}{meta}{updated})); + } } if ($itemtemplate->query(name => "enclosure")) { diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 15bb29b3f..4a22fed30 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -128,6 +128,13 @@ sub preprocess (@) { $IkiWiki::pagectime{$page}=$time if defined $time; } } + elsif ($key eq 'updated') { + eval q{use Date::Parse}; + if (! $@) { + my $time = str2time($value); + $pagestate{$page}{meta}{updated}=$time if defined $time; + } + } if (! defined wantarray) { # avoid collecting duplicate data during scan pass diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn index 74db31943..f29a118bf 100644 --- a/doc/ikiwiki/directive/meta.mdwn +++ b/doc/ikiwiki/directive/meta.mdwn @@ -139,6 +139,15 @@ Supported fields: pages unchanged and avoid_flooding_aggregators (see [[!iki tips/howto_avoid_flooding_aggregators]]). +* updated + + Specifies a fake modification time for a page, to be output into RSS and + Atom feeds. This is useful to avoid flooding aggregators that sort by + modification time, like Planet: for instance, when editing an old blog post + to add tags, you could set `updated` to be one second later than the original + value. The date/time can be given in any format that + [[!cpan TimeDate]] can understand, just like the `date` field. + If the field is not one of the above predefined fields, the metadata will be written to the generated html page as a <meta> header. However, this won't be allowed if the [[!iki plugins/htmlscrubber desc=htmlscrubber]] plugin is enabled,