Sort over different datefields

Hi,
I think I’m at a loss, I have a newspage which is working like a blog.
I have different article-templates which will loaded as snippets in the main templates.
And I want to sort the articles by date, but all article-templates have different datefield-names.
Some also a start-date and end-date field.
How can I sort all these articles now over these different fields they are all dates?

Cheers

I see two options:

Create a page model for each page type with a method that returns the desired date then sort by this method.

Use the map() on the collection to create a “field” then sort by this field.

1 Like

Hi,
okay this for me a little bit to overrated.
Until I get this work it will be to expensive for my customer.
I choose the easy way with renaming one date field. So I lost a semantic fieldname but this is not so terrible.

Cheers