Group formats and asset metadata


(Samantha Brown) #1

Hi folks,

 

I have two group formats, the first is grouping my pages within folders by Asset Metadata (field: page_template), then by the second metadata field by Parent Asset sorted by metadata (field: sub-section). 

 

Now, I want to change the way it displays depending on the metadata value, so something like (but not in conditional format, I need keyword replacements please)

 

%begin_asset_metadata_page_template_key^:eq:Guide%

sub-section listings
%end_asset%
 
%begin_asset_metadata_page_template_key^:eq:Cluster%
sub-section listings
%end_asset%
 
Group Level 1 format bodycopy contains:
%group_listing%

(I want to insert the above code here, so it will display a different container div depending on guide or cluster)

if {guide}
<ol>%group_listing%</ol>
else if {cluster}
<ul>%group_listing%</ul>
end

 
Group Level 2 format bodycopy contains:
    <ul class="nav-accordion__list unbulleted js-nav-reveal">
        <li>
          <h2>%group_name^preg_replace:1276887%</h2>
        </li>
        %group_listing%
    </ul>

Thanks.

 


(Tim Davison) #2

Assuming a> you're second level grouping is ok, and b> the values for metadata field 'page-template' are either one or the other, group level format will be:

%group_name^contains:guide:<ol>:<ul>%
%group_listing%
%group_name^contains:guide:</ol>:</ul>%

This is succinct only because there's only 2 options.  if you have more than 2 options for the field value then you would have to catch all of them, so you'd need more keywords.


(Samantha Brown) #3

Found the solution: %parent_metadata_page_template^contains:Guide:<ol>:<ul>% because the section headers are based off its parent metadata field, within a group listing.

 

Thankfully, there are only two types!