Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Blog date and time from header

Started by Muut Archive 10 years ago · 3 replies · 342 views
10 years ago

Hi hive,
sorry for this noob question...

I'm using the soraarticle theme on my site. the blog items always show the date on which the blog item was modified. is there a way to always use the date from the header?

thanks in advance

10 years ago

yes, you can just add in the header:

TXT
date: 01/01/2014 3:14pm

then you can replace line 8-16 from blog_item.html.twig with

TWIG
<div class="blog-date-day">
              {{ page.header.date|date("d") }}
            </div>
            <div class="blog-date-month">
              {{ page.header.date|date("M") }}
            </div>
            <div class="blog-date-year">
              {{ page.header.date|date("Y") }}
            </div>
10 years ago

wow... too easy! thanks a lot!!!! and big thumbs up for the fastest reply ever!

10 years ago

In my case it only worked after changing date: 01/01/2014 3:14pm to date: 01/01/2014 3:14

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1361 9 years ago
Archive · by Muut Archive, 9 years ago
2 939 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2958 9 years ago
Archive · by Muut Archive, 9 years ago
3 1123 9 years ago