Make manual update metadata date field automatic


(Innes Zenati) #1

Matrix Version:6.29.0

Hey,

I am looking for some help to change a manual process is possible. There is a last updated date within a metadata schema and I would like to make this automatic when a page is updated and published. Would this be a matter of editing the paint layout with a keyword modifier?
indent preformatted text by 4 spaces

<!-- Updated details //-->
<meta name="last.updated.date" content="17 March 2023" />

Paint layout:

indent preformatted text by 4 spaces
<div class="row label-row">
  <div class="last-updated col-xs-6 col-sm-6 col-md-6 col-lg-6">
    <span class="label label-updated" aria-hidden="true"><i class="fa fa-history"></i> Last updated: %asset_metadata_last.updated.date%</span>
  </div>

Thanks
Innes


(Iain Simmons) #2

Hi @innesz,

You have a few options here, depending on how it is used:

  1. If this is a metadata date field, there should be an option to use the Last Published Date (last time the asset was made Live) or Last Updated Date as the Default. That will always be dynamic and will change automatically (or rather, will be checked when you use a keyword to access the value).
  2. If it is a metadata text field, you could use a keyword as the Default Value, such as %asset_updated^date_format:j F Y% (or %frontend_asset_updated^date_format:j F Y%).
  3. You could use a trigger on Asset Updated or Asset Status Changed to do a Set Metadata Value action.

Hope that helps,
– iain


(Innes Zenati) #3

Hi Iain, thanks very much for getting back to me.

It’s a metadata date field but if this is set to ‘default’ for last updated date will this not show the default value set in the metadata details? See image.


(Innes Zenati) #4

For example, here is a page which was made live with the default value ticked but it appears as the default value set in the details field.

live-page


(Iain Simmons) #5

Hi @innesz,

I think there’s another setting “Show keyword selector”, perhaps down the bottom, that determines if asset attributes like the published date can be used as the default value. You should then see another option beneath the date or from now ones that you have there where you can select Last published date.

Cheers,
– iain


(Innes Zenati) #6

HI Iain, yeah you are right. I have now set ‘show keyword selector’ and you can select last updated date as an option for default. Do I need to regenerate this metadata schema as I can’t see that option in Matrix 6 at the bottom (Manual says it should be there as before). Thanks again for your help.


(Iain Simmons) #7

Hi @innesz,

From Matrix 6 onwards, you no longer need to regenerate the metadata schema. Instead it will just automatically check the default when needed, so that option has been removed.

Cheers,
– iain


(Innes Zenati) #8

Thanks Iain, might be an idea to update the manual as this still states that you need to regenerate the schema. Good to know, thanks again!


(Iain Simmons) #9

Hi @innesz,

Thanks for pointing that out! I’ve let the team know that the docs need updating.

Cheers,
– iain