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 |
|---|---|---|---|---|
| 3 | 95 | 2 hours ago | ||
| 1 | 60 | 2 days ago | ||
| 1 | 81 | 4 days ago | ||
| 0 | 216 | 2 weeks ago | ||
| 1 | 716 | 3 weeks ago |