Trouble with formatting frontend date

Hiya,

I’m currently making changes to the ‘Source’ theme so that it displays the updated_at date on the post page. I would like this to happen because I have multiple evergreen travel guides and I would like the last modified date to be shown on SERPs.

I’m currently struggling to get the formatting to show as I would like. The code I have is;

<time class=“gh-article-meta-date” datetime=“{{date updated_at format=“D MMMM YYYY”}}”>Updated: {{updated_at}}

This is showing something like this on the frontend:

2024-07-10T13:46:23.000+01:00

I’d be grateful if someone could let me know what I’m ding wrong.

You’re formatting the metadata, not the text :sweat_smile:

Try flipping it:

<time class="gh-article-meta-date" datetime="{{updated_at}}">Updated: {{date updated_at format="D MMMM YYYY"}}

You can also only show this text if there’s actually been an update:

1 Like

Ah, yep, that makes sense. Thanks for your help.

Re: your point about it only displaying if there’s been an update, that’s a shame. I guess I’ll have to add a space somewhere in the post and hit ‘Update’ every time I publish something new.

Can you rephrase this? I’m saying that it is possible to conditionally show the updated text :slightly_smiling_face:

Okay, I misunderstood. Thanks for pointing this out.

1 Like