Skip to content

Commit b2d4ca7

Browse files
j0k3rleebyron
authored andcommitted
Make RSS valid (graphql#42)
Validation failed with the previous feed (even if I checked it ..) This feed does not validate. line 1, column 38: Missing namespace for feed [help] <?xml version="1.0" encoding="utf-8"?><feed><title>Blog | GraphQL</title><li ... ^ line 1, column 112: Missing feed element: id [help] ... ><link href="http://github.com/%3Ca%20href="http://graphql.org/blog/"/><entry><title>Wrapping" rel="nofollow">http://graphql.org/blog/"/><entry><title>Wrapping a REST AP ... ^ line 1, column 112: Missing feed element: updated [help] ... ><link href="http://github.com/%3Ca%20href="http://graphql.org/blog/"/><entry><title>Wrapping" rel="nofollow">http://graphql.org/blog/"/><entry><title>Wrapping a REST AP ... ^ line 1, column 263: id must be a full and valid URL: /blog/rest-api-graphql-wrapper/ (4 occurrences) [help] ... r/"/><id>/blog/rest-api-graphql-wrapper/</id><updated>2016-05-05T00:00:0 ...
1 parent 6c72876 commit b2d4ca7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

resources/renderReactPage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ function renderReactPage(options) {
2424
var html = React.renderToStaticMarkup(React.createElement(component, props));
2525

2626
if (html.indexOf('<feed') !== -1) {
27+
// react remove namespace so we re-add manually
28+
html = html.replace('<feed>', '<feed xmlns="http://www.w3.org/2005/Atom">');
29+
2730
return '<?xml version="1.0" encoding="utf-8"?>' + html;
2831
}
2932

site/blog/rss.xml.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ var BlogRss = React.createClass({
1616
.filter(file => !file.draft && path.extname(file.relPath) === '.md')
1717
.sort((a, b) => a.date < b.date);
1818
return (
19-
<feed xmlns="http://www.w3.org/2005/Atom">
19+
<feed>
2020
<title>Blog | GraphQL</title>
2121
<link href="http://graphql.org/blog/"/>
22+
<id>http://graphql.org/blog/</id>
23+
<updated>{new Date(posts[0].date).toISOString()}</updated>
2224

2325
{posts.map(post =>
2426
<entry>
2527
<title>{post.title}</title>
2628
<link href={'http://graphql.org' + post.url}/>
27-
<id>{post.permalink}</id>
29+
<id>http://graphql.org{post.url}</id>
2830
<updated>{new Date(post.date).toISOString()}</updated>
2931
<summary>{post.title}</summary>
3032
<content>{post.title}</content>

0 commit comments

Comments
 (0)