Skip to content
Grav 2.0 is officially stable. Read the announcement →
Themes & Styling

Antimatter theme date

Solved by Paul Hibbitts View solution

Started by Sarah L 7 years ago · 2 replies · 858 views
7 years ago

Hey,

The date within the Antimatter theme only shows day and month, I'd love to add the year as well, is there an easy way to do that?

Thanks,
Sarah

7 years ago Solution

Hi @techielass, I think you would need to modify the Twig code to do this... here is an example:

1) Open the file /user/themes/antimatter/templates/partials/blog_item.html.twig

2) Change this bit of code:

TWIG
        <time class="dt-published" datetime="{{ page.date|date("c") }}">
            <span>{{ page.date|date("d") }}</span>
            <em>{{ page.date|date("M") }}</em>
        </time>

to this:

TWIG
        <time class="dt-published" datetime="{{ page.date|date("c") }}">
            <span>{{ page.date|date("M") }} {{ page.date|date("d") }}</span>
            <em>{{ page.date|date("Y") }}</em>
        </time>

3) Save this file and reload Blog page to see changes (clear cache as well).

Just as a heads up, if you want to make any template changes like this it is best to do so by first setting up an inherited theme, but since Quark is now the base theme of Grav there has not been an update to Antimatter in quite a while (which could over-write any file changes you make).

Please let me know if the above helps.
Paul

👍 1
7 years ago

That's awesome, thank you!

I'd been staring at it for ages and couldn't figure it out. :)

👍 1

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by stuart young, 2 weeks ago
3 251 2 weeks ago
Themes & Styling · by Sebadamus, 3 weeks ago
5 317 3 weeks ago
Themes & Styling · by martynfoster735, 4 weeks ago
1 310 4 weeks ago
Themes & Styling · by Justin Young, 1 month ago
1 348 1 month ago
Themes & Styling · by Slebeig, 2 months ago
4 474 2 months ago