How to Target a Content Container Asset ID


(Nick Papadatos) #1

Hi - Can some please tell me if there is a way to target the content container asset ID via a keyword?

This doesn’t work
%globals_asset_metadata_PositionX:1311086% #1311086 is the id of the metadata field

This is due to using a content container template that is using a metadata value ‘PositionX and PositionY’ that I’m trying to target.

If I hard code the content container asset ID it works. %globals_asset_metadata_PositionX:hardcoded asset_id%
I’m hoping this is possible without having to recreate PositionX PositionY metadata fields on an other metadata schema


Container template with metadata fields - not working with asset listing
(Bart Banda) #2

I’m not sure what you mean, using %globals_asset_metadata_PositionX:1311086% IS hardcoding the ID?

And the ID that you are passing should be the ID of the container asset right? Not the ID of the metadata field?


(Nick Papadatos) #3

And the ID that you are passing should be the ID of the container asset right? Not the ID of the metadata field?

Thanks Bart, yes that is correct, .

I have a search asset and I’m trying to get/target the content container’s asset ID but won’t pick up the metadata values because its part of the content container template.

So if I hard code one of the content containers asset IDs (article) it works - the concept of the search asset is to show any related articles and I’m trying to position the background image to the div by adjusting the x y focal point.


(Peter McLeod) #4

Hi

Are you searching for assets of type ‘Bodycopy Div’? this is where the metadata is applied to I think, so in the search listing you should be able to get the value using standard %asset_metadata_% keywords.

Also - is the search performed outside of the parent asset (on other assets) or is it searching on its child content containers?

Thanks


(Nick Papadatos) #5

Hi Peter, thank you for your reply

Because I have built a bespoke site (online magazine) users won’t have the skills to build banners get the focal point of the background image set to the div ect so I have built certain aspects of that (article pages) with a content container template (CCT) to keep consistency - this allows users to add metadata values caption and so on.

The CCT has three main elements - Paint Layout, Metadata Schema and a Simple Edit Layout. The schema has the positionX and Y, caption and so on but the CCT is applied to the content container not the page so the search asset wont pick up that metadata field, Yes?

I know if I add style="background:url…%globals_asset_metadata_PositionX:1311697% #1311697 is one of the content container’s asset IDs of the article that has the CCT applied.

The search asset returns related stories based on tags (metadata) as a stored query search - that all works fine. It’s just I can find a keyword that targets the containers id because all the articles have already their unique X Y positioning without having to create another metadata schema with the same values

I hope this makes sense?


(Peter McLeod) #6

Hi

Think so…

What about nesting an asset listing in the article, that lists the bodycopy divs that are children of the article page that have the metadata applied (using conditions).

This way you could output some styles as needed in the type format similar to below:

#your-wrapper-%asset_assetid%  {
 background-position: %asset_metadata_PositionX% %asset_metadata_PositionY%;
}

Or just add the inline style into the layout part of the container template similar to how you were but without the global scope for the keywords.

Thanks
Peter


(Nick Papadatos) #7

Thanks Peter, did already try that method - I realize now what I’m trying to achieve will not work.
I’m trying to access a metadata schema applied to the content container level. I ended up having to create another pos xy field/s that’s applied at the page level.

Just now getting my head around the templates on what I can and can’t do.