How is this done? Currently I am using: sortBy(‘date’, ‘desc’, ‘time’, ‘desc’)
not sorting by time. Any advice?
How is this done? Currently I am using: sortBy(‘date’, ‘desc’, ‘time’, ‘desc’)
not sorting by time. Any advice?
http://getkirby.com/docs/cheatsheet/page/modified
if you do not regulary modify the file, maybe this can be something to work with?
I came up with this:
add to your blueprint:
fields:
date:
label: Datum
type: date
width: 1/2
default: today
the loop:
<?php foreach(page('blog')->children()->visible()->sortBy('date', 'desc') as $project): ?>
// list posts
<?php endforeach ?>
In the foreach you need to change ‘blog’ to the page your posts reside in.
‘date’ is the name of the field that is created with the blueprint. Older posts without the field need to be edited.
As far as I can tell Kirby sorts automatically by time of the day, if there are more than one posts per day.
I tried the ‘date created’, but I realized, I can control posts better with the date-picker.
you might want to add this to the ‘blog’ page:
pages:
template: blogpost
num: date
field: date
sort: flip
this does an auto order of the pages, not sure if this is redundant.
To sort by time in addition to date, you need a second time field, then you can use sortBy('date', 'desc', 'time', 'desc')
. The date field doesn’t carry any time information.