Nesting standard page selected in related asset metadata field


(John) #1

Hi,

In my metadata schema I have made a related asset field named ‘page.Alerts’ and selected a standard page asset.

I would like to nest the contents of this specific page at the top of any page using this schema.

I am wondering what keywords I would put in my paint layout to achieve this.

According to the documentation, I would use something like this: %asset_metadata_<related_asset_field_name>^as_asset:<asset_attribute/metadata>%

I have tried the following but it returns nothing:
%asset_metadata_page.Alerts^as_asset:asset_contents%

What am I doing wrong?

Thanks for your help!!


(John gill) #2

My guess is that you’ve got the keyword in the Page Contents part of the Paint Layout, rather than in the Type Formats -> Default Format.

Many keywords don’t work* in the Page Contents of Paint Layouts, I generally don’t bother even trying to use it.

*: for values of “don’t work” approaching “work differently”. I think actually Page Contents gets evaluated in a different context so maybe %globals_asset would work where %asset doesn’t


(Bart Banda) #3

Where is the metadata field stored? On the standard page asset that you are viewing on the frontend or somewhere else?

Also maybe try %frontend_asset_metadata_page.Alerts^as_asset:asset_contents_raw%

Also, does just printing %frontend_asset_metadata_page.Alerts% give you the right asset ID that you want? Maybe start there and make sure that works.

Also, what version of matrix are you using?


(John) #4

Hi! I am on matrix v5.4.5.1 and yes the metadata field is stored on the standard page that I am viewing.

%frontend_asset_metadata_page.Alerts% works and displays the correct asset ID on the page.

However, when I try %frontend_asset_metadata_page.Alerts^as_asset:asset_contents_raw% it is returning nothing on the page.


(John gill) #5

I’m not able to replicate this issue on 5.5.1.5.

Since you can’t tell whether the issue is with the ^as_asset or with the :asset_contents I’d start with trying some other keywords like:

%frontend_asset_metadata_page.Alerts^as_asset:asset_asset%
%frontend_asset_metadata_page.Alerts^as_asset:asset_name%

That should give you an indication of whether the issue is with the looking up of the asset or just with the getting of the contents.