我正在尝试添加og:标签以在Facebook上共享我的网址。下面是我的代码 在我的视图文件中,
- content_for :og_meta_tags do
%meta{:content => "#{FbAppId}", :property => "fb:app_id"}/
%meta{:content => "Travelibro blog", :property => "og:name"}
%meta{:content => @journey.photos.first.image.url, :property => "og:image"}
%meta{:content => "website", :property => "og:type"}/
%meta{:content => user_journey_url, :property => "og:url"}/
%meta{:content => "Travelibro - #{@journey.name}", :property => "og:title"}/
%meta{:content => "The TraveLibro app allows your to capture your live journeys On-The-Go with simple check-ins, picture uploads and thoughts to create a beautiful timeline of your travels. It enables friends travelling together to share experiences and post moments to a shared timeline and loved ones to see them in real time.", :property => "og:description"}
我的application.html.haml文件包含以下代码
<!doctype html>
%html
%head{:prefix => "og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#"}
%link{:href => "http://test.com", :rel => "canonical"}
= yield :og_meta_tags
.
.
.
但是,当我从facebook调试工具中抓取新信息时,我收到以下错误,
a required property 'og:title' of type 'string' was not provided.
根本没有拿起我的og:标签。
例如,下面是要在Facebook上分享的网址:
http://travelibro.com/monish-shah/journeys/bangalore-day-trip-2149
当我将此URL放到Facebook调试工具时,我收到以下错误
Object at URL 'http://travelibro.com/monish-shah/journeys/bangalore-day-trip-2149' of type 'website' is invalid because a required property 'og:title' of type 'string' was not provided.