Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jrosadocruz/5c7b6723b946264c46ed to your computer and use it in GitHub Desktop.
Save jrosadocruz/5c7b6723b946264c46ed to your computer and use it in GitHub Desktop.
//- compile and see the output online at below URL
http://jade-lang.com/
//- navigation data
-var navLinks = { 'Home': 'home.html', 'About': 'about.html', 'Services': 'services.html', 'Contact': 'contact.html'};
//- set default selected item (useful for adding active state for current page navigation link in each page)
- var activeLink = 'Home';
nav(role="navigation" aria-label="Primary")
ul.site-primary-nav
//- iterator
each val, key in navLinks
li.nav__link
//- check for acive link and add class
if activeLink === key
- activeLink = "nav__link-active"
else
- activeLink = ""
//- populate links
a(href=val class="#{activeLink}")= key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment