Add meta to head for fb share

This commit is contained in:
Christophe Vilayphiou 2012-08-08 03:10:26 +08:00
parent 85a556a4a2
commit acf4446523
3 changed files with 16 additions and 9 deletions

View File

@ -140,7 +140,7 @@ module ApplicationHelper
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
end
stylesheets << "<link href='/assets/social-share-button.scss' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css
@ -162,7 +162,7 @@ module ApplicationHelper
end
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/social-share-button.coffee'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/social-share-button.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n"
page.design.javascripts.each do |js|
# javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"
@ -214,4 +214,15 @@ module ApplicationHelper
object.strftime("%Y-%m-%d")
end
def share_links(object)
js = ''
js << "<meta property='og:title' content='#{object.title}' />\n" rescue ''
js << "<meta property='og:description' content='#{object.subtitle}' />\n" rescue ''
js << "<meta property='og:image' content='#{object.image.url}' />\n" rescue ''
content_tag :div, :class => 'fb' do
concat social_share_button_tag
concat javascript_tag "$('head').append('#{j js}');"
end
end
end

View File

@ -36,6 +36,5 @@
</div>
<% end %>
</div>
<div class="fb">
<%= render "shared/addthis_toolbox"%>
</div>
<%= share_links(@news_bulletin) %>

View File

@ -39,7 +39,4 @@
<% end %>
</div>
<div class="fb">
<%= social_share_button_tag(@news_bulletin.title) %>
<%#= render "shared/addthis_toolbox"%>
</div>
<%= share_links(@news_bulletin) %>