Replies: 2 comments 14 replies
-
|
Does this download all the data from Directus first, and then render out the templates, or is the data fetched when the templates are rendered? 🤔 Like you correctly stated, the I'm curious if you could potentially extract what fields are used in buildtime from the template, and then dynamically only load the data that's used in the template on the fly 🤔 |
Beta Was this translation helpful? Give feedback.
-
|
Hello again
I took time to think about it all and I have a better idea than the hack of fields:... Here is what the plugin could be:
I think it is possible to do this in a clean way and it is much nicer than the official way (using 1 data file per collection, hard coding the model in the data files...) Here is my question: Let's say I have the collection I tried these API calls but it seems impossible to know it just with the collection name "posts" + field name "related_pages" GET /items/posts/1 {"data":{"id":3,"title":"test","related_pages":[1,2]}}GET /fields/posts/related_pages {"data":{"collection":"posts","field":"related_pages","type":"alias","meta":{"id":916,"collection":"posts","field":"related_pages","special":["m2m"],"interface":"list-m2m","options":null,"display":null,"display_options":null,"readonly":false,"hidden":false,"sort":null,"width":"full","translations":null,"note":null,"conditions":null,"required":false,"group":null,"validation":null,"validation_message":null},"schema":null}} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello
I created a Directus plugin for 11ty static site generator
It is useful to expose Directus collections as global data in 11ty to access in 11ty templates and creates filters to manage assets URLs and translations. This plugin is also an important piece of the next version of Silex website builder
Would someone be kind enough to review my code and help me make it better? Here is where I retrieve directus data, which is a little hacky, as I use the
?fields=*.*.*param of the API: https://github.com/silexlabs/eleventy-plugin-directus/blob/main/_scripts/client.js#L8To your good heart directus community 🙏
Beta Was this translation helpful? Give feedback.
All reactions