title: How to use FB instant articles with ruby on rails?
body: <p>I have a blog made in ruby on rails and it has few articles. Articles are saved in the db. To write the content I use Tinymce gem. The rss was working on Feedly and I would like to show the articles on FB instant articles. I followed the documentation on FB pages:
  <a href="https://developers.facebook.com/docs/instant-articles/publishing/setup-rss-feed" rel="nofollow">https://developers.facebook.com/docs/instant-articles/publishing/setup-rss-feed</a></p>
  
  <p>and tried to make it work with information found on this two links:
  <a href="https://www.codingfish.com/blog/129-how-to-create-rss-feed-rails-4-3-steps" rel="nofollow">https://www.codingfish.com/blog/129-how-to-create-rss-feed-rails-4-3-steps</a></p>
  
  <p>and</p>
  
  <p><a href="http://apidock.com/rails/Builder/XmlMarkup" rel="nofollow">http://apidock.com/rails/Builder/XmlMarkup</a></p>
  
  <p>Sometimes FB had loaded the articles but the style was missing, it could not find any content, could not find any articles, then I got the "something went wrong..." error and had to wait for some time and so on.
  I do not know what to do. This is the last version of feed.rss.builder and FB can't see nothing (You haven't created any instant articles yet).</p>
  
  <pre><code>#encoding: UTF-8
  xml.instruct! :xml, :version =&gt; "1.0"
  xml.rss :version =&gt; "2.0" do
    xml.channel do
      xml.title "Blog"
      xml.author "Blog"
      xml.description "Web Development"
      xml.link "http://myblog.dev.eu/"
      xml.language "en"
      for article in @blog_articles
        xml.item do
          if article.title
            xml.title article.title
          else
            xml.title ""
          end
          xml.link("href" =&gt; "http://myblog.dev.eu/blog_posts/"+article.slug.to_s)
          xml.guid article.id
          xml.pubDate article.created_at.to_s(:rfc822)
          xml.author article.author_name
          xml.description article.short_description
          xml.html do
            xml.head do                   
              xml.link("rel" =&gt; "stylesheet", "title" =&gt; "default", "href" =&gt; "#")
              xml.title(article.title)
              xml.meta("property" =&gt; "fb:article_style", "content" =&gt; "bam")
              xml.link("rel" =&gt; "canonical", "href" =&gt; "http://myblog.dev.eu/blog_posts/"+article.slug.to_s)
            end 
            xml.body do
              xml.header do
                xml.image "http://myblog.dev.eu/" + article.picture_url.to_s
              end
              xml.article(article.content)
            end
          end
        end
      end
    end
  end
  </code></pre>
  
  <p>Please help me to fix this code! I would like to submit it for the review and never again touch the code in feed.rss.builder. Thank you!</p>
  
  <p>Edit:</p>
  
  <p>I have changed few things in the code and now it looks so:</p>
  
  <pre><code>#encoding: UTF-8
  xml.instruct! :xml, :version =&gt; "1.0"
  xml.rss :version =&gt; "2.0", "xmlns:content"=&gt;"http://purl.org/rss/1.0/modules/content/" do
  xml.channel do
    xml.title "MyBlog"
    xml.link "http://myblog/"
    xml.description "Web Development, Digital Marketing, Education"
    xml.language "en-us"
    xml.lastBuildDate Time.new.strftime("%Y-%-m-%dT%H:%M").to_s
  
    for article in @blog_articles
      xml.item do
        xml.title article.title
        xml.link "http://myblog.eu/"+article.slug.to_s
        xml.guid article.id
        xml.pubDate article.created_at.strftime("%Y-%-m-%dT%H:%M").to_s
        xml.author article.author_name
        xml.description article.short_description
          xml.content:encoded do
            xml.tag!("!doctype html") 
            xml.html("lang"=&gt;"en", "prefix"=&gt;"op:http://media.facebook.com/op#") do
              xml.head do
                xml.meta("charset"=&gt;"utf-8")   
                xml.link("rel" =&gt; "stylesheet", "title" =&gt; "default", "href" =&gt; "#")
                xml.title(article.title)
                xml.link("rel" =&gt; "canonical", "href" =&gt; "http://myblog.eu/blog_posts/"+article.slug.to_s)
                xml.meta("property" =&gt; "fb:article_style", "content" =&gt; "bam")
              end 
              xml.body do
                xml.article do 
                  xml.header do
                    xml.figure("data-mode" =&gt; "aspect-fit") do
                      xml.img("src"=&gt;"http://myblog.eu/blog_posts/#{article.picture.url}")
                    end
                    xml.h1 article.title
                    xml.h2 article.short_description 
                    xml.h3("Introduction" , "class"=&gt;"op-kicker")
                    xml.address "myadr"
                    xml.time(article.created_at.strftime("%B %dth %Y, %l:%M %p").to_s, "class" =&gt; "op-published", "dateTime" =&gt; article.created_at.strftime("%Y-%-m-%dT%H:%M").to_s) 
                    xml.time(article.created_at.strftime("%B %dth %Y, %l:%M %p").to_s, "class" =&gt; "op-modified", "dateTime" =&gt; article.updated_at.strftime("%Y-%-m-%dT%H:%M").to_s)
                  end
  
                  xml.p article.content
                  xml.figure("data-feedback"=&gt;"fb:likes, fb:comments") do
                    xml.img("src"=&gt;"http://myblog.eu/blog_posts/#{article.picture.url}")      
                      xml.figcaption do
                        xml.h1 "descript"
                        xml.cite "text"
                      end                 
                  end
                  xml.footer do 
                    xml.small "Lab"
                  end
                end
              end
            end
          end
        end
      end
    end
  end 
  </code></pre>
  
  <p>Now FB recognizes articles but still I have the error: "Missing logo". I added the logo in FB styles and it can be found on line:                           </p>
  
  <pre><code>xml.meta("property" =&gt; "fb:article_style", "content" =&gt; "bam")
  </code></pre>
  
  <p>When I open one article in FB editor the whole content is added in the article tag before header tag. It look's something like this:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;&lt;article&gt;&lt;p&gt;!doctype html/&amp;gt;
  
  ...Content...
  
  
        &lt;/p&gt;
  &lt;header&gt;&lt;time class="op-modified" datetime="2016-01-19T10:38:00-08:00"&gt;2016-01-19T10:38:00-08:00&lt;/time&gt;&lt;time datetime="2016-01-19T10:38:00-08:00" class="op-published"&gt;&lt;/time&gt;&lt;h1&gt;Title&lt;/h1&gt;&lt;/header&gt;&lt;footer&gt;&lt;/footer&gt;&lt;/article&gt;&lt;/body&gt;
  &lt;head&gt;&lt;link rel="canonical" href="http:///myblog.eu/article.title"&gt;&lt;/head&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And it's not ready for the review. Any ideas?</p>