Skip to content

Commit df935f4

Browse files
Elle Meredithelle
authored andcommitted
Pull out the head section in the three layout templates
to dry the duplication and to make it easier to see what is on the page
1 parent 15e7066 commit df935f4

File tree

4 files changed

+46
-127
lines changed

4 files changed

+46
-127
lines changed

app/views/layouts/_head.html.erb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<meta charset='utf-8'>
2+
<%= tag :link, rel: "dns-prefetch", href: ENV["ASSET_HOST"] if ENV["ASSET_HOST"] %>
3+
<link rel="dns-prefetch" href="//www2.buildkiteassets.com" />
4+
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-book-39c5d1ed54e49102939d0280aeb20f01ef021bf5ffa74dc25fcafb43fce62ff3.woff2" crossorigin="anonymous" />
5+
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-bold-23e71bdfef13622d0d52b2b4b7ed3c1edb9e81f210692130dee9a521e97d062f.woff2" crossorigin="anonymous" />
6+
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-black-a8002849ea799a4dcf1be0b1abe0f010991cbae508f24f62e9ee0262590197eb.woff2" crossorigin="anonymous" >
7+
8+
<title><%= [content_for(:page_title), "Buildkite Documentation"].compact.join(" | ") %></title>
9+
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11+
<%= stylesheet_link_tag "docsearch", "application", media: "all" %>
12+
13+
<%= javascript_include_tag "docsearch", "application", nonce: true %>
14+
15+
<%= csp_meta_tag %>
16+
17+
<meta name="referrer" content="origin-when-cross-origin" />
18+
19+
<%= tag :link, rel: "shortcut icon", href: image_path("favicon.png"), type: "image/x-icon" %>
20+
<%= tag :link, rel: "apple-touch-icon", href: image_path("appicon.png") %>
21+
<%= tag :link, rel: "mask-icon", href: image_path("logo-pinned.svg"), color: "#14CC80" %>
22+
23+
<!-- Twitter Cards Metadata -->
24+
<%= tag :meta, property: "twitter:card", content: content_for(:page_twitter_card) || "summary_large_image" %>
25+
<meta name="twitter:site" content="@Buildkite">
26+
27+
<!-- Open Graph Metadata -->
28+
<%= tag :meta, property: "og:type", content: content_for(:page_og_type) || "website" %>
29+
<%= tag :meta, property: "og:title", content: content_for(:page_og_title) || content_for(:page_title) || "Buildkite"%>
30+
<%= tag :meta, property: "og:description", content: content_for(:page_og_description) || content_for(:page_description) || "Automate your team’s software development processes, from testing through to delivery, no matter the language, environment or toolchain." %>
31+
<%= tag :meta, property: "og:image", content: content_for(:page_image) || image_url("opengraph_default.png").gsub(/^\/\//, 'https://') %>
32+
<% if page_image_alt = content_for(:page_image_alt) %>
33+
<%= tag :meta, property: "og:image:alt", content: page_image_alt %>
34+
<% end %>
35+
<meta property="og:site_name" content="Buildkite" />
36+
<meta property="og:locale" content="en_US" />
37+
38+
<%= render 'layouts/analytics', application: 'docs', title: "Docs / #{content_for(:page_title)}", logged_in: probably_authenticated? %>
39+
40+
<% if ENV.fetch("ROBOTS_NO_INDEX") { "false" } == "true" %>
41+
<meta name="robots" content="noindex, nofollow">
42+
<% end %>

app/views/layouts/application.html.erb

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,7 @@
11
<!DOCTYPE html>
22
<html lang='en'>
33
<head>
4-
<meta charset='utf-8'>
5-
<%= tag :link, rel: "dns-prefetch", href: ENV["ASSET_HOST"] if ENV["ASSET_HOST"] %>
6-
<link rel="dns-prefetch" href="//www2.buildkiteassets.com" />
7-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-book-39c5d1ed54e49102939d0280aeb20f01ef021bf5ffa74dc25fcafb43fce62ff3.woff2" crossorigin="anonymous" />
8-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-bold-23e71bdfef13622d0d52b2b4b7ed3c1edb9e81f210692130dee9a521e97d062f.woff2" crossorigin="anonymous" />
9-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-black-a8002849ea799a4dcf1be0b1abe0f010991cbae508f24f62e9ee0262590197eb.woff2" crossorigin="anonymous" >
10-
11-
<title><%= [content_for(:page_title), "Buildkite Documentation"].compact.join(" | ") %></title>
12-
13-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
14-
<%= stylesheet_link_tag "docsearch", "application", media: "all" %>
15-
16-
<%= javascript_include_tag "docsearch", "application", nonce: true %>
17-
18-
<%= csp_meta_tag %>
19-
20-
<meta name="referrer" content="origin-when-cross-origin" />
21-
22-
<%= tag :link, rel: "shortcut icon", href: image_path("favicon.png"), type: "image/x-icon" %>
23-
<%= tag :link, rel: "apple-touch-icon", href: image_path("appicon.png") %>
24-
<%= tag :link, rel: "mask-icon", href: image_path("logo-pinned.svg"), color: "#14CC80" %>
25-
26-
<!-- Twitter Cards Metadata -->
27-
<%= tag :meta, property: "twitter:card", content: content_for(:page_twitter_card) || "summary_large_image" %>
28-
<meta name="twitter:site" content="@Buildkite">
29-
30-
<!-- Open Graph Metadata -->
31-
<%= tag :meta, property: "og:type", content: content_for(:page_og_type) || "website" %>
32-
<%= tag :meta, property: "og:title", content: content_for(:page_og_title) || content_for(:page_title) || "Buildkite"%>
33-
<%= tag :meta, property: "og:description", content: content_for(:page_og_description) || content_for(:page_description) || "Automate your team’s software development processes, from testing through to delivery, no matter the language, environment or toolchain." %>
34-
<%= tag :meta, property: "og:image", content: content_for(:page_image) || image_url("opengraph_default.png").gsub(/^\/\//, 'https://') %>
35-
<% if page_image_alt = content_for(:page_image_alt) %>
36-
<%= tag :meta, property: "og:image:alt", content: page_image_alt %>
37-
<% end %>
38-
<meta property="og:site_name" content="Buildkite" />
39-
<meta property="og:locale" content="en_US" />
40-
41-
<%= render 'layouts/analytics', application: 'docs', title: "Docs / #{content_for(:page_title)}", logged_in: probably_authenticated? %>
42-
43-
<% if ENV.fetch("ROBOTS_NO_INDEX") { "false" } == "true" %>
44-
<meta name="robots" content="noindex, nofollow">
45-
<% end %>
4+
<%= render "layouts/head" %>
465
</head>
476
<body <%= beta? ? 'class=beta' : ''-%>>
487
<%= render "layouts/site_header" %>

app/views/layouts/graphql.html.erb

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,7 @@
11
<!DOCTYPE html>
22
<html lang='en'>
33
<head>
4-
<meta charset='utf-8'>
5-
<%= tag :link, rel: "dns-prefetch", href: ENV["ASSET_HOST"] if ENV["ASSET_HOST"] %>
6-
<link rel="dns-prefetch" href="//www2.buildkiteassets.com" />
7-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-book-39c5d1ed54e49102939d0280aeb20f01ef021bf5ffa74dc25fcafb43fce62ff3.woff2" crossorigin="anonymous" />
8-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-bold-23e71bdfef13622d0d52b2b4b7ed3c1edb9e81f210692130dee9a521e97d062f.woff2" crossorigin="anonymous" />
9-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-black-a8002849ea799a4dcf1be0b1abe0f010991cbae508f24f62e9ee0262590197eb.woff2" crossorigin="anonymous" >
10-
11-
<title><%= content_for(:page_title) %> | Buildkite Documentation</title>
12-
13-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
14-
<%= stylesheet_link_tag "docsearch", "application", media: "all" %>
15-
16-
<%= javascript_include_tag "docsearch", "application", nonce: true %>
17-
18-
<%= csp_meta_tag %>
19-
20-
<meta name="referrer" content="origin-when-cross-origin" />
21-
22-
<%= tag :link, rel: "shortcut icon", href: image_path("favicon.png"), type: "image/x-icon" %>
23-
<%= tag :link, rel: "apple-touch-icon", href: image_path("appicon.png") %>
24-
<%= tag :link, rel: "mask-icon", href: image_path("logo-pinned.svg"), color: "#14CC80" %>
25-
26-
<!-- Twitter Cards Metadata -->
27-
<%= tag :meta, property: "twitter:card", content: content_for(:page_twitter_card) || "summary_large_image" %>
28-
<meta name="twitter:site" content="@Buildkite">
29-
30-
<!-- Open Graph Metadata -->
31-
<%= tag :meta, property: "og:type", content: content_for(:page_og_type) || "website" %>
32-
<%= tag :meta, property: "og:title", content: content_for(:page_og_title) || content_for(:page_title) || "Buildkite"%>
33-
<%= tag :meta, property: "og:description", content: content_for(:page_og_description) || content_for(:page_description) || "Automate your team’s software development processes, from testing through to delivery, no matter the language, environment or toolchain." %>
34-
<%= tag :meta, property: "og:image", content: content_for(:page_image) || image_url("opengraph_default.png").gsub(/^\/\//, 'https://') %>
35-
<% if page_image_alt = content_for(:page_image_alt) %>
36-
<%= tag :meta, property: "og:image:alt", content: page_image_alt %>
37-
<% end %>
38-
<meta property="og:site_name" content="Buildkite" />
39-
<meta property="og:locale" content="en_US" />
40-
41-
<%= render 'layouts/analytics', application: 'docs', title: "Docs / #{content_for(:page_title)}", logged_in: probably_authenticated? %>
42-
43-
<% if ENV.fetch("ROBOTS_NO_INDEX") { "false" } == "true" %>
44-
<meta name="robots" content="noindex, nofollow">
45-
<% end %>
4+
<%= render "layouts/head" %>
465
</head>
476
<body <%= beta? ? 'class=beta' : ''-%>>
487
<%= render "layouts/site_header", use_nav: "nav_graphql" %>

app/views/layouts/homepage.html.erb

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,9 @@
11
<!DOCTYPE html>
22
<html lang='en'>
33
<head>
4-
<meta charset='utf-8'>
5-
<%= tag :link, rel: "dns-prefetch", href: ENV["ASSET_HOST"] if ENV["ASSET_HOST"] %>
6-
<link rel="dns-prefetch" href="//www2.buildkiteassets.com" />
7-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-book-39c5d1ed54e49102939d0280aeb20f01ef021bf5ffa74dc25fcafb43fce62ff3.woff2" crossorigin="anonymous" />
8-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-bold-23e71bdfef13622d0d52b2b4b7ed3c1edb9e81f210692130dee9a521e97d062f.woff2" crossorigin="anonymous" />
9-
<link rel="preload" as="font" type="font/woff2" href="https://www2.buildkiteassets.com/assets/lineto-circular/lineto-circular-black-a8002849ea799a4dcf1be0b1abe0f010991cbae508f24f62e9ee0262590197eb.woff2" crossorigin="anonymous" >
10-
11-
<title><%= [content_for(:page_title), "Buildkite Documentation"].compact.join(" | ") %></title>
12-
13-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
14-
<%= stylesheet_link_tag "docsearch", "application", media: "all" %>
15-
16-
<%= javascript_include_tag "docsearch", "application", nonce: true %>
17-
18-
<%= csp_meta_tag %>
19-
20-
<meta name="referrer" content="origin-when-cross-origin" />
21-
22-
<%= tag :link, rel: "shortcut icon", href: image_path("favicon.png"), type: "image/x-icon" %>
23-
<%= tag :link, rel: "apple-touch-icon", href: image_path("appicon.png") %>
24-
<%= tag :link, rel: "mask-icon", href: image_path("logo-pinned.svg"), color: "#14CC80" %>
25-
26-
<!-- Twitter Cards Metadata -->
27-
<%= tag :meta, property: "twitter:card", content: content_for(:page_twitter_card) || "summary_large_image" %>
28-
<meta name="twitter:site" content="@Buildkite">
29-
30-
<!-- Open Graph Metadata -->
31-
<%= tag :meta, property: "og:type", content: content_for(:page_og_type) || "website" %>
32-
<%= tag :meta, property: "og:title", content: content_for(:page_og_title) || content_for(:page_title) || "Buildkite"%>
33-
<%= tag :meta, property: "og:description", content: content_for(:page_og_description) || content_for(:page_description) || "Automate your team’s software development processes, from testing through to delivery, no matter the language, environment or toolchain." %>
34-
<%= tag :meta, property: "og:image", content: content_for(:page_image) || image_url("opengraph_default.png").gsub(/^\/\//, 'https://') %>
35-
<% if page_image_alt = content_for(:page_image_alt) %>
36-
<%= tag :meta, property: "og:image:alt", content: page_image_alt %>
37-
<% end %>
38-
<meta property="og:site_name" content="Buildkite" />
39-
<meta property="og:locale" content="en_US" />
40-
41-
<%= render 'layouts/analytics', application: 'docs', title: "Docs / #{content_for(:page_title)}", logged_in: probably_authenticated? %>
42-
43-
<% if ENV.fetch("ROBOTS_NO_INDEX") { "false" } == "true" %>
44-
<meta name="robots" content="noindex, nofollow">
45-
<% end %>
4+
<%= render "layouts/head" %>
465
</head>
47-
<body>
6+
<body <%= beta? ? 'class=beta' : ''-%>>
487
<header class="HomeHeader PageContainer">
498
<%= link_to "https://buildkite.com/home", title: "Go to Buildkite homepage" do %>
509
<img alt="Buildkite logo" class="HomeHeader__logo" src="<%= logo_image_url %>" />

0 commit comments

Comments
 (0)