Skip to content

Commit 1c414ce

Browse files
committed
Add Jekyll RSS
- Use Jekyll Feed - Strip whitespace from the Gemfile - Add `rss.xml` in the web root
1 parent f64a4cc commit 1c414ce

File tree

6 files changed

+46
-3
lines changed

6 files changed

+46
-3
lines changed

Gemfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
source 'https://rubygems.org'
22

3-
gem 'github-pages'
3+
gem 'github-pages', group: :jekyll_plugins
4+
5+
group :jekyll_plugins do
6+
gem 'jekyll-feed'
7+
end
48

59
group :scripts do
6-
gem 'mgem'
7-
gem 'git'
10+
gem 'mgem'
11+
gem 'git'
812

913
# API Docs
1014
gem 'yard-mruby'

Gemfile.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ PLATFORMS
266266
DEPENDENCIES
267267
git
268268
github-pages
269+
jekyll-feed
269270
mgem
270271
yard-coderay
271272
yard-mruby

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ highlighter: rouge
1111
url: https://mruby.org
1212
repository: https://github.com/mruby/mruby.github.io
1313
include: _index.html
14+
plugins:
15+
- jekyll-feed
1416
exclude:
1517
- Gemfile
1618
- Gemfile.lock

_includes/footer.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
<div class="container">
33
<a href="https://github.com/h2so5/mruby-logo">mruby-logo</a> provided by <a href="https://github.com/h2so5">h2so5</a>
44
</div>
5+
<div>
6+
<a href="/rss.xml">
7+
<img src="/images/icons/rss-feed.png" alt="RSS feed" title="RSS feed" width="25" height="25">
8+
</a>
9+
</div>
510
</footer>

images/icons/rss-feed.png

1.11 KB
Loading

rss.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
layout: null
3+
---
4+
<?xml version="1.0" encoding="UTF-8"?>
5+
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
6+
<channel>
7+
<title>{{ site.title | xml_escape }}</title>
8+
<description>{{ site.description | xml_escape }}</description>
9+
<link>{{ site.url }}{{ site.baseurl }}/</link>
10+
<atom:link href="{{ "/rss.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml"/>
11+
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate>
12+
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>
13+
<generator>Jekyll v{{ jekyll.version }}</generator>
14+
{% for post in site.posts %}
15+
<item>
16+
<title>{{ post.title | xml_escape }}</title>
17+
<author></author>
18+
<description>{{ post.content | xml_escape }}</description>
19+
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate>
20+
<link>{{ post.url | prepend: site.baseurl | prepend: site.url }}</link>
21+
<guid isPermaLink="true">{{ post.url | prepend: site.baseurl | prepend: site.url }}</guid>
22+
{% for tag in post.tags %}
23+
<category>{{ tag | xml_escape }}</category>
24+
{% endfor %}
25+
{% for cat in post.categories %}
26+
<category>{{ cat | xml_escape }}</category>
27+
{% endfor %}
28+
</item>
29+
{% endfor %}
30+
</channel>
31+
</rss>

0 commit comments

Comments
 (0)