- push @items, {
- itemtitle => pagetitle(basename($p)),
- itemurl => "$config{url}/$renderedfiles{$p}",
- itempubdate => date_822($pagectime{$p}),
- itemcontent => absolute_urls(get_inline_content($p, $page), $url),
- page => $p, # used by category adding code in tag plugin
- } if exists $renderedfiles{$p};
+ my $u=URI->new(encode_utf8($config{url}."/".urlto($p, "")));
+ my $pcontent = absolute_urls(get_inline_content($p, $page), $url);
+
+ $itemtemplate->param(
+ title => pagetitle(basename($p)),
+ url => $u,
+ permalink => $u,
+ cdate_822 => date_822($pagectime{$p}),
+ mdate_822 => date_822($pagemtime{$p}),
+ cdate_3339 => date_3339($pagectime{$p}),
+ mdate_3339 => date_3339($pagemtime{$p}),
+ );
+
+ if ($itemtemplate->query(name => "enclosure")) {
+ my $file=$pagesources{$p};
+ my $type=pagetype($file);
+ if (defined $type) {
+ $itemtemplate->param(content => $pcontent);
+ }
+ else {
+ my ($a, $b, $c, $d, $e, $f, $g, $size) = stat(srcfile($file));
+ my $mime="unknown";
+ eval q{use File::MimeInfo};
+ if (! $@) {
+ $mime = mimetype($file);
+ }
+ $itemtemplate->param(
+ enclosure => $u,
+ type => $mime,
+ length => $size,
+ );
+ }
+ }
+ else {
+ $itemtemplate->param(content => $pcontent);
+ }
+
+ run_hooks(pagetemplate => sub {
+ shift->(page => $p, destpage => $page,
+ template => $itemtemplate);
+ });
+
+ $content.=$itemtemplate->output;
+ $itemtemplate->clear_params;
+
+ $lasttime = $pagemtime{$p} if $pagemtime{$p} > $lasttime;