-
-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
Description
When using the KirbyTag (date: year), the current year is returned automatically. If the HTML output is cached, it will not be reset on New Year's Day.
Expected behavior
When (date: year) is used on a page, the cache should expire on New Year. This can be achieved by adding the following line before returning the date:
kirby()->response()->expires('midnight first day of next year');Your setup
Kirby Version
Kirby 5.1 and all versions before.
Additional context
It might be interesting to add an expiry attribute to the tag, to allow for custom expiries set by the author:
/**
* Date
*/
'date' => [
'attr' => [
'expiry'
],
'html' => function (KirbyTag $tag): string {
kirby()->response()->expires($tag->expiry ?? 'midnight first day of next year');
if (strtolower($tag->date) === 'year') {
return date('Y');
}
return date($tag->date);
}
],Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels