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?
Community guidelines
Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.
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 |
|---|---|---|---|---|
| 2 | 85 | 12 hours ago | ||
| 1 | 60 | 17 hours ago | ||
| 0 | 47 | 1 day ago | ||
| 6 | 350 | 5 days ago | ||
| 3 | 44 | 5 days ago |