Open jaydson opened 9 years ago
This issue was solved by #166?
I believe #166 was related to a pages i18n issue. This issue is about exposing all pages' metadata to every generated page, right? I believe that is not working yet.
Note that generatePages
and generatePosts
have been merged into the generateFiles
method, so our code base is a bit different now. I believe we can just expose all the posts and pages metadata from the language that are compiling to every generated post and page in the same language, here.
On a second thought, the generateFiles
method currently only has access to one given file type (post
or page
)'s metadata at a time, so while it is possible to expose all pages' metadata to every generated page, we wouldn't be able to expose all pages' metadata to generated posts—I think that would be useful too, don't you think?
Note that, currently, as generateFiles
only access one given file type at a time, we are able to compile posts and pages independently in parallel. We would have to change the generation logic in order to allow generated posts to access pages' metadata.
Yeah, I was wondering about that. I think all data should be exposed.
Use cases:
:+1: We just need to get it done, then. In the future, we can think about normalizing the template data across all kinds of templates, that is, making the template data structure as similar as possible across different templates in order to reduce the cognitive overhead.
I just figure out users are unable to use pages meta-data inside in the pages context. Example: I want to list all pages I have in a template (imagine a menu). This can be done easily in the
index.html
template, or even in partials (in the index context):Why this is possible? Looking at Harmonic's code (src/bin/parser.js) in the function
generateIndex
:As you can see, we're binding the
pages
meta-data.But, unfortunately we can't use the same logic for pages, because this
pages
meta-data aren't being binding. Look (src/bin/parser.js) in the functiongeneratePages
:We just have the current page data, and not all pages.