2015-09-17 23:29:25 +00:00
|
|
|
set :base_url, "https://www.nomadproject.io/"
|
2015-09-12 00:01:02 +00:00
|
|
|
|
|
|
|
activate :hashicorp do |h|
|
2015-10-26 14:40:47 +00:00
|
|
|
h.name = "nomad"
|
2016-12-12 21:56:34 +00:00
|
|
|
h.version = "0.5.1"
|
2015-10-26 14:40:47 +00:00
|
|
|
h.github_slug = "hashicorp/nomad"
|
2015-09-12 00:01:02 +00:00
|
|
|
end
|
2016-10-28 00:35: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} - Nomad by HashiCorp"
|
|
|
|
end
|
|
|
|
|
|
|
|
"Nomad 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
|
|
|
|
|
2016-10-29 20:44:48 +00:00
|
|
|
# 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
|
|
|
|
|
2016-10-28 00:35:49 +00:00
|
|
|
# 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
|