2014-07-16 23:51:48 +02: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)
|
|
|
|
current = current_page.data.sidebar_current || ""
|
2015-05-08 11:28:26 +02:00
|
|
|
if current == expected or (expected.is_a?(Regexp) and expected.match(current))
|
2014-07-16 23:51:48 +02:00
|
|
|
return " class=\"active\""
|
|
|
|
else
|
|
|
|
return ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|