Accessing BCT component metadata values in search page results


#1

I’d like some help working with Component templates and accessing their values in other assets.
Squiz Matrix v6.9.1.

  1. I created a new Component template (Squiz Bootstrap Content Templates), with its own edit layout, paint layout, and metadata schema. This component is similar to those available from the Marketplace.
  2. I inserted this component in a few standard pages, all under a single folder.
  3. I created a search page to list all relevant pages.

I cannot access any metadata filled via the inserted components.
I can access ‘regular’ metadata fields (when the schema is applied to the page) but, I can’t figure how to access the metadata fields that are filled on the page using the component template. None of the fields show up in the asset_data_metadata JSON.

Are these accessible in any way? Any help is much appreciated!


(Bart Banda) #2

If you are using %asset_data_metadata% against the parent standard page, you will only get metadata values applied to that asset, not it’s child components.

You’d first need to get the ID of the component asset you want to get the metadata from and then do something like ^as_asset:asset_data_metadata against that. You could potentially try it with a double %asset_children% keyword against the standard page to get the bodycopy and then the children of that bodycopy (the components).


#3

Thanks for the tip, Bart.
I hadn’t considered looking for multiple nested components. I’ll give this approach a try.