diff --git a/layouts/partials/_navbar.erb b/layouts/partials/_navbar.erb
index 162f21c..6464ad0 100644
--- a/layouts/partials/_navbar.erb
+++ b/layouts/partials/_navbar.erb
@@ -14,9 +14,9 @@
diff --git a/lib/helpers/nav.rb b/lib/helpers/nav.rb
index 37ebf21..0df57e2 100644
--- a/lib/helpers/nav.rb
+++ b/lib/helpers/nav.rb
@@ -2,15 +2,8 @@
# Helpers for navbar partial
module NavigationHelper
- def nav_items
- navigables.each do |item|
- # Kind of hacky way to check if page is child of another page
- root = %r{/.+?/}.match(item.path)[0]
-
- is_active = @item_rep && @item_rep.path.start_with?(root)
-
- yield item, is_active
- end
+ def child_of(item)
+ item == @item || children_of(item).include?(@item)
end
# Returns every navigable item
diff --git a/lib/helpers_.rb b/lib/helpers_.rb
index c1c965b..7293ebb 100644
--- a/lib/helpers_.rb
+++ b/lib/helpers_.rb
@@ -3,6 +3,7 @@ include Nanoc::Helpers::Capturing
include Nanoc::Helpers::LinkTo
include Nanoc::Helpers::Rendering
include Nanoc::Helpers::Text
+include Nanoc::Helpers::ChildParent
include EnvironmentHelper
include ArchiveHelper