From f235838ecb0167ef6ba865798fd5ba2ace253b01 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Sun, 6 Dec 2015 14:08:08 +0100 Subject: [PATCH] Allow to use procs in navigation links --- config.rb | 3 ++- source/partials/navigation.haml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config.rb b/config.rb index 898ab47..d1e8e44 100644 --- a/config.rb +++ b/config.rb @@ -104,7 +104,8 @@ set :casper, { }, navigation: { 'Home' => '/', - 'Impressum' => '/impressum/' + 'About Me' => ->{ author_path }, + 'Legal' => '/impressum/' } } diff --git a/source/partials/navigation.haml b/source/partials/navigation.haml index a5c6c86..7cf0e41 100644 --- a/source/partials/navigation.haml +++ b/source/partials/navigation.haml @@ -4,6 +4,7 @@ %span.hidden Close %ul - navigation.try(:each) do |label, href| + - href = href.call if href.respond_to?(:call) - css_class = %W(nav-#{label.parameterize}) - css_class << "nav-current" if current_page.url == href %li{class: css_class.join(' '), role: :presentation}