github.com/ns1/terraform@v0.7.10-0.20161109153551-8949419bef40/website/config.rb (about)

     1  set :base_url, "https://www.terraform.io/"
     2  
     3  activate :hashicorp do |h|
     4    h.name        = "terraform"
     5    h.version     = "0.7.9"
     6    h.github_slug = "hashicorp/terraform"
     7  end
     8  
     9  helpers do
    10    # Get the title for the page.
    11    #
    12    # @param [Middleman::Page] page
    13    #
    14    # @return [String]
    15    def title_for(page)
    16      if page && page.data.page_title
    17        return "#{page.data.page_title} - Terraform by HashiCorp"
    18      end
    19  
    20       "Terraform by HashiCorp"
    21     end
    22  
    23    # Get the description for the page
    24    #
    25    # @param [Middleman::Page] page
    26    #
    27    # @return [String]
    28    def description_for(page)
    29      return escape_html(page.data.description || "")
    30    end
    31  
    32    # This helps by setting the "active" class for sidebar nav elements
    33    # if the YAML frontmatter matches the expected value.
    34    def sidebar_current(expected)
    35      current = current_page.data.sidebar_current || ""
    36      if current == expected or (expected.is_a?(Regexp) and expected.match(current))
    37        return " class=\"active\""
    38      else
    39        return ""
    40      end
    41    end
    42  end