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 |
|---|---|---|---|---|
| 0 | 69 | 2 days ago | ||
| 0 | 111 | 3 days ago | ||
| 0 | 112 | 4 days ago | ||
| 2 | 204 | 1 week ago | ||
| 2 | 462 | 2 weeks ago |