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
Hi everyone. I don't know if a workaround exists for this or if I'm asking for an enhancement, so sorry if I mislabeled this issue.
When using pagination to Create Pages From Data (setting size: 1 and using an alias), I've found that each individual page inherits the date from the template that generated the pages.
It would be nice, instead, to be able to specify a different date for each page, reading from its source element.
Using the example from the above page, I've added dates to the elements:
Hi @denisbrodbeck, thank you.
I tried new Date() instead of strings and it works for me too!
One observation I still have is that this practically bypasses Eleventy's default handling of content dates, which brings us to my real question: I wonder if there is a way to tell Eleventy to treat each "generated" page as a page object, so that page.date plus other useful data will be available.
I've ran into this problem when trying to share the same template across both individual templates and pagination-generated pages. Being able to use the same indexes would be super nice.
Hi everyone. I don't know if a workaround exists for this or if I'm asking for an enhancement, so sorry if I mislabeled this issue.
When using pagination to Create Pages From Data (setting
size: 1and using an alias), I've found that each individual page inherits thedatefrom the template that generated the pages.It would be nice, instead, to be able to specify a different date for each page, reading from its source element.
Using the example from the above page, I've added dates to the elements:
[ { "name":"Fluffy", "age":2, + "date": "2020-01-01", }, ... { "name":"Pennywise", "age":9, + "date": "2020-01-02", } ]I tried using computed data but without success:
exports.data = { // date: 'Created', // default value for the page date, say 2020-06-12. pagination: { data: 'possums', size: 1, alias: 'possum', addAllPagesToCollections: true }, permalink(data) { return `possums/${ possum.name | slug } }, + eleventyComputed: { + date(data) { + return data.possum.date + } } }But when rendering each page,
page.dateholds a Date object from the source template's date key.Is there something else i could do?
The text was updated successfully, but these errors were encountered: