Is it possible to use a show_if design area with the decision based on existence of a metadata value (or even a specific value).
I'm trying to control how the page title is printed out.
- We have a design area that uses a reverse lineage to show a 'default' page title based on that asset's location in the tree.
- I have a metadata field that, if filled, I want to override this default page title. But if empty, use the default reverse lineage defined above.
However, does not seem to work. Similar post is this one: http://forums.squizsuite.net/index.php?showtopic=5035
My code thus far: |
<MySource_AREA id_name="page_title" design_area="show_if" print="no">
<MySource_SET name="condition" value="keyword_regexp" />
<MySource_SET name="condition_keyword" value="asset_metadata_LayoutOptions.PageTitle^charcount" />
<MySource_SET name="condition_keyword_match" value="[0]" />
<MySource_THEN><MySource_PRINT id_name="page_title_default" /></MySource_THEN>
<MySource_ELSE>%asset_metadata_LayoutOptions.PageTitle%</MySource_ELSE>
</MySource_Area>
...
...
...
...
<title><MySource_PRINT id_name="page_title" /></title>
The condition always comes out as FALSE.
I've also tried a number of other variations, e.g. matching on '0' not '[0]', change the condition_keyword value to just the metadata value, and changing the regex to any number of combinations, from matching on a non-empty string, matching on the exact value 'default', etc. Seems I've tried everything.
Post I've linked to above seems to indicate that asset metadata is being evaluated at a different time/place, but I know I've used Show_If's before based on metadata values.
What am I doing wrong? Or does anyone have an alternative way to do it? (besides customisations and/or paint layouts - I know these could be used but would have flow-on effects to site design complexity).
Matrix v5.1.1