These are chat archives for jescalan/roots
_pathvariable. This is used as a placeholder for the
titletag but it always comes through as "_index.html" or "_another-page.html" etc. I am using the default Charge server with
clean_urls: trueand this means my routes are in a practical sense "/" and "another-page." Is there any way to get a clean slug for
_pathor an equivalent variable in
localsthat 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.
"locals": "routes": "/": "label": "home" "description": "a great homepage" "another-page": "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.