These are chat archives for jescalan/roots

Apr 2015
Jeff Escalante
Apr 12 2015 00:10
Thiago De Bastos
Apr 12 2015 08:56
wow. lol wrong window hah! I hope you guys have all been great! I’ve been busy teaching myself AJAX and now onto Angular. I’ve already thought of better ways to use roots compared to how I was using it. I realise now that many issues I was having with roots were simply due to my lack of js knowledge :)
Dustin Johnson
Apr 12 2015 16:55
This may be out of scope for Roots, but I noticed in the base site template the use of the _path variable. This is used as a placeholder for the title tag but it always comes through as "_index.html" or "_another-page.html" etc. I am using the default Charge server with clean_urls: true and this means my routes are in a practical sense "/" and "another-page." Is there any way to get a clean slug for _path or an equivalent variable in locals that maps against the clean_urls ? I am building a hybrid static site and would use these variables to map against a set of locals data where i could use the path variable to lookup page specific locals. eg.
Dustin Johnson
Apr 12 2015 17:09
      "label": "home"
      "description": "a great homepage"
      "label": "a page wow"
      "description": "a great not homepage"

and then in my jade I would request the page specific data like this:

meta(name='description', content=locals.routes[_path].description)
title= locals.routes[_path].label

This is all just a concept. I implemented a working version as a test with the existing _path variables but this method just doesn't seem elegant and if I end up making a static hybrid that means my route based data is going to have really unusual keys in its JSON and Angular router, keys like "_index.html" etc. If this is not a good road to go down, let me know if there is already a better way to automate some of the page specific locals that I've missed, but if there isn't I can see a lot of great use cases for this type of automation, setting the active state on nav items, re-using content blocks conditionally across similar pages but with some variability based on the page locals, etc.