A hack to enable full-text RSS feeds in Plone

by admin published 2008/12/12 11:10:00 GMT+0, last modified 2013-06-26T16:00:19+00:00
You can let people syndicate your Plone site, searches or collections in full. Here's how.

This is a quick hack I came up with after Googling for hours and making many experiments.  Follow these instructions:

  1. Launch your ZMI and locate your Plone instance.
  2. Go to portal_skins/plone_templates/rss_template
  3. Customize it
  4. Locate the line that says
    <description tal:content="obj_item/Description">Description</description>
  5. After that line, add
    <content:encoded 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      tal:condition="obj_item/getText | nothing"
      tal:content="structure python: '&lt;![CDATA[' + obj_item.getText() + ']]&gt;' ">blah
    </content:encoded>

That is it.  Try a search and click the RSS link.  Then view the source.  You should see the content inside the <content:encoded> tags.

But what about spammers harvesting my content?

By now, you must also be familiar with the problem of spammers harvesting full-text feeds for their link farm sites.  .

Making full text conditional to an URL parameter

If you want to make the full text feed conditional to a query string parameter, just add this instead:

<content:encoded 
  xmlns:content="http://purl.org/rss/1.0/modules/content/" 
  tal:define="text obj_item/getText|nothing; full request/full|nothing"
  tal:condition="python: text and full"
  tal:content="structure python: '&lt;![CDATA[' + obj_item.getText() + ']]&gt;' ">blah
</content:encoded>

...and now, the regular feeds will remain unchanged, but whenever your users append ?full=1 to the URL they are using for feeds, their feeds will contain the full article text.

Suggestions, as always, welcome.