]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/correct_published_and_updated_time_information_for_the_feeds.mdwn
web commit by http://hendry.iki.fi/: openid acl
[ikiwiki.git] / doc / bugs / correct_published_and_updated_time_information_for_the_feeds.mdwn
1 In [Atom](http://www.ietf.org/rfc/rfc4287.txt), we can provide `published` and `updated` information.
2 In [RSS](http://cyber.law.harvard.edu/rss/rss.html), there is only `pubDate`, for the 
3 publication date, but an update can be mentioned with the [`dc:modified`](http://www.ietf.org/rfc/rfc2413.txt) 
4 element (whose datetime format is [iso 8601](http://www.w3.org/TR/NOTE-datetime)). 
5 This patch updates :) `inline.pm` and the two relevant templates.
6
7 > I tested a slightly modified patch, which I've put below for now.
8 > feedvalidator.org complains that dc:modified is not a known element. I'll
9 > bet some header needs to be added to make the dublin core stuff available.
10 > The atom feeds seem ok. --[[Joey]]
11
12 <pre>
13 Index: debian/changelog
14 ===================================================================
15 --- debian/changelog    (revision 4066)
16 +++ debian/changelog    (working copy)
17 @@ -15,8 +15,11 @@
18    * Updated French translation from Cyril Brulebois. Closes: #437181
19    * The toc directive doesn't work well or make sense inside an inlined page.
20      Disable it when the page with the toc is nested inside another page.
21 +  * Apply a patch from NicolasLimare adding modification date tags to rss and
22 +    atom feeds, and also changing the publication time for a feed to the
23 +    newest modiciation time (was newest creation time).
24  
25 - -- Joey Hess <joeyh@debian.org>  Sat, 11 Aug 2007 17:40:45 -0400
26 + -- Joey Hess <joeyh@debian.org>  Sat, 11 Aug 2007 18:25:28 -0400
27  
28  ikiwiki (2.5) unstable; urgency=low
29  
30 Index: templates/atomitem.tmpl
31 ===================================================================
32 --- templates/atomitem.tmpl     (revision 4066)
33 +++ templates/atomitem.tmpl     (working copy)
34 @@ -11,7 +11,8 @@
35         <category term="<TMPL_VAR CATEGORY>" />
36         </TMPL_LOOP>
37         </TMPL_IF>
38 -       <updated><TMPL_VAR DATE_3339></updated>
39 +       <updated><TMPL_VAR MDATE_3339></updated>
40 +       <published><TMPL_VAR CDATE_3339></published>
41         <TMPL_IF NAME="ENCLOSURE">
42         <link rel="enclosure" type="<TMPL_VAR TYPE>" href="<TMPL_VAR ENCLOSURE>" length="<TMPL_VAR LENGTH>" />
43         <TMPL_ELSE>
44 Index: templates/rssitem.tmpl
45 ===================================================================
46 --- templates/rssitem.tmpl      (revision 4066)
47 +++ templates/rssitem.tmpl      (working copy)
48 @@ -12,7 +12,8 @@
49         <category><TMPL_VAR CATEGORY></category>
50         </TMPL_LOOP>
51         </TMPL_IF>
52 -       <pubDate><TMPL_VAR DATE_822></pubDate>
53 +       <pubDate><TMPL_VAR CDATE_822></pubDate>
54 +       <dc:modified><TMPL_VAR MDATE_3339></dc:modified>
55         <TMPL_IF NAME="ENCLOSURE">
56         <enclosure url="<TMPL_VAR ENCLOSURE>" type="<TMPL_VAR TYPE>" length="<TMPL_VAR LENGTH>" />
57         <TMPL_ELSE>
58 Index: IkiWiki/Plugin/inline.pm
59 ===================================================================
60 --- IkiWiki/Plugin/inline.pm    (revision 4066)
61 +++ IkiWiki/Plugin/inline.pm    (working copy)
62 @@ -361,8 +361,10 @@
63                         title => pagetitle(basename($p)),
64                         url => $u,
65                         permalink => $u,
66 -                       date_822 => date_822($pagectime{$p}),
67 -                       date_3339 => date_3339($pagectime{$p}),
68 +                       cdate_822 => date_822($pagectime{$p}),
69 +                       mdate_822 => date_822($pagemtime{$p}),
70 +                       cdate_3339 => date_3339($pagectime{$p}),
71 +                       mdate_3339 => date_3339($pagemtime{$p}),
72                 );
73  
74                 if ($itemtemplate->query(name => "enclosure")) {
75 @@ -397,7 +399,7 @@
76                 $content.=$itemtemplate->output;
77                 $itemtemplate->clear_params;
78  
79 -               $lasttime = $pagectime{$p} if $pagectime{$p} > $lasttime;
80 +               $lasttime = $pagemtime{$p} if $pagemtime{$p} > $lasttime;
81         }
82  
83         my $template=template($feedtype."page.tmpl", blind_cache => 1);
84 </pre>
85
86
87
88 >> Yes I noticedthe bug today; the correct (tested on feedvalidator) rssitem.tmpl template must start with the following content:
89
90     <item>
91         <TMPL_IF NAME="AUTHOR">                                                    
92         <title><TMPL_VAR AUTHOR ESCAPE=HTML>: <TMPL_VAR TITLE></title>             
93         <dcterms:creator><TMPL_VAR AUTHOR ESCAPE=HTML></dcterms:creator>           
94         <TMPL_ELSE>                                                                
95         <title><TMPL_VAR TITLE></title>                                            
96         </TMPL_IF>                                                                 
97         <dcterms:modified><TMPL_VAR MDATE_3339></dcterms:modified>                 
98         <dcterms:created><TMPL_VAR DATE_3339></dcterms:created>                    
99         ....
100  
101 >> and rsspage.tmpl must start with:
102
103     <?xml version="1.0"?>                                                              
104     <rss version="2.0"                                                                 
105          xmlns:dc="http://purl.org/dc/elements/1.1/"                                   
106          xmlns:dcterms="http://purl.org/dc/terms/" >        
107          ....
108
109 >> — [[NicolasLimare]]
110
111 [[done]] --[[Joey]]
112
113 [[tag patch]]