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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Antimatter theme date

Solved by Paul Hibbitts View solution

Started by Sarah L 7 years ago · 2 replies · 748 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 Pedro M, 2 months ago
4 197 2 months ago
Themes & Styling · by Ian, 2 months ago
3 92 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 454 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 47 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 127 3 months ago