vaguerent/website/config.rb
Seth Vargo 5093f3120e Merge docs and www into a single static site
This is a big commit, and I apologize in advance for the future
git-blames all pointing to me. This commit does a few things:

1.  Merges the website/docs and website/www repo into a single website repo
    to be in line with other HashiCorp projects
2.  Updates to use middleman-hashicorp
3.  Converts less to scss to be in line with other projects
4.  Updates page styles to be in line with other projects
5.  Optimizes images
6.  Prepare for S3 + Fastly deployment with scripts, etc.
7.  Removes blog posts (they have been transferred to hashicorp.com with
    redirects in place
8.  Updated sitemap generation script for better SEO
9.  Fixed many broken links
10. Add description to all fields
2016-01-19 14:35:05 -05:00

60 lines
1.4 KiB
Ruby

set :base_url, "https://www.vagrantup.com/"
activate :hashicorp do |h|
h.name = "vagrant"
h.version = "1.8.1"
h.github_slug = "mitchellh/vagrant"
end
helpers do
# 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
# This returns the overall section of the documentation we're on.
def sidebar_section
current = current_page.data.sidebar_current
return "" if !current
current.split("-")[0]
end
def body_classes
classify = ->(s) { s.downcase.gsub(/[^a-zA-Z0-9]/, "-").squeeze("-") }
classes = []
if current_page.data.page_title
classes << "page-#{classify.call(current_page.data.page_title)}"
else
classes << "page-home"
end
if current_page.data.layout
classes << "layout-#{classify.call(current_page.data.layout)}"
end
return classes.join(" ")
end
# "home layout-#{current_page.data.layout}"
# 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} - Vagrant by HashiCorp"
end
"Vagrant by HashiCorp"
end
end