Antimatter theme date

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

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:

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

    to this:

         <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 Like

That’s awesome, thank you!

I’d been staring at it for ages and couldn’t figure it out. :slight_smile:

1 Like