diff --git a/website/config.rb b/website/config.rb index 5e6629ca4..e0164d430 100644 --- a/website/config.rb +++ b/website/config.rb @@ -6,3 +6,61 @@ activate :hashicorp do |h| h.github_slug = "hashicorp/vault" h.website_root = "website" end + +helpers do + # Get the title for the page. + # + # @param [Middleman::Page] page + # + # @return [String] + def title_for(page) + if page && page.data.page_title + return "#{page.data.page_title} - Vault by HashiCorp" + end + + "Vault by HashiCorp" + end + + # Get the description for the page + # + # @param [Middleman::Page] page + # + # @return [String] + def description_for(page) + return escape_html(page.data.description || "") + end + + # This helps by setting the "active" class for sidebar nav elements + # if the YAML frontmatter matches the expected value. + def sidebar_current(expected) + current = current_page.data.sidebar_current || "" + if current.start_with?(expected) + return " class=\"active\"" + else + return "" + end + end + + # Returns the id for this page. + # @return [String] + def body_id_for(page) + if name = page.data.sidebar_current && !name.blank? + return "page-#{name.strip}" + end + return "page-home" + end + + # Returns the list of classes for this page. + # @return [String] + def body_classes_for(page) + classes = [] + + if page && page.data.layout + classes << "layout-#{page.data.layout}" + end + + classes << "-displaying-bnr" + + return classes.join(" ") + end +end diff --git a/website/helpers/sidebar_helpers.rb b/website/helpers/sidebar_helpers.rb deleted file mode 100644 index 124a7c53c..000000000 --- a/website/helpers/sidebar_helpers.rb +++ /dev/null @@ -1,12 +0,0 @@ -module SidebarHelpers - # This helps by setting the "active" class for sidebar nav elements - # if the YAML frontmatter matches the expected value. - def sidebar_current(expected) - current = current_page.data.sidebar_current || "" - if current.start_with?(expected) - return " class=\"active\"" - else - return "" - end - end -end diff --git a/website/source/assets/stylesheets/hashicorp-shared/_hashicorp-sidebar.scss b/website/source/assets/stylesheets/hashicorp-shared/_hashicorp-sidebar.scss index 99f77f6c5..a8564f209 100644 --- a/website/source/assets/stylesheets/hashicorp-shared/_hashicorp-sidebar.scss +++ b/website/source/assets/stylesheets/hashicorp-shared/_hashicorp-sidebar.scss @@ -143,11 +143,11 @@ $sidebar-icon-height: 20px; } .sidebar-image { - padding-top: 24px; - img { - display: block; - margin: 0 auto; - } + background-image: image-url('logo-header.svg'); + background-position: center center; + background-repeat: no-repeat; + height: 72px; + margin-top: 24px; } @@ -250,17 +250,6 @@ $sidebar-icon-height: 20px; min-width: $sidebar-width; width: $sidebar-width; } - - .sidebar .sidebar-header { - //height: $sidebar-width * 9/16; // 16:9 header dimension - } - - .sidebar .sidebar-image { - /* img { - width: $sidebar-width/4 - $sidebar-padding; - height: $sidebar-width/4 - $sidebar-padding; - } */ - } } .sidebar-overlay { diff --git a/website/source/layouts/_announcement-bnr.erb b/website/source/layouts/_announcement-bnr.erb deleted file mode 100644 index 77bf4f0dc..000000000 --- a/website/source/layouts/_announcement-bnr.erb +++ /dev/null @@ -1,18 +0,0 @@ -
-
-
-
-

- Announcing - - Secure Infrastructure Automation. - - Find out more - -

-
-
-
-
diff --git a/website/source/layouts/_footer.erb b/website/source/layouts/_footer.erb deleted file mode 100644 index cd983f018..000000000 --- a/website/source/layouts/_footer.erb +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - -<%= javascript_include_tag "application" %> - - - - - diff --git a/website/source/layouts/_header.erb b/website/source/layouts/_header.erb deleted file mode 100644 index 88d6ae38e..000000000 --- a/website/source/layouts/_header.erb +++ /dev/null @@ -1,38 +0,0 @@ - diff --git a/website/source/layouts/_meta.erb b/website/source/layouts/_meta.erb deleted file mode 100644 index 9f0a7edaf..000000000 --- a/website/source/layouts/_meta.erb +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - <%= [current_page.data.page_title, "Vault by HashiCorp"].compact.join(" - ") %> - - <%= stylesheet_link_tag "application" %> - - - - - - - - <%= yield_content :head %> - - - " class="page-<%= current_page.data.page_title ? "#{current_page.data.page_title} layout-#{current_page.data.layout} page-sub" : "home layout-#{current_page.data.layout}" %>"> diff --git a/website/source/layouts/_sidebar.erb b/website/source/layouts/_sidebar.erb index 3698086a1..3ba99e94b 100644 --- a/website/source/layouts/_sidebar.erb +++ b/website/source/layouts/_sidebar.erb @@ -3,24 +3,21 @@ diff --git a/website/source/layouts/layout.erb b/website/source/layouts/layout.erb index 729e9a543..018e9d539 100644 --- a/website/source/layouts/layout.erb +++ b/website/source/layouts/layout.erb @@ -1,10 +1,180 @@ -<%= partial "layouts/meta" %> -<%= partial "layouts/announcement-bnr" %> -<%= partial "layouts/header" %> -<%= partial "layouts/sidebar" %> + + + + + + -<%= yield %> + -<%= partial "ember_templates" %> -<%= partial "ember_steps" %> -<%= partial "layouts/footer" %> + <%= title_for(current_page) %> + + <%= stylesheet_link_tag "application" %> + + + + + + + + + + + <%= yield_content :head %> + + + +
+
+
+
+

+ Announcing + + Secure Infrastructure Automation. + + Find out more + +

+
+
+
+
+ + + + <%= partial "layouts/sidebar" %> + + <%= yield %> + + <%= partial "ember_templates" %> + <%= partial "ember_steps" %> + + + + + + + + <%= javascript_include_tag "application" %> + + + +