|
9 | 9 | var path = require('path');
|
10 | 10 | var React = require('react');
|
11 | 11 |
|
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> |
24 | 22 |
|
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