2015-04-07 01:35:00 +00:00
|
|
|
set :base_url, "https://www.vaultproject.io/"
|
2015-03-13 17:34:29 +00:00
|
|
|
|
|
|
|
activate :hashicorp do |h|
|
2015-10-26 04:06:17 +00:00
|
|
|
h.name = "vault"
|
2017-03-16 15:41:50 +00:00
|
|
|
h.version = "0.7.0"
|
2015-10-26 04:06:17 +00:00
|
|
|
h.github_slug = "hashicorp/vault"
|
|
|
|
h.website_root = "website"
|
2015-03-13 17:34:29 +00:00
|
|
|
end
|
2017-03-03 16:51:49 +00:00
|
|
|
|
|
|
|
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)
|
2017-03-18 03:14:36 +00:00
|
|
|
return escape_html((page.data.description || "").gsub(/\n+/, ' ').squeeze(' '))
|
2017-03-03 16:51:49 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
return classes.join(" ")
|
|
|
|
end
|
|
|
|
end
|