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

RSS Comments

Here’s a simple way to add comments to your RSS feeds. To have comments in your RSS feed, you’ll need to use an embedded template and turn on PHP parsing for your RSS feed template.

Note This method requires a PHP include to a full URL. Some hosts disallow this for security reasons. If your host is one of those, then please see this thread for a different way of doing this.

1. Create a new template that will contain the comments code. Call it whatever you like.

2. In that new template, use the {exp:comment:entries} tag along with any other code you want included in your feed for each post. For example, I used this:

<div><strong>Comments</strong></div
<
hr />{exp:comment:entries} 
{if comments}
<em>{comment}</em
<
div>Posted by {name} on {comment_date format='%m/%d'
at {comment_date format
='%h:%i %A'}</div
<
hr />{/if} 
{if trackbacks} 
<em><strong>{title}</strong>{content}</em
<
div>Tracked on: <a href="{trackback_url}">{weblog_name}</a> ({trackback_ip}
at {trackback_date format="%Y %m %d %H:%i:%s"}</div
<
hr />{/if}{/exp:comment:entries} 


3. In your RSS feed template, inside of the {exp:weblog:entries} tag, there should be a <description> tag. Replace that line with this one:

<description><![CDATA[{body}{extended} 
<?php 
include("{comment_path=PATH_TO/NEW_TEMPLATE}"); 
?>]]></description

Obviously put in the path to your new comments template.

4. For your RSS feed template, turn on PHP parsing, and make sure it’s set to output.

And you should be good to go from there.

Note: This currently only functions correctly using RSS, it does not refresh correctly with Atom.

5. This alternative template includes the total number of comments and trackbacks:

<div><strong>{exp:weblog:entries limit="1"
{if comment_total 
== 0}0 Comments{/if} 
{if comment_total 
== 1}1 Comment{/if} 
{if comment_total 
1}{comment_total} Comments{/if} 
{if trackback_total 
== 0} and 0 Trackbacks{/if} 
{if trackback_total 
== 1} and 1 Trackback{/if} 
{if trackback_total 
1} and {trackback_total} Trackbacks{/if} 
{
/exp:weblog:entries}</strong></div
[code] <hr />{exp:comment:entries} 
{if comments}
<em>{comment}</em
<
div>Comment by {name} on {comment_date format='%d-%m-%y'
at {comment_date format
='%H:%i'}</div
<
hr />{/if} 
{if trackbacks} 
<em><strong>{title}</strong>{content}</em
<
div>Trackback from: <a href="{trackback_url}">{weblog_name}</a> ({trackback_ip}
on {trackback_date format="%d-%m-%y, %H:%i"}</div
<
hr />{/if}{/exp:comment:entries} 

Category:RSS Category:Templates

Category:EE1

Categories: