Link Asset in Related Asset metadata field not letting me retrieve link_url


(James Porich) #1

Matrix Version:

Running v5.5.0.2

trying to achieve
Currently trying to create a Content Container Template where a user can input a YouTube or Vimeo URL in to a Link Asset.

This is then used in a Related Asset metadata field in my CCT. (i.e. “this is the youtube video I want to use”)

On the Paint Layout of the page it then uses some conditional keywords for some basic URL manipulation to then embed the video URL in an iframe.

Issue

We’re at the stage of testing this out - ideally we’re getting users to stick to Youtube and Vimeo through some governance models (so users posting in other media players shouldn’t be an issue or they’ll be forewarned at least).

Because we also want the user to be able to insert an Image asset, we’d like to stick to a Related Asset metadata field (I realise this could probably be solved with a raw text field).

I can not for the life of me pull that Link Asset’s URL out in the Paint Layout of the CCT.

Keyword tests

%asset_metadata_video%
evaluates to the asset id

%asset_metadata_video^as_asset:asset_type%
evaluates as “Link”

%asset_metadata_video^as_asset:asset_name%
evaluates to the Link’s name

%asset_metadata_video^as_asset:asset_url%
evaluates to the Link Assets URL. NOT the link value stored in the Link Asset

%asset_metadata_video^as_asset:link_url%
DOESN’T EVALUATE

%asset_metadata_video^asset_attribute_link_url%
DOESN’T EVALUATE

%asset_metadata_video^as_asset:asset_attribute_link_url%
DOESN’T EVALUATE

Very perplexing and frustrating, especially as I could get a lot of other values from it :frowning:


(Chiranjivi Upreti) #2

This is the correct keyword and should return the “link_url” attribute of that link asset. Not sure why it not working for you, especially while other keywords like %asset_metadata_video^as_asset:asset_name% are working.

Alternatively, can you try “asset_data” keyword and see the “asset_url” attribute is actually there in the json string:

%asset_metadata_video^as_asset:asset_data%

Then you could get “link_url” from that array replacement using “index” modifier:

%asset_metadata_video^as_asset:asset_data^index:attributes^index:link_url^index:value%


(James Porich) #3

Thanks Chiranjivi,

It looks like it was a caching issue in the end as there were so many layers to the page.

%asset_metadata_video^as_asset:asset_attribute_link_url% was evaluating in the end - thank for checking I’m not going mad!