<% summary = strip_tags stripdown(@actionPage.summary) -%>
<%
    image_url = if @actionPage.image.exists?
                  image_url(@actionPage.image.to_s)
                else
                  image_url("og-image-default.png")
                end
-%>

<meta name='description' content='<%= summary -%>'>
<meta property='og:type' content='article'>
<meta property='og:url' content='<%= action_page_url(@actionPage) -%>'>
<meta property='og:title' content='<%= @actionPage.og_title -%>'>
<meta property='og:description' content='<%= summary -%>'>
<meta property='og:image' content='<%= asset_path(image_url) -%>'>
<meta property='og:image:secure_url' content='<%= asset_path(image_url) -%>'>
<% if fb = Rails.application.config.facebook_handle %>
  <meta property='article:publisher' content='https://www.facebook.com/<%= fb -%>'>
<% end %>

<meta name='twitter:card' content='summary_large_image'>
<meta name='twitter:site' content='<%= twitter_handle -%>'>
<meta name='twitter:creator' content='<%= twitter_handle -%>'>
<meta name='twitter:image:src' content='<%= asset_path(image_url) -%>'>
<meta name='twitter:title' content='<%= @actionPage.og_title -%>'>
<meta name='twitter:description' content='<%= summary -%>'>


<% summary = strip_tags stripdown(@actionPage.summary) -%>
<%
    image_url = if @actionPage.image.try(:exists?)
                  image_url(@actionPage.image.to_s)
                else
                  image_url("og-image-default.png")
                end
-%>

<meta name='description' content='<%= summary -%>'>
<meta property='og:type' content='article'>
<meta property='og:url' content='<%= action_page_url(@actionPage) -%>'>
<meta property='og:title' content='<%= @actionPage.og_title -%>'>
<meta property='og:description' content='<%= summary -%>'>
<meta property='og:image' content='<%= asset_path(image_url) -%>'>
<meta property='og:image:secure_url' content='<%= asset_path(image_url) -%>'>
<% if fb = Rails.application.config.facebook_handle %>
  <meta property='article:publisher' content='https://www.facebook.com/<%= fb -%>'>
<% end %>

<meta name='twitter:card' content='summary_large_image'>
<meta name='twitter:site' content='<%= twitter_handle -%>'>
<meta name='twitter:creator' content='<%= twitter_handle -%>'>
<meta name='twitter:image:src' content='<%= asset_path(image_url) -%>'>
<meta name='twitter:title' content='<%= @actionPage.og_title -%>'>
<meta name='twitter:description' content='<%= summary -%>'>


Check if an image is present more safely
Check if an image is present more safely
