Move helper into config (faster loading)

This commit is contained in:
Seth Vargo 2016-10-29 16:44:48 -04:00
parent bb1a517abd
commit 62e3a771f1
No known key found for this signature in database
GPG key ID: 905A90C2949E8787
2 changed files with 11 additions and 12 deletions

View file

@ -29,6 +29,17 @@ helpers do
return escape_html(page.data.description || "")
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)

View file

@ -1,12 +0,0 @@
module SidebarHelpers
# 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
end