2014-02-08 00:41:03 +00:00
|
|
|
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)
|
2014-05-01 17:49:30 +00:00
|
|
|
current = current_page.data.sidebar_current || ""
|
2014-02-08 00:41:03 +00:00
|
|
|
if current.start_with?(expected)
|
|
|
|
return " class=\"active\""
|
|
|
|
else
|
|
|
|
return ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|