These are chat archives for jescalan/roots

16th
Nov 2015
Martin Berggren
@marthings
Nov 16 2015 08:11
Hi guys. I wonder if there are anyone here that could help me to enable a current_page/url for the viewed page or something in roots. I would like to have a navigation or maybe a button in templates with a selected state. Something like this maybe: if (roots.url == 'post.url'){active}". Is this possible :)? I guess something like this could work with dynamic content but i'm stuck.
Seth Krasnianski
@sethkrasnianski
Nov 16 2015 17:45
What’s your build process @marthings? Are you generating 1:1 jade to html files or what?
Martin Berggren
@marthings
Nov 16 2015 18:55
@sethkrasnianski i'm only using dynamic content atm and looking around learning roots. I´m trying to switch from mixture.io (not developed anymore and liquid lang is meh) which had a global json file for all pages with a variable mixture.url that lets me set {% if mixture.url == 'post.url' %}class="active"{% endif %} Quite handy in templates / making navigations. I´m prototyping in static sites and this lets me keep it somewhat DRY.
Steve Sunderland
@stevesunderland
Nov 16 2015 19:32
@marthings I am doing this on a Roots site using li(class=(entry.title == page.title ? 'active' : '')). Will probably be different for your setup but totally doable :smile:
Martin Berggren
@marthings
Nov 16 2015 19:36
hmm sweet
and page.title is roots or do i have to set that up? @stevesunderland
Steve Sunderland
@stevesunderland
Nov 16 2015 20:44
I'm using Contentful and have a pages content type. You could also set a pagetitle variable on your individual pages. @marthings
Martin Berggren
@marthings
Nov 16 2015 20:47
I see. I should use contentful looks nice