0b9f6f939f816cb9516c8d411945ebc8388b23d0
[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 Index: doc/bugs/correct_published_and_updated_time_information_for_the_feeds.mdwn
85 ===================================================================
86 --- doc/bugs/correct_published_and_updated_time_information_for_the_feeds.mdwn  (revision 4066)
87 +++ doc/bugs/correct_published_and_updated_time_information_for_the_feeds.mdwn  (working copy)
88 @@ -4,50 +4,54 @@
89  element (whose datetime format is [iso 8601](http://www.w3.org/TR/NOTE-datetime)). 
90  This patch updates :) `inline.pm` and the two relevant templates.
91  
92 -    --- inline.pm.orig      2007-08-07 05:44:26.000000000 +0200
93 -    +++ inline.pm   2007-08-07 05:47:37.000000000 +0200
94 -    @@ -362,7 +362,9 @@
95 -                            url => $u,
96 -                            permalink => $u,
97 -                            date_822 => date_822($pagectime{$p}),
98 -    +                       mdate_822 => date_822($pagemtime{$p}),
99 -                            date_3339 => date_3339($pagectime{$p}),
100 -    +                       mdate_3339 => date_3339($pagemtime{$p}),
101 -                    );
102 -     
103 -                    if ($itemtemplate->query(name => "enclosure")) {
104 -    @@ -397,7 +399,7 @@
105 -                    $content.=$itemtemplate->output;
106 -                    $itemtemplate->clear_params;
107 -     
108 -    -               $lasttime = $pagectime{$p} if $pagectime{$p} > $lasttime;
109 -    +               $lasttime = $pagemtime{$p} if $pagemtime{$p} > $lasttime;
110 -            }
111 -     
112 -            my $template=template($feedtype."page.tmpl", blind_cache => 1);
113 -    --- atomitem.tmpl.orig  2007-08-07 05:44:43.000000000 +0200
114 -    +++ atomitem.tmpl       2007-08-07 05:46:14.000000000 +0200
115 -    @@ -11,7 +11,8 @@
116 -            <category term="<TMPL_VAR CATEGORY>" />
117 -            </TMPL_LOOP>
118 -            </TMPL_IF>
119 -    -       <updated><TMPL_VAR DATE_3339></updated>
120 -    +       <updated><TMPL_VAR MDATE_3339></updated>
121 -    +       <published><TMPL_VAR DATE_3339></published>
122 -            <TMPL_IF NAME="ENCLOSURE">
123 -            <link rel="enclosure" type="<TMPL_VAR TYPE>" href="<TMPL_VAR ENCLOSURE>" length="<TMPL_VAR LENGTH>" />
124 -            <TMPL_ELSE>
125 -    --- rssitem.tmpl.orig   2007-08-07 05:44:58.000000000 +0200
126 -    +++ rssitem.tmpl        2007-08-07 06:06:36.000000000 +0200
127 -    @@ -5,6 +5,7 @@
128 -            <TMPL_ELSE>
129 -            <title><TMPL_VAR TITLE></title>
130 -            </TMPL_IF>
131 -    +       <dc:modified><TMPL_VAR MDATE_3339></dc:modified>
132 -            <guid><TMPL_VAR URL></guid>
133 -            <link><TMPL_VAR PERMALINK></link>
134 -            <TMPL_IF NAME="CATEGORIES">
135 +<pre>
136 +--- inline.pm.orig      2007-08-07 05:44:26.000000000 +0200
137 ++++ inline.pm   2007-08-07 05:47:37.000000000 +0200
138 +@@ -362,7 +362,9 @@
139 +                        url => $u,
140 +                        permalink => $u,
141 +                        date_822 => date_822($pagectime{$p}),
142 ++                       mdate_822 => date_822($pagemtime{$p}),
143 +                        date_3339 => date_3339($pagectime{$p}),
144 ++                       mdate_3339 => date_3339($pagemtime{$p}),
145 +                );
146
147 +                if ($itemtemplate->query(name => "enclosure")) {
148 +@@ -397,7 +399,7 @@
149 +                $content.=$itemtemplate->output;
150 +                $itemtemplate->clear_params;
151
152 +-               $lasttime = $pagectime{$p} if $pagectime{$p} > $lasttime;
153 ++               $lasttime = $pagemtime{$p} if $pagemtime{$p} > $lasttime;
154 +        }
155
156 +        my $template=template($feedtype."page.tmpl", blind_cache => 1);
157 +--- atomitem.tmpl.orig  2007-08-07 05:44:43.000000000 +0200
158 ++++ atomitem.tmpl       2007-08-07 05:46:14.000000000 +0200
159 +@@ -11,7 +11,8 @@
160 +        <category term="<TMPL_VAR CATEGORY>" />
161 +        </TMPL_LOOP>
162 +        </TMPL_IF>
163 +-       <updated><TMPL_VAR DATE_3339></updated>
164 ++       <updated><TMPL_VAR MDATE_3339></updated>
165 ++       <published><TMPL_VAR DATE_3339></published>
166 +        <TMPL_IF NAME="ENCLOSURE">
167 +        <link rel="enclosure" type="<TMPL_VAR TYPE>" href="<TMPL_VAR ENCLOSURE>" length="<TMPL_VAR LENGTH>" />
168 +        <TMPL_ELSE>
169 +--- rssitem.tmpl.orig   2007-08-07 05:44:58.000000000 +0200
170 ++++ rssitem.tmpl        2007-08-07 06:06:36.000000000 +0200
171 +@@ -5,6 +5,7 @@
172 +        <TMPL_ELSE>
173 +        <title><TMPL_VAR TITLE></title>
174 +        </TMPL_IF>
175 ++       <dc:modified><TMPL_VAR MDATE_3339></dc:modified>
176 +        <guid><TMPL_VAR URL></guid>
177 +        <link><TMPL_VAR PERMALINK></link>
178 +        <TMPL_IF NAME="CATEGORIES">
179 +</pre>
180  
181  — NicolasLimare
182  
183 +[[done]], thanks --[[Joey]]
184 +
185  [[tag patch]]
186 </pre>
187
188 — NicolasLimare
189
190 [[tag patch]]