블로그에 루비로 만든 블로그가 있는데 기사가 거의 없습니다. 기사는 db에 저장됩니다. 내용을 쓰려면 Tinymce gem을 사용합니다. rss는 Feedly에서 작업 중이며 FB 인스턴트 기사에 기사를 표시하고 싶습니다. 나는 FB 페이지의 문서 다음 : https://developers.facebook.com/docs/instant-articles/publishing/setup-rss-feedFB 인스턴트 기사를 레일에 루비와 함께 사용하는 방법은 무엇입니까?
을하고이 두 개의 링크에있는 정보와 함께 작동하도록 노력 :
http://apidock.com/rails/Builder/XmlMarkup
때때로 FB는 기사를 장착했다 https://www.codingfish.com/blog/129-how-to-create-rss-feed-rails-4-3-steps
및
을 스타일이 누락되었거나, 내용을 찾을 수 없거나, 기사를 찾을 수 없다면, "뭔가 잘못되었습니다 ..."오류가 발생하여 잠시 기다려야합니다. 나는 무엇을해야할지 모른다. 이것은 feed.rss.builder의 마지막 버전이며 FB는 아무것도 볼 수 없습니다 (아직 인스턴트 기사를 만들지 않았습니다).#encoding: UTF-8
xml.instruct! :xml, :version => "1.0"
xml.rss :version => "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" => "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" => "stylesheet", "title" => "default", "href" => "#")
xml.title(article.title)
xml.meta("property" => "fb:article_style", "content" => "bam")
xml.link("rel" => "canonical", "href" => "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
이 코드를 수정하는 데 도움을주십시오. 검토를 위해 제출하고 싶습니다. 그리고 feed.rss.builder의 코드를 다시는 건드리지 마십시오. 고맙습니다!
편집 : 코드에서 몇 가지를 변경하고 지금은 이렇게 보이는
:
#encoding: UTF-8
xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0", "xmlns:content"=>"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"=>"en", "prefix"=>"op:http://media.facebook.com/op#") do
xml.head do
xml.meta("charset"=>"utf-8")
xml.link("rel" => "stylesheet", "title" => "default", "href" => "#")
xml.title(article.title)
xml.link("rel" => "canonical", "href" => "http://myblog.eu/blog_posts/"+article.slug.to_s)
xml.meta("property" => "fb:article_style", "content" => "bam")
end
xml.body do
xml.article do
xml.header do
xml.figure("data-mode" => "aspect-fit") do
xml.img("src"=>"http://myblog.eu/blog_posts/#{article.picture.url}")
end
xml.h1 article.title
xml.h2 article.short_description
xml.h3("Introduction" , "class"=>"op-kicker")
xml.address "myadr"
xml.time(article.created_at.strftime("%B %dth %Y, %l:%M %p").to_s, "class" => "op-published", "dateTime" => 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" => "op-modified", "dateTime" => article.updated_at.strftime("%Y-%-m-%dT%H:%M").to_s)
end
xml.p article.content
xml.figure("data-feedback"=>"fb:likes, fb:comments") do
xml.img("src"=>"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
지금 FB 기사를 인식하지만 여전히 오류가 "누락 로고". 나는 FB 스타일의 로고를 추가하고이 라인에서 찾을 수 있습니다 :
xml.meta("property" => "fb:article_style", "content" => "bam")
I 전체 내용이 헤더 태그 전에 문서 태그에 추가 FB 편집기에서 하나의 문서를 열 때. 모양은 다음과 같습니다.
<html>
<body><article><p>!doctype html/>
...Content...
</p>
<header><time class="op-modified" datetime="2016-01-19T10:38:00-08:00">2016-01-19T10:38:00-08:00</time><time datetime="2016-01-19T10:38:00-08:00" class="op-published"></time><h1>Title</h1></header><footer></footer></article></body>
<head><link rel="canonical" href="http:///myblog.eu/article.title"></head>
</html>
리뷰가 준비되지 않았습니다. 어떤 아이디어?