Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pico_rss/pico_rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function request_url(&$url)
public function get_pages(&$pages, &$current_page, &$prev_page, &$next_page)
{
// Limit feed to latest 10 posts
if($this->is_feed) $pages = array_slice($pages, 0, 10);
if($this->is_feed) $pages = array_slice(array_reverse(array_filter($pages, function($p) {return $p['date'];})), 0, 10);
}

public function before_render(&$twig_vars, &$twig)
Expand All @@ -45,4 +45,4 @@ public function before_render(&$twig_vars, &$twig)

}

?>
?>
4 changes: 1 addition & 3 deletions pico_rss/rss.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
<description>RSS feed for {{ site_title }}</description>
<atom:link href="{{ base_url }}/feed" rel="self" type="application/rss+xml" />
{% for page in pages %}
{% if page.date %}
<item>
<title>{{ page.title }}</title>
<description><![CDATA[{{ page.content }}]]></description>
<link>{{ page.url }}</link>
<pubDate>{{ page.date|date("D, d M Y H:i:s O") }}</pubDate>
<guid>{{ page.url }}</guid>
</item>
{% endif %}
{% endfor %}
</channel>
</rss>
</rss>