-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Allow (paginated) pages to set date
dynamically
#1323
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: