Hello
I tried both 'page.header.publish_date' and page.publishDate() to access (and print) the publish date of the page, but none of those methods work.
How can I access the publish date from a twig template?
Hello
I tried both 'page.header.publish_date' and page.publishDate() to access (and print) the publish date of the page, but none of those methods work.
How can I access the publish date from a twig template?
Hi @mathmax
I live in Switzerland, so my date format is dd.mm.yyyy (today's 25.09.2020). So I've put publish_date: 25.09.2020 13:00 in my md file and then use
{{page.header.publish_date}} in my twig template and it works. Check the doc for the right date format according to your country.
https://learn.getgrav.org/16/content/headers#publish-date
Alex
Log in to reply.
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 1 | 268 | 3 weeks ago | ||
| 0 | 196 | 3 weeks ago | ||
| 2 | 331 | 3 weeks ago | ||
| 1 | 253 | 3 weeks ago | ||
| 0 | 222 | 3 weeks ago |