Skip to content

Commit 5a5c18f

Browse files
committed
es6ify rss
1 parent 422e660 commit 5a5c18f

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

site/blog/rss.xml.js

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,30 @@
99
var path = require('path');
1010
var React = require('react');
1111

12-
var BlogRss = React.createClass({
13-
render: function() {
14-
var site = this.props.site;
15-
var posts = site.files.blog
16-
.filter(file => !file.draft && path.extname(file.relPath) === '.md')
17-
.sort((a, b) => a.date < b.date);
18-
return (
19-
<feed>
20-
<title>Blog | GraphQL</title>
21-
<link href="http://graphql.org/blog/"/>
22-
<id>http://graphql.org/blog/</id>
23-
<updated>{new Date(posts[0].date).toISOString()}</updated>
12+
export default function BlogRSS({ site }) {
13+
const posts = site.files.blog
14+
.filter(file => !file.draft && path.extname(file.relPath) === '.md')
15+
.sort((a, b) => a.date < b.date);
16+
return (
17+
<feed>
18+
<title>Blog | GraphQL</title>
19+
<link href="http://graphql.org/blog/"/>
20+
<id>http://graphql.org/blog/</id>
21+
<updated>{new Date(posts[0].date).toISOString()}</updated>
2422

25-
{posts.map(post =>
26-
<entry>
27-
<title>{post.title}</title>
28-
<link href={'http://graphql.org' + post.url}/>
29-
<id>http://graphql.org{post.url}</id>
30-
<updated>{new Date(post.date).toISOString()}</updated>
31-
<summary>{post.title}</summary>
32-
<content>{post.title}</content>
33-
<author>
34-
<name>{post.byline}</name>
35-
</author>
36-
</entry>
37-
)}
38-
</feed>
39-
);
40-
}
41-
});
42-
43-
module.exports = BlogRss;
23+
{posts.map(post =>
24+
<entry>
25+
<title>{post.title}</title>
26+
<link href={'http://graphql.org' + post.url}/>
27+
<id>http://graphql.org{post.url}</id>
28+
<updated>{new Date(post.date).toISOString()}</updated>
29+
<summary>{post.title}</summary>
30+
<content>{post.title}</content>
31+
<author>
32+
<name>{post.byline}</name>
33+
</author>
34+
</entry>
35+
)}
36+
</feed>
37+
);
38+
}

0 commit comments

Comments
 (0)