Skip to content

Commit 71c8008

Browse files
committed
Created initial RSS feed
1 parent 5357aee commit 71c8008

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

_layouts/rss.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<rss version="2.0">
3+
<channel>
4+
{{ content }}
5+
</channel>
6+
</rss>

feed.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
layout: rss
3+
title: RSS
4+
permalink: /feed.rss
5+
---
6+
7+
<title>CircuitPython.org Boards</title>
8+
<link>{{ "/" | absolute_url }}</link>
9+
<description>A list of CircuitPython and Blinka supported boards</description>
10+
<lastBuildDate>{{ "now" | date_to_rfc822 }}</lastBuildDate>
11+
{%- comment -%}
12+
The following are boards that are in the _data/files.json build
13+
process. Seperate loops due to wanting to sort by download count first.
14+
{%- endcomment -%}
15+
{%- assign twelve_hours = 12 | times: 60 | times: 60 -%}
16+
{%- assign boards = site.data.files | sort: "downloads" | reverse -%}
17+
{%- for board in boards -%}
18+
{%- assign info = site.board | where: 'board_id', board.id -%}
19+
{%- if info.size == 0 %}
20+
{%- assign info = site.board | where: 'board_id', 'unknown' -%}
21+
{%- endif -%}
22+
{%- assign info = info[0] -%}
23+
{%- if info.downloads_display == false -%}
24+
{%- continue -%}
25+
{%- endif -%}
26+
<item>
27+
<title>{{ info.name | default: board.id }}</title>
28+
<link>{{ info.url | absolute_url }}</link>
29+
<description><![CDATA[ <p>By {{ info.manufacturer }}</p> {{ info.content }} ]]></description>
30+
<category>CircuitPython</category>
31+
<pubDate>{{ info.date_added | date: '%s' | plus: twelve_hours | date_to_rfc822 }}</pubDate>
32+
<guid>{{ info.url | absolute_url }}</guid>
33+
</item>
34+
{% endfor %}
35+
36+
{% comment %}
37+
The following are boards that are not yet in the _data/files.json build
38+
process and have no downloads.
39+
{% endcomment %}
40+
{% for board in site.board %}
41+
{% assign info = site.data.files | where: 'id', board.board_id | first %}
42+
{% if info == nil and board.board_id != 'unknown' %}
43+
<item>
44+
<title>{{ board.name }}</title>
45+
<link>{{ board.url | absolute_url }}</link>
46+
<description><![CDATA[ <p>By {{ board.manufacturer }}</p> {{ board.content }} ]]></description>
47+
<category>CircuitPython</category>
48+
<pubDate>{{ board.date_added | date: '%s' | plus: twelve_hours | date_to_rfc822 }}</pubDate>
49+
<guid>{{ board.url | absolute_url }}</guid>
50+
</item>
51+
{% endif %}
52+
{% endfor %}
53+
{% for board in site.blinka %}
54+
<item>
55+
<title>{{ board.name }}</title>
56+
<link>{{ board.url | absolute_url }}</link>
57+
<description><![CDATA[ <p>By {{ board.manufacturer }}</p> {{ board.content }} ]]></description>
58+
<category>Blinka</category>
59+
<pubDate>{{ board.date_added | date: '%s' | plus: twelve_hours | date_to_rfc822 }}</pubDate>
60+
<guid>{{ board.url | absolute_url }}</guid>
61+
</item>
62+
{% endfor %}

0 commit comments

Comments
 (0)