x
 
Create New Page
 View Previous Changes    ( Last updated by Bobby McGee )

Making an Atom feed of all comments to all posts

In the other article (linked below), there was the code for an RSS feed of all comments to all posts. Here is an atom version for the folks that want it. Just copy and paste it into an empty RSS template, edit details as need (I have a separate template group for feeds for ease-of-use reasons), and hit Update.

If you want the comment permalinks to work correctly, see this article: Comment Permalinks

{assign_variable:master_weblog_name="default_site"}
{assign_variable
:atom_feed_location="feeds/comments_atom"}

{exp
:rss:feed weblog="{master_weblog_name}"}

<?xml version
="1.0" encoding="{encoding}"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{weblog_language}">

    <
title type="text">{exp:xml_encode}Comments for {weblog_name}{/exp:xml_encode}</title>
    <
subtitle type="text">{exp:xml_encode}{weblog_name}:{weblog_description}{/exp:xml_encode}</subtitle>
    <
link rel="alternate" type="text/html" href="{weblog_url}" />
    <
link rel="self" type="application/atom+xml" href="http://purple-anger.org/feeds/comments_atom" />
    <
updated>{gmt_edit_date format='%Y-%m-&#xd;T;%H:%i:&#xsZ;'}</updated>
    <
rights>Copyright (c) {gmt_date format="%Y"}, {author}</rights>
    <
generator uri="http://www.expressionengine.com/" version="{version}">ExpressionEngine</generator>
     <
id>tag:{trimmed_url},{gmt_date format="%Y:%m:%d"}</id>

{exp:comment:entries limit="50" sort="desc" orderby="date" rdf="off" dynamic_start="on" dynamic="off"}
    
<entry>
      <
title>Comment on {exp:xml_encode}{title} by {name}{/exp:xml_encode}</title>
<
id>{comment_url_title_auto_path}#c{comment_id}</id>
      
<link rel="alternate" type="text/html" href="{comment_url_title_auto_path}#c{comment_id}" />
      <
published>{gmt_entry_date format="%Y-%m-&#xd;T;%H:%i:&#xsZ;"}</published>
         <
updated>{gmt_edit_date format='%Y-%m-&#xd;T;%H:%i:&#xsZ;'}</updated>
      <
author>
            <
name>{author}</name>
            
{if url}<uri>{url}</uri>{/if}
      
</author>
      <
content type="html"><![CDATA[
       {comment}
      ]]
></content>
    </
entry>
{/exp:comment:entries}

</feed>

{/exp:rss:feed}

RSS Version - Making an RSS feed of all comments to all posts

Category:RSS Category:Comments Category:Templates

Categories: