- 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}."/".htmlpage($p)));
+
+ $itemtemplate->param(
+ title => pagetitle(basename($p)),
+ url => $u,
+ permalink => $u,
+ date_822 => date_822($pagectime{$p}),
+ date_3339 => date_3339($pagectime{$p}),
+ );
+
+ my $pcontent = absolute_urls(get_inline_content($p, $page), $url);
+ 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 = $pagectime{$p} if $pagectime{$p} > $lasttime;