2

I tried to create a RSS feed with image for each article and eventually a banner for Feedly and a logo but I struggle to do that.

Here is the preview of what I get : Feedly preview

Here is my RSS Builder:

#encoding: UTF-8

xml.instruct! :xml, :version => "1.0"
xml.rss :version => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom', 'xmlns:media' => 'http://search.yahoo.com/mrss/' do
  xml.channel do
    xml.title "My RSS feed"
    xml.description "Super description"
    xml.link "MY_URL"
    xml.language "en"
    xml.tag! 'atom:link', :rel => 'self', :type => 'application/rss+xml', :href => "MY_URL/feed"

    for article in @articles
      xml.item do
        xml.title article.name
        xml.pubDate article.created_at.to_s(:rfc822)
        xml.link "MY_URL"
        xml.guid "MY_URL"

        xml.media(:content, :url => article.image.url(:medium))
        xml.media(:thumbnail, :url => article.image.url(:thumbnail))
        xml.description "<p>" + article.description + "</p>"

      end
    end
  end
end

And here is the result:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
  <channel>
    <title>My RSS feed</title>
    <description>Super description</description>
    <link>MY_URL</link>
    <language>en</language>
    <atom:link rel="self" type="application/rss+xml" href="MY_URL/feed"/>
    <item>
      <title>Dojo</title>
      <pubDate>Mon, 23 Nov 2015 16:58:41 +0000</pubDate>
      <link>MY_URL</link>
      <guid>MY_URL</guid>
      <media:content url="MY_URL"/>
      <media:thumbnail url="MY_URL"/>
      <description>&lt;p&gt;Your security &amp; privacy advisor.&lt;/p&gt;</description>
    </item>
</channel>
</rss>

Thanks for your help with that!

ZazOufUmI
  • 3,212
  • 6
  • 37
  • 67
  • Are you sure your images are linked with an absolute link? Can you open Firebug or something similar to see exactly what your browser is rendering? – Antonio Bardazzi Jan 18 '16 at 10:01

1 Answers1

0

I've checked out how it works in blog.feedly.com and here is example:

<item>
    <title>POST_TITLE</title>
    <link>URL_TO_POST</link>
    <comments>URL_TO_COMMENTS</comments>
    <pubDate>ISODate</pubDate>
    <dc:creator>CDATA_AUTHOR_METATAG</dc:creator>
    <category><![CDATA[All]]></category>

    <guid isPermaLink="false">URL_WITHOUT_SLUG</guid>
    <description>CDATA_DESCRIPTION</description>
    <content:encoded>CDATA_POST_CONTENT</content:encoded>
    <wfw:commentRss>URL_TO_COMMENTS_RSS</wfw:commentRss>
    <slash:comments>NUMBER_OF_COMMENTS</slash:comments>

    <media:content url="IMG_URL" medium="image">
        <media:title type="html">Author</media:title>
    </media:content>

    <media:content url="IMG_URL" medium="image">
        <media:title type="html">img_short_description</media:title>
    </media:content>
</item>

Try to implement your feed items like I described above and if it will not work, check out item parent tags too. You need to do your rss feed just like at blog.feedly.com

axvm
  • 1,876
  • 2
  • 11
  • 19