Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created April 21, 2016 23:40
Show Gist options
  • Save mgroves/fd9cd7ecd0e845fcfb1fd0adc824bda8 to your computer and use it in GitHub Desktop.
Save mgroves/fd9cd7ecd0e845fcfb1fd0adc824bda8 to your computer and use it in GitHub Desktop.
@model List<CommentViewModel>
@{
Layout = null;
}
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/">
<channel>
@foreach (var comment in Model)
{
@Item(comment)
}
</channel>
</rss>
@helper Item(CommentViewModel comment)
{
@Html.Raw(@"
<item>
<title>" + comment.BlogPostName + @"</title>
<link>http://crosscuttingconcerns.com/" + comment.BlogPostSlug + @"</link>
<wp:post_id>" + comment.BlogPostSlug + @"</wp:post_id>
<dsq:thread_identifier>" + comment.BlogPostSlug + @"</dsq:thread_identifier>
<wp:comment>
<wp:comment_id>" + Guid.NewGuid().ToString() + @"</wp:comment_id>
<wp:comment_author>" + comment.Username + @"</wp:comment_author>
<wp:comment_author_email>" + comment.Email + @"</wp:comment_author_email>
<wp:comment_author_url>" + comment.Url + @"</wp:comment_author_url>
<wp:comment_author_IP>" + comment.IpAddress + @"</wp:comment_author_IP>
<wp:comment_date>" + comment.DatePosted.ToString("yyyy-MM-dd HH:mm:ss") + @"</wp:comment_date>
<wp:comment_date_gmt>" + comment.DatePosted.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss") + @"</wp:comment_date_gmt>
<wp:comment_content><![CDATA[" + comment.Body + @"]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
</wp:comment>
</item>
")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment