In panel I need to show pages, that only were created today. I imagine query should be something like this, but it doesn’t work:
query: site.find("mytemplate").children.filterBy("created_date_field", today)
In panel I need to show pages, that only were created today. I imagine query should be something like this, but it doesn’t work:
query: site.find("mytemplate").children.filterBy("created_date_field", today)
Please provide more context, where are you using this query. And site.find()
doesn’t work with a template but you need to provide a page id.
Is this a pagesdisplay
section or a pages
field?
Don’t know about the pages field. But the plugin doesn’t have access to a “today” variable in the query context.
The easiest workaround would be to create a collection and then point to that in the query, via kirby.collection("todaypages")
But a field doesn’t actually display pages but just lets you select them. So your custom section would be better suited.
… but actually you might be able to use a date filter
:
query: site.find("mytemplate").children.filterBy("created_date_field", 'date ==', 'today')
Thank you, that’s what I was looking for. Actually, final task is to limit access to older pages (not only in this pagetable), as they still can be found by search or urls.
@pixelijn , I am using pagetable plugin to display submissions by different users. Admin has access to everything, and content creators - only to today’s posts, so that they can’t edit older submissions.