diff options
| author | 8chan <admin@8chan.co> | 2015-03-09 02:31:08 -0700 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2016-05-06 12:40:07 +0200 |
| commit | ae4eb4d3d9c390d4c203a468313154aa59809e59 (patch) | |
| tree | c6bfed8321fe3fb081522307bdbb264b91b69804 /templates | |
| parent | 632d0a76d0afc5bd7a8cc90e6625a74fe432065a (diff) | |
RSS
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/themes/catalog/index.rss | 19 | ||||
| -rw-r--r-- | templates/themes/catalog/theme.php | 7 |
2 files changed, 26 insertions, 0 deletions
diff --git a/templates/themes/catalog/index.rss b/templates/themes/catalog/index.rss new file mode 100644 index 00000000..c187e45a --- /dev/null +++ b/templates/themes/catalog/index.rss @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> +<channel> + <title>/{{ board.uri }}/ - {{ board.title|e }}</title> + <link>https://8ch.net/{{ board.uri }}/</link> + <description>Live feed of new threads on the 8chan board /{{ board.uri }}/ - {{ board.title|e }}.</description> + <atom:link href="https://8ch.net/{{ board.uri }}/index.rss" rel="self" type="application/rss+xml"/> + {% for post in recent_posts %} + <item> + <title>{% if post.subject %}{{ post.subject|e }}{% else %}{{ post.body_nomarkup[:256]|e }}{% endif %}</title> + <link>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</link> + <guid>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</guid> + <comments>https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html</comments> + <pubDate>{{ post.pubdate }}</pubDate> + <description><![CDATA[ <a href='https://8ch.net/{{ board.uri }}/res/{{ post.id }}.html' target=_blank><img style='float:left;margin:8px' border=0 src='{% if not config.uri_thumb %}https://8ch.net/{% endif %}{{ post.file }}'></a> {{ post.body }} ]]></description> + </item> + {% endfor %} +</channel> +</rss> diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index c7a8ee95..239d4dff 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -93,6 +93,7 @@ } if (empty($post['image_count'])) $post['image_count'] = 0; + $post['pubdate'] = date('r', $post['time']); $recent_posts[] = $post; } @@ -113,5 +114,11 @@ 'board' => $board_name, 'link' => $config['root'] . $board['dir'] ))); + + file_write($config['dir']['home'] . $board_name . '/index.rss', Element('themes/catalog/index.rss', Array( + 'config' => $config, + 'recent_posts' => $recent_posts, + 'board' => $board + ))); } }; |
