Skip to content

Commit f2fa8ab

Browse files
committed
Improved atom feeds and now using jekyll-feed
1 parent b82ed20 commit f2fa8ab

File tree

6 files changed

+73
-13
lines changed

6 files changed

+73
-13
lines changed

_layouts/atom.xml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,39 @@
33
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
44
<channel>
55
{% if page.grouptype == 'category' %}
6-
<title>{{ site.short_url }} - Category: {{ page.category }}</title>
6+
<title>{{ site.url }}{{ site.baseurl }} - Category: {{ page.category }}</title>
77
{% else %}
8-
<title>{{ site.short_url }}</title>
8+
<title>{{ site.url }}{{ site.baseurl }}</title>
99
{% endif %}
10-
<link>{{ site.url }}</link>
10+
<link>{{ site.url }}{{ site.baseurl }}</link>
1111
<description>{{ site.description }}</description>
1212
<language>{{ site.language }}</language>
13-
<managingEditor> {{ site.author[1].username }}</managingEditor>
13+
{% if page.author %}
14+
{% for author in site.data.authors %}
15+
{% if author[1].username == page.author %}
16+
{% assign author_name = author[1].name %}
17+
{% assign author_username = author[1].username %}
18+
<managingEditor>{{ author_name }}</managingEditor>
19+
{% endif %}
20+
{% endfor %}
21+
{% endif %}
22+
<title>
23+
<![CDATA[ {% if author_name %}{{ author_name }} - {% endif %}{{ site.title }} ]]>
24+
</title>
25+
<description>
26+
<![CDATA[ {{ site.description }} ]]>
27+
</description>
28+
<link>{{ site.url }}{{ site.baseurl }}</link>
29+
<image>
30+
<url>{{ site.url }}{{ site.baseurl }}{{ site.favicon }}</url>
31+
<title>{% if author_name %}{{ author_name }} - {% endif %}{{ site.title }}</title>
32+
<link>{{ site.url }}{{ site.baseurl }}</link>
33+
</image>
34+
<generator>Jekyll 3.6.2</generator>
35+
<lastBuildDate>{{ post.date | date_to_xmlschema }}</lastBuildDate>
36+
<atom:link href="{{ site.url }}{{ site.baseurl }}{% if author_name %}author/{{ author_username }}/{% endif %}rss.xml" rel="self" type="application/rss+xml"/>
37+
<ttl>60</ttl>
1438
<atom:link href="rss" rel="self" type="application/rss+xml" />
15-
{{content}}
39+
{{ content }}
1640
</channel>
1741
</rss>

_layouts/author.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ title: nil
55
{% for post in page.posts %}
66
<item>
77
<title>{{ post.title }}</title>
8-
<link>{{ site.baseurl }}{{ post.url }}</link>
9-
<author>{{ site.author[1].username }}</author>
8+
<link>{{ site.url }}{{ site.baseurl }}{{ post.url | remove: '/' }}</link>
9+
{% for author in site.data.authors %}
10+
{% if author[1].username == page.author %}
11+
<author>{{ author[1].name }}</author>
12+
{% endif %}
13+
{% endfor %}
1014
<pubDate>{{ post.date | date_to_xmlschema }}</pubDate>
11-
<guid>{{ site.baseurl }}{{ post.url }}</guid>
15+
<guid>{{ site.url }}{{ site.baseurl }}{{ post.url | remove: '/' }}</guid>
1216
<description><![CDATA[
1317
{{ post.content | expand_urls : site.url }}
1418
]]></description>

_layouts/tag.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ title: nil
55
{% for post in page.posts %}
66
<item>
77
<title>{{ post.title }}</title>
8-
<link>{{ site.baseurl }}{{ post.url }}</link>
9-
<author>{{ site.author[1].username }}</author>
8+
<link>{{ site.url }}{{ site.baseurl }}{{ post.url | remove: '/' }}</link>
9+
{% for author in site.data.authors %}
10+
{% if author[1].username == post.author %}
11+
<author>{{ author[1].name }}</author>
12+
{% endif %}
13+
{% endfor %}
1014
<pubDate>{{ post.date | date_to_xmlschema }}</pubDate>
11-
<guid>{{ site.baseurl }}{{ post.url }}</guid>
15+
<guid>{{ site.url }}{{ site.baseurl }}{{ post.url | remove: '/' }}</guid>
1216
<description><![CDATA[
1317
{{ post.content | expand_urls : site.url }}
1418
]]></description>

_plugins/jekyll-autgenerator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def initialize(site, base, dir, type, val, posts)
5757
@site = site
5858
@base = base
5959
@dir = dir
60-
@name = 'rss.xml'
60+
@name = 'feed.xml'
6161

6262
self.process(@name)
6363
self.read_yaml(File.join(base, '_layouts'), "author.xml")

_plugins/jekyll-tagsgenerator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def initialize(site, base, dir, type, val, posts)
5757
@site = site
5858
@base = base
5959
@dir = dir
60-
@name = 'rss.xml'
60+
@name = 'feed.xml'
6161

6262
self.process(@name)
6363
self.read_yaml(File.join(base, '_layouts'), "tag.xml")

atom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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.name | xml_escape }} - Articles</title>
8+
<description>{% if site.description %}{{ site.description | xml_escape }}{% endif %}</description>
9+
<link>
10+
{{ site.url }}</link>
11+
{% for post in site.posts %}
12+
{% unless post.link %}
13+
<item>
14+
<title>{{ post.title | xml_escape }}</title>
15+
{% if post.excerpt %}
16+
<description>{{ post.excerpt | xml_escape }}</description>
17+
{% else %}
18+
<description>{{ post.content | xml_escape }}</description>
19+
{% endif %}
20+
<pubDate>{{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
21+
<link>
22+
{{ site.url }}{{ post.url }}</link>
23+
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
24+
</item>
25+
{% endunless %}
26+
{% endfor %}
27+
</channel>
28+
</rss>

0 commit comments

Comments
 (0)