You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Eleventy currently lets you use data fetching, pagination, and collections together to, say, source pages for a blog from a remote source such as WordPress. However, it's not currently possible to set the date property for these pages so that Eleventy's collections feature can sort them — my WordPress-powered pages all have date set to the last-modified time of my template file. It would be better to set date to the publish date of the WordPress content object, or whatever other value makes sense for a piece of fetched data.
Why does it make sense to use collections, rather than just loop over wp.posts or whatever in another template? The addAllPagesToCollections property makes it so that paginated pages can all be added to collections; my POV is that if you can add pages to collections this way, it should be possible to set their sorting date so that their order makes sense. This would also allow me to mix Markdown and paginated pages within a collection, so that garden-variety blog posts can live in WordPress but I could occasionally have an art-directed post that lives in the Eleventy project itself. This would also help with CMS migrations.
Describe the solution you'd like
Simplest would be for the date frontmatter property to be templateable, similar to how permalink works, with a requirement that whatever value is output must be in valid ISO format or else builds will fail.
Alternatively, having date be settable via eleventyComputed would work too.
A more extreme, broader solution would be if pages could be created programmatically, similar to how Gatsby does it; a call to eleventyConfig.createPage() or whatever could take date as a settable property.
Describe alternatives you've considered
I've considered directly listing WordPress posts on my posts index (by looping over my wp.posts var); because I have some existing Markdown content, I'd have to migrate stuff into WordPress and go all-headless-CMS to begin using WP for new posts.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Eleventy currently lets you use data fetching, pagination, and collections together to, say, source pages for a blog from a remote source such as WordPress. However, it's not currently possible to set the
date
property for these pages so that Eleventy's collections feature can sort them — my WordPress-powered pages all havedate
set to the last-modified time of my template file. It would be better to setdate
to the publish date of the WordPress content object, or whatever other value makes sense for a piece of fetched data.Why does it make sense to use collections, rather than just loop over
wp.posts
or whatever in another template? TheaddAllPagesToCollections
property makes it so that paginated pages can all be added to collections; my POV is that if you can add pages to collections this way, it should be possible to set their sorting date so that their order makes sense. This would also allow me to mix Markdown and paginated pages within a collection, so that garden-variety blog posts can live in WordPress but I could occasionally have an art-directed post that lives in the Eleventy project itself. This would also help with CMS migrations.Describe the solution you'd like
Simplest would be for the
date
frontmatter property to be templateable, similar to howpermalink
works, with a requirement that whatever value is output must be in valid ISO format or else builds will fail.Alternatively, having
date
be settable viaeleventyComputed
would work too.A more extreme, broader solution would be if pages could be created programmatically, similar to how Gatsby does it; a call to
eleventyConfig.createPage()
or whatever could takedate
as a settable property.Describe alternatives you've considered
I've considered directly listing WordPress posts on my posts index (by looping over my
wp.posts
var); because I have some existing Markdown content, I'd have to migrate stuff into WordPress and go all-headless-CMS to begin using WP for new posts.The text was updated successfully, but these errors were encountered: