Better API to read from the file system to source Virtual Templates #4140
ech0-de
started this conversation in
Enhancement Queue
Replies: 2 comments
|
Yeah, I think this is a duplicate of #3468! However, I think we can use this one as the enhancement queue entry for a better API here. Maybe something with import attributes, so that the relationships can feed back into the dependency graph as normal |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
I'm currently migrating a site to Eleventy and the way we would like to do i18n doesn't line up with the approaches shown in the documentation. Alternative language files should reside in the same directory with a language suffix (i.e.,
index.en.htmlandindex.de.html). If a page is not localized it should fallback to the other language and add a note that the content is not localized.I've been able to build this behavior by scanning input files and adding missing localizations as virtual templates. However, when using the dev server, changes to the original file, will not update the virtual fallback page.
I was then attempting to watch for changes to the original file and trigger an update to the virtual template, by calling
addVirtualTemplateagain, which results in an error:Virtual template conflict: you can’t add multiple virtual templates that have the same inputPath.Describe the solution you'd like
I would like to be able to call an
updateVirtualTemplatefunction, which takes the new content of the virtual template and properly build and update the page if it's currently previewed in a browser.Describe alternatives you've considered
Maybe using virtual templates to achieve this was incorrect in the first place. I also considered relying on pagination for this, but decided against it, because the pages themselves may require pagination.
Additional context
Our approach to localization is probably a niche application, but having the option to asynchronously update virtual templates, can be very beneficial for other use cases as well.
All reactions