Skip to content

Instantly share code, notes, and snippets.

@taea taea/_nav.html.haml
Last active Dec 20, 2015

Embed
What would you like to do?
middleman で link_to_if っぽいことをやる
-# source/partials/_nav.html.haml
%nav.nav
%ul
- data.nav.pages.each do |page|
%li{ class: "#{'current' if page_classes == page.name}" }
= page_classes == page.name ? page.label : (link_to page.label, "#{page.name}.html")
# data/nav.yml
pages:
- name: 'index'
label: 'ホーム'
- name: 'concept'
label: 'コンセプト'
- name: 'products'
label: '製品情報'
- name: 'contact'
label: 'お問い合わせ'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.