nystudio107 / craft-seomatic

SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
https://nystudio107.com/plugins/seomatic
Other
166 stars 71 forks source link

[5.0.2] - Error rendering template string -> Variable "date" does not exist #1466

Closed zizther closed 6 months ago

zizther commented 6 months ago

Describe the bug

I have updated from Craft 4 to 5, and noticed when trying to access the security.txt file it throws an error when trying to output the date variable Error rendering template string -> Variable "date" does not exist in "__string_template__d8deee3dfbc2e869189223d106d1f549" at line 6.

Expiration: {{ date|date_modify("+1 month")|atom }}

Versions

zizther commented 6 months ago

Turns out I can use now instead of date.

Good to see that the error message also comes up when trying to save the file as well, nice touch 👍

khalwat commented 6 months ago

Glad you got it sorted

khalwat commented 6 months ago

Something seems not right to me though, I just tested this and it renders just fine on my Craft 5 install? date is a valid function in Twig: https://twig.symfony.com/doc/3.x/functions/date.html

The current SEOmatic has this set to:

# (required) Expiration date for the security information herein
Expires: {{ date('+1 year')|atom }}
zizther commented 6 months ago

I can confirm this is working for me. The issue was probably the date_modify filter on the date variable itself