-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Nested Templates (and wrapping JavaScript with templates) #1895
Conversation
Deploy preview ready! Built with commit e049687 |
Deploy preview ready! Built with commit 2cefaeb |
Nearing the end of the tunnel here. The technical implementation for the template takes an array or coerces a string into an array. When creating the elements, we recursively loop through the array to best the components. The data is still per page, but it is now separated by keys based on the componentChunkName. The data is stored this way, but retrieved in a manner that returns the same data structure end result. The idea is for this to be compatible with any existing implementations. I am keeping the TODO in the OP updated as I go. |
Hey just had a quick look at this and wanted to correct a miscommunication. We want nested layout components not nested page components. It's perhaps more semantics than anything else but there can only be one page component controlling the page at a time. The boundary that's significant is between pages and layouts as layouts stay constant across page changes which lets you retain state in the layout as you click between pages. Having nested page components doesn't gain you anything because you can already nest components quite easily yourself. |
On train writing on my phone so happy to discuss at more length later :-) |
This is substantially complete sans documentation. The discussion is in #1866 (and follow-ups to @KyleAMathews comment above). Comments, code reviews, and testing on your own website are welcome. The idea is that this is effectively backward compatible to existing websites (no breaking changes). I can update documentation when the current implementation is greenlit. |
Closed per discussion on #1866. |
Can we make it a plugin instead of putting in core? I really appreciate your efforts on this great feature |
This is a PR based on Issue #1866. Effectively updating createPages to accept an array of templates (and a javascript Post type of page). I got as much done as I could, and I probably won't be able to work on it for a while. Hopefully someone else can pick up where I left off. The using-javascript-transforms should be updated to work on this PR. I have been using it to test.
The remaining TODO as I am aware:
gatsby build
, ie have it run in production