Add open graph images

This commit is contained in:
Seth Vargo 2017-04-05 15:57:14 -04:00
parent 45dd756a85
commit 74a26ee793
No known key found for this signature in database
GPG Key ID: C921994F9C27E0FF
3 changed files with 21 additions and 5 deletions

View File

@ -1,7 +1,3 @@
#-------------------------------------------------------------------------
# Configure Middleman
#-------------------------------------------------------------------------
set :base_url, "https://www.consul.io/" set :base_url, "https://www.consul.io/"
activate :hashicorp do |h| activate :hashicorp do |h|
@ -11,6 +7,15 @@ activate :hashicorp do |h|
end end
helpers do helpers do
# Returns the FQDN of the image URL.
#
# @param [String] path
#
# @return [String]
def image_url(path)
File.join(base_url, image_path(path))
end
# Get the title for the page. # Get the title for the page.
# #
# @param [Middleman::Page] page # @param [Middleman::Page] page

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

View File

@ -10,10 +10,21 @@
<link rel="icon" type="image/png" href="<%= image_path("favicons/favicon-32x32.png") %>" sizes="32x32"> <link rel="icon" type="image/png" href="<%= image_path("favicons/favicon-32x32.png") %>" sizes="32x32">
<link rel="icon" type="image/png" href="<%= image_path("favicons/favicon-16x16.png") %>" sizes="16x16"> <link rel="icon" type="image/png" href="<%= image_path("favicons/favicon-16x16.png") %>" sizes="16x16">
<link rel="manifest" href="/android-manifest.json"> <link rel="manifest" href="/android-manifest.json">
<link rel="mask-icon" href="<%= image_path("favicons/safari-pinned-tab.svg") %>" color="#23414a"> <link rel="mask-icon" href="<%= image_path("favicons/safari-pinned-tab.svg") %>" color="#961D59">
<meta name="msapplication-config" content="/microsoft-tile.xml" /> <meta name="msapplication-config" content="/microsoft-tile.xml" />
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@HashiCorp" />
<meta name="twitter:creator" content="@HashiCorp" />
<meta property="og:url" content="<%= File.join(base_url, current_page.url) %>" />
<meta property="og:title" content="<%= title_for(current_page) %>" />
<meta property="og:site_name" content="Consul by HashiCorp"/>
<meta property="og:image" content="<%= image_url("og-image.png") %>"/>
<meta property="og:image:width" content="1200"/>
<meta property="og:image:height" content="1200"/>
<meta property="og:description" content="<%= description_for(current_page) %>" />
<title><%= title_for(current_page) %></title> <title><%= title_for(current_page) %></title>
<%= stylesheet_link_tag "application" %> <%= stylesheet_link_tag "application" %>