Container template with metadata fields - not working with asset listing


#1

Matrix Version: 5.3.4.0

I have a container template (CT) with a few metadata fields. I wanted to use a template so these fields weren’t buried on the actual metadata screen.

The assets that use this CT are listed on an asset listing page, where I’ve used some of the metadata fields as used in the CT in the default format. However, the asset listing page isn’t displaying anything.

On the metadata screen of the assets, the fields are empty. Does filling them in the CT not populate them on the metadata screen? Is this why using %asset_metadata_% on the AL default format doesn’t work?

Is there any way around this?


(Bart Banda) #2

Hey Ed,
Can you share a bit more about your setup? Maybe some screenshots?

Not quite sure what you currently have set up or what you are trying to achieve.


#3

Lets say I have some metadata fields

  • Image
  • Name
  • Description

I want to create a container template so a user can fill these in quickly using Edit+, without having to go the metadata screen.

The individual asset that these fields will appear on (which has a paint layout) will also be part of an asset listing.

The asset listing will display the Image and Name fields.

My issue is that the asset listing appears to read the actual metadata of the asset, not the metadata fields as used in the container template.

If i go to the metadata screen of the individual asset, these fields are empty.

Is this a bug, or is this how using metadata fields in container templates work?

I found a similar query on the forum where it appears someone was wanting to do something similar but appears it doesn’t work.


(Bart Banda) #4

Correct, when you use a CT and allow metadata fields to be added, those metadata values are added to each individual content container, not the overall Standard Page. A representation of this is shown here: https://matrix.squiz.net/manuals/content-templates

If you are using an asset listing to list the standard pages, and you want to print the contents of the standard page including it’s content template, you should be able to use %asset_contents% as the keyword in the type format. This will print the Standard page contents using the PL that is applied on the frontend as well, but also the content containers PL from their applied CTs, so it may not give you what you want.

What you could do instead though, is to first list the Standard Pages, then have another asset listing that is nested into the type format that lists content containers, where you would have access to print the individual containers contents and metadata.


(Sam Bondareff) #5

Hi Bart, I am interested in an example of:

What you could do instead though, is to first list the Standard Pages, then have another asset listing that is nested into the type format that lists content containers, where you would have access to print the individual containers contents and metadata.

I have created the CT, Metadata Schema, Simple Edit form and an asset listing but would like to know how to produce the above to output metadata fields in an asset listing. I am using this in a simple FAQs with Question and Answers being the Metadata fields. As Edward noted, I would like my clients to edit the metadata from the CT and output those on the asset listing.

Any help would be appreciated.


(Kevin Kirby) #6

Hi all.

Not sure if there is a solution to this yet, I can’t see one anywhere.

I created a Content Template with nested asset listings inside of the paint layout and needed to be able to restrict the number of items those asset listings list by capturing the metadata that is set inside the content template container.

This might help someone else:

%globals_asset_children^index:0^as_asset:asset_children^as_asset:asset_metadata_your-content-templates-metadata-field^implode%

To explain, asset_children^index:0 means we want the page contents as_asset and we want it’s child containers as_asset and then we want the metadata applied to those containers.

If we are looking for a particular metadata field and there are not multiples of the same applied to the child containers we might get a result such as [null,null.“metadata_value”,null,null,null]

if we implode that, the result will be metadata_value


(Bart Banda) #7

In this case, I’d use SSJS to print the keyword to generate the asset listing with a dynamic root node. Something like:

<script runat="server">
print('%' + 'globals_asset_contents_raw:1234^with_get:root=' + '%asset_metadata_your-ct-metadata-field%' + '%';
</script>

Where root is the dynamic root node parameter for the Asset Listing with asset ID 1234.


Nesting a rest resource asset in content container template - global keywords not working