These are chat archives for jescalan/roots

19th
Jan 2016
lolmos
@lolmos
Jan 19 2016 16:34
@stevesunderland thanks!! that worked a treat
wondering if some of these things should be added to the readme or maybe an example page. I'd love to help
lolmos
@lolmos
Jan 19 2016 17:24
This message was deleted
lolmos
@lolmos
Jan 19 2016 22:06

Another Contenful question:

Regarding locales and how to access the info in a DRY manner

my site is structured like this


        /  
        |
        |__english/  
        |  |___ index.html
        |  |___ subpath1/
        |  |   |__page-1-en.html
        |  |   |__page-2-en.html
        |  |___ subpath2/
        |      |__page-3-en.html
        |      |__page-4-en.html  
        |
        |__spanish/
          |___ index.html
          |___ subpath1/
              |__page-1-es.html
              |__page-2-es.html
          |___ subpath2/
              |__page-3-es.html
              |__page-4-es.html

my current config file is

    contentful
      access_token: '#####'
      space_id: '#####'
      content_types:

         pages_en:
          id: 'page'
          template: 'views/_posts_en.jade'
          path: (entry) ->"spanish/#{entry.subpath}/#{entry.title}")

         pages_es:
          id: 'page'
          template: 'views/_posts_es.jade'
          path: (entry) -> ("spanish/#{entry.subpath}/#{entry.title}")

I would like to be able to specify the locale in each layout file

say for example my pages layout jade files

_layout_es.jade -> for lang as ['es'] which gives me the spanish locale values

-layout_en.jade -> for lang as ['en'] which gives me the english locale values

and then have each layout file be

block content

  h1= entry.title
  != markdown(entry.copy)

  img(src!= asset(entry.hero_image, {w: 600, h: 100, q: 50}))

  //-the version of the same page in the other locale
  //- need this for a language switcher button and the hreflang link
  a(href= entry._url.the-other-locale)= event.title.the-other-locale

Is this possible?