1

I have a route setup for Dates and would like to show all entries from that particular Day and Month.

For example, clicking 29/11/2022 would take you to mysite.com/dates/29-11 and I would like to see all posts with a date field matching 29/11/****.

From the docs, it doesn't seem like this is possible, as the comparisons include the year; does anyone know of a way to do it?

In my head it's something like:

{% set date = craft.app.request.getSegment(2) %}
{# so date = '29-11' #}

{% set entries = craft.entries().date(['contains', date]).all() %}

OR

{% set entries = craft.entries().search(date).all() %}

1 Answer 1

1

Do I get your question right that the tricky part is to get entries for a certain day in multiple years?

Is the number of years in question limited? Then you could set up a loop and query the years one after another.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.