Content Container Templates and Metadata Schemas


(Lewis) #1

5.5.3.3

Hi,
i’m using a Content Container Template and a Metadata Schema (applied through the Details screen of the Content Container Template, as described in the docs) on a Standard page’s containers.

I’ve successfully applied the metadata schema and the fields are now coming through on the container in the Standard page but unfortunately, I can’t find the data once I’ve entered it in the metadata fields.

I’ve tried %frontend_asset_metadata_x% and %asset_metadata_x% but neither produce the values from the Content Container’s metadata fields.

How do you access the values once they’ve been entered? None of the standard keywords work.

Here’s a same of the Paint Layout markup from the Paint Layout that I’ve also associated with the Content Container:

As you can see, I’ve tried both ways I know to try and access the metadata values but neither work. Here’s a screenshot of the Standard Page, with the container template applied:

Any ideas?


(Innes Zenati) #2

Hi Lewis,

I use multiple content container templates and I simple use %asset_contents% and this will print the data on the front end.

Hope this works, if not come back to me and I can share some of the paint layouts with you.

Cheers
Innes


(Lewis) #3

Hi @innesz. Thanks for the reply!

Unfortunately, I need to target the individual fields.

The Content Container Template is being used in my case to populate the various parts of a hero section - title, text snippet, target location for the ‘Read More’ button etc. so simply pulling every in won’t work.

I know I can apply a Metadata Schema to the Standard Page but then I would have to have one for each Content Container on the Standard Page, with subtly different fields names - textSnippet and textSnippet2 for example.

From reading an older post I found on Google, I understand the metadata that is supplied in this way (using Content Container Templates), is applied to the Content Container and not to the whole Standard Page (as would be the case with the traditional approach of applying a Metadata Schema on the Schemas screen of the Standard Page). That post didn’t elaborate on how you then fetch back the metadata that’s supplied, unfortunately.


(Lewis) #4

Incidentally, I’ve just tried %asset_contents% (see below) and nothing shows :thinking:


(Innes Zenati) #5

Right I see what you are trying to do here, do your key words in the paint layout match the names you have set in your metadata schema??

See markup within paint layout I have created for a 3 column panel.

The Asset contents keywords I have used are inserted within the div.


(Lewis) #6

Yes, they match. So for example, here’s the Content Container Template with the Metadata fields exposed:

image

… and here’s the Default Format bodycopy of the Paint Layout that’s applied to that Content Container Template (see below). I’ve highlighted my two different approaches to try and get the metadata values to show - %asset… and %frontend… I wouldn’t necessarly expect with of those to work anyway I guess as it makes sense in this scenario, that the values are applied per-content container and not to the page itself, as would be the case with a ‘regular’ metadata schema.


(Lewis) #7

Could it be that I’m using the wrong keywords in the Simple Edit Layout under the Content Container Template, to capture the metadata values in the first place? I’ve taken a screenshot of the Simple Edit Layout I’m using with the Content Container template, below:

Those keywords (%metadata-F_456480% for example) certainly present inputs on the Standard Page that you’d expect, albeit, when you click the Commit button and page refreshes, the values disappear :thinking:


(Innes Zenati) #8

Hi Lewis,

it might be that… the simple edit layout keywords I am using dont have the asset number:

%metadata-F_metadata_values%
%__custom-contents%


(Lewis) #9

Yeah, I get nothing when I try using %metadata-F_metadata_values%. This keyword was used in Squiz’s own example too.

It’s a puzzler!


(Innes Zenati) #10

This is very puzzling… all of ours are working a treat and the two-three column panel is very similar with multiple fields to fill in and works every time. How have you set up the content container template within the details screen??


(Lewis) #12

What precise version of Squiz are you using?


(Innes Zenati) #13

Yeah looks fine…

I’m using v6.36.0


(Innes Zenati) #14

But all of those content container templates were created on v5 of Matrix and still work perfectly. I assume you are working in a sandbox / testing area so when previewing the page its in a nocache state?


(Lewis) #15

That’s correct. /_nocache on every URL

I’m stumped for the time being.


(Innes Zenati) #16

Yeah I dont understand why that isnt working… you have all the relevant metadata keywords correct to pull in any input. I will keep reading through and try to figure it but without seeing your Matrix instance and taking a proper look I’m probably missing the reason. Hopefully an admin can jump on and figure it out and suggest something I havent.

Sorry i haven’t been able to help solve it


(Lewis) #17

No problem @innesz. It has been good to talk it through! :blush: Hopefully, one of us will have a lightbulb moment! lol


(Innes Zenati) #18

haha I bloody hope so, really annoying me! It’ll be something daft and so obvious.


(Lewis) #19

@Bart is there anyone from Squiz that can help with this @innesz and I have tried a few things as you can see and had no luck. This should work, right!?


(Innes Zenati) #20

@harinder.singh - any ideas on this one please Harinder?? This is bugging me too. Cheers


(Harinder Singh) #21

Great to see you guys working hard… :slight_smile:

I would start with:

Try1. Why you are using "Commit’ button to save your changes? I hit “Save” button from top right to save my changes. May be your commit button is causing the whole confusion. It doesn’t retain the values. Remove the keyword and use save button instead.

Try 2: In simple edit layout asset, comment out “metadata_F_” keywords and try the following keyword to print the whole section.

%metadata-F_section_456479_values^replace:<div >:%

See if this work then we can process further.

Try3. Check your permissions on the whole container template and related assets along with metadata schema.

I can share my container template which recently developed. I am using it in multiple websites.