github.com/maier/nomad@v0.4.1-0.20161110003312-a9e3d0b8549d/website/config.rb (about)

     1  set :base_url, "https://www.nomadproject.io/"
     2  
     3  activate :hashicorp do |h|
     4    h.name        = "nomad"
     5    h.version     = "0.4.1"
     6    h.github_slug = "hashicorp/nomad"
     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} - Nomad by HashiCorp"
    18      end
    19  
    20       "Nomad 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.start_with?(expected)
    37        return " class=\"active\""
    38      else
    39        return ""
    40      end
    41    end
    42  
    43    # Returns the id for this page.
    44    # @return [String]
    45    def body_id_for(page)
    46      if name = page.data.sidebar_current && !name.blank?
    47        return "page-#{name.strip}"
    48      end
    49      return "page-home"
    50    end
    51  
    52    # Returns the list of classes for this page.
    53    # @return [String]
    54    def body_classes_for(page)
    55      classes = []
    56  
    57      if page && page.data.layout
    58        classes << "layout-#{page.data.layout}"
    59      end
    60  
    61      classes << "-displaying-bnr"
    62  
    63      return classes.join(" ")
    64    end
    65  end