my $base_page = $self->pages->get({ path => $config->{base} });
my @entry_pages = $base_page->children(%{$config->{entries}})
->latest(10)->flatten;
+ my $updated = (sort map $_->created, @entry_pages)[-1];
+{
%$config,
id => $self->_id_for($base_page->path),
- web_url => $base_page->path,
- feed_url => "/feed/${\$config->{base}}",
+ web_url => $base_page->path.'/',
+ feed_url => "/feed/${\$config->{base}}/",
+ updated => join('T', split(' ',$updated)).'Z',
entries => [ map +{
title => $_->title,
summary_html => do {
use HTML::Tags;
- HTML::Tags::to_html_string(<p>, $_->description, </p>)
+ join '', HTML::Tags::to_html_string(<p>, $_->description, </p>)
},
content_html => $_->body,
- created => $_->created,
+ created => join('T', split(' ',$_->created)).'Z',
web_url => $_->path,
}, @entry_pages ],
}
: ()),
' ', <link rel="alternate" type="text/html" href="${web_url}" />, "\n",
' ', <link rel="self" type="application/atom+xml" href="${feed_url}" />, "\n",
+ ' ', <updated>, $data->{updated}, </updated>, "\n",
' ', <id>, $data->{id}, </id>, "\n",
(map $self->_entry_data_to_tags($_), @{$data->{entries}}),
</feed>);
sub _entry_data_to_tags {
my ($self, $data) = @_;
- use XML::Tags qw(entry title link id published updated summary content);
+ use XML::Tags qw(
+ entry title author name link id published updated summary content
+ );
my $web_url = $data->{web_url};
' ', <entry>, "\n",
' ', <title>, $data->{title}, </title>, "\n",
+ ' ', <author>, <name>, "Shadowcat Staff", </name>, </author>, "\n",
' ', <link href="${web_url}" />, "\n",
' ', <id>, $self->_id_for($data->{web_url}), </id>, "\n",
' ', <published>, $data->{created}, </published>, "\n",
' ', <updated>, ($data->{created}||$data->{updated}), </updated>, "\n",
($data->{summary_html}
- ? (' ', <summary type="html">, \($data->{summary_html}), </summary>, "\n")
+ ? (' ', <summary type="html">, \('<![CDATA['.$data->{summary_html}.']]>'), </summary>, "\n")
: ()
),
- ' ', <content type="html">, \($data->{body_html}), </content>, "\n",
+ ' ', <content type="html">, \('<![CDATA['.$data->{content_html}.']]>'), </content>, "\n",
' ', </entry>, "\n";
}