summaryrefslogtreecommitdiff
path: root/app/views/layouts/_social_meta.html.erb
blob: 36547d26ffd5277d8fe4192087317d4ade08fd66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<% if (directive = robots_directive) %>
  <meta name="robots" content="<%= directive %>"/>
<% end %>

<% if social_meta? %>
  <meta name="description" content="<%= og_description %>"/>

  <link rel="canonical" href="<%= og_canonical_url %>"/>

  <meta property="og:site_name" content="<%= SocialHelper::OG_SITE_NAME %>"/>
  <meta property="og:type" content="<%= og_type %>"/>
  <meta property="og:url" content="<%= og_canonical_url %>"/>
  <meta property="og:title" content="<%= og_title %>"/>
  <meta property="og:description" content="<%= og_description %>"/>

  <meta property="og:image" content="<%= og_image_url %>"/>
  <meta property="og:image:width" content="<%= og_image_width %>"/>
  <meta property="og:image:height" content="<%= og_image_height %>"/>
  <meta property="og:image:alt" content="<%= og_image_alt %>"/>

  <meta property="og:locale" content="<%= og_locale %>"/>
  <% og_locale_alternates.each do |alternate| %>
    <meta property="og:locale:alternate" content="<%= alternate %>"/>
  <% end %>

  <% if (hreflang_alternates = og_hreflang_alternates).any? %>
    <% hreflang_alternates.each do |code, url| %>
      <link rel="alternate" hreflang="<%= code %>" href="<%= url %>"/>
    <% end %>
    <link rel="alternate" hreflang="x-default" href="<%= og_locale_url(I18n.default_locale) %>"/>
  <% end %>

  <% if og_published_time %>
    <meta property="article:published_time" content="<%= og_published_time %>"/>
  <% end %>

  <%# X ignores og:image unless the card type is declared, and falls back
      to a small square thumbnail. twitter:image is deliberately absent:
      with only twitter:card set, X reuses og:image. %>
  <meta name="twitter:card" content="summary_large_image"/>
<% end %>