Asset Grouping by metadata


(gja) #1

Hi,

 

I have an asset listing using custom grouping.  It is grouping by metadata, sort type "raw value".

 

In my group format I have

 

<div id="">

%group_name%

%group_listing%

</div>

 

What I want to put in the id is not the group name which is Metadata value string, but the metadata key string.

 

I've tried %group_name_key% - but this doesn't work.

 

Is there something available to get the key value from the metadata group sort?

 

Thanks Georgina.

 

using 4.18.2


(Nic Hubbard) #2

Pretty sure that you can use:

%parent_metadata_<field name>_key%

(gja) #3

Alas %parent_metadata_<field name>_key% doesn't work on the group format bodycopy, and also does work on the default format bodycopy either.

 

Nothing is returned.

 

Georgina.


(Nic Hubbard) #4

Alas %parent_metadata_<field name>_key% doesn't work on the group format bodycopy, and also does work on the default format bodycopy either.

 

Nothing is returned.

 

You made sure to replace <field name> with your metadata field name, correct?

 

Have you tried it without _key to see if that at least returns something?


(Iain Simmons) #5

 

You made sure to replace <field name> with your metadata field name, correct?

 

Have you tried it without _key to see if that at least returns something?

 

I believe the 'parent_' keyword prefix only works if you are grouping by 'parent asset'.

 

The only other way I could think of doing this would be to use multiple nested search pages if you knew exactly what the metadata keys would be...


(Douglas (@finnatic at @waikato)) #6

Bump.

 

We're now on 5.1.5 and I'm looking at something similar.

 

Has there been a keyword modifier / keyword added that will operate on %group_name% that would allow me to output my choice of the raw or presentation values of a metadata field being used for grouping?

 

We have an asset listing grouping assets based on a metadata selection field.  It's grouping and sorting based on the raw value from the field which has the casing we want with spaces e.g. "Android Apps" however we really need to sort on the presentation value from the field (which is lowercased and stripped of spaces) as we have some categories beginning with a lowercase 'i'.
 
It would be nice to get a solution to this.

(Bart Banda) #7

We have an asset listing grouping assets based on a metadata selection field.  It's grouping and sorting based on the raw value from the field which has the casing we want with spaces e.g. "Android Apps" however we really need to sort on the presentation value from the field (which is lowercased and stripped of spaces) as we have some categories beginning with a lowercase 'i'.

 

What does your grouping screen look like? I'm pretty sure you can specify the presentation value when selecting to group by metadata select field. Then on the front end, you could use replace modifiers to change the formatting if needed?


(Douglas (@finnatic at @waikato)) #8

The presentation values don't have any spaces or correct casing - so 'androidapps' instead of 'AndroidApps' and iosapps instead of 'iOS Apps'.

 

Grouping/sorting on them works how we want the sorting to work, but I can't see how keyword replacement modifiers would work with the group name to give us the casing and spacing?


(Bart Banda) #9

Ah I see, was not sure about your key/value format.

 

WHat about if you just customise the first asset position in each group to show the group name there rather than on the grouping bodycopy?

 

So in your grouping you'd just have: 

<div id="">
%group_listing%
</div>
 
And in the position 1 format, use use CSS pseudo selector to just display on the first child, use something like this:
 
<h2>%asset_metadata_select_key/value%</h2>
<div>
  ...standard asset type format content...
</div>
 
Would something like that work?

(Douglas (@finnatic at @waikato)) #10

I'm thinking that won't work for us - we're listing two asset types, using different keywords e.g. %asset_name% for one and %asset_attribute_title% for the other - and also using semantic markup so we'd need both first and last position formats to open and close the list if we wanted <hX>..</hX><ul>...</ul>.


(Bart Banda) #11

I'm thinking that won't work for us - we're listing two asset types, using different keywords e.g. %asset_name% for one and %asset_attribute_title% for the other - and also using semantic markup so we'd need both first and last position formats to open and close the list if we wanted <hX>..</hX><ul>...</ul>.

 

You could print the asset name or attribute title dynamically with a keyword modifier, something like %asset_type^replace_keywords:eq:Standard Page:{asset_name}:{asset_attribute_title}%

 

You could customise the last position format easily as well by adding a position format of -1 and add the closing tag there.

 

But not sure how that works with groups and if you need the closing tags in each group or around all of the groups.

 

You could also try with something like this?

 

%group_listing%
</ul>
 

And have the opening of the <ul> tag within the position format of the first asset? 


(Douglas (@finnatic at @waikato)) #12

Bart - thanks - that actually works well for the asset links (once I've put the appropriate keyword replacements and other if/else checks in place)- but I've then gone to check the metadata and been confronted by the fun that is:

 

<!-- HeaderTest gmail; googlecalendar -->

 

where the list item is tagged with multiple values for the select metadata value which just puts us back in square one.  Grouping by metadata is useful, but there are times it would be useful to have access to both the raw and presentation values in the group format.


(Bart Banda) #13

I see, but if you are grouping assets by multiple select metadata fields, how should they be grouped? Would the asset be listed in 2 groups? And which heading would you want for the group if its heading has multiple group names in it? 


(Douglas (@finnatic at @waikato)) #14

We don't want multiple group names in a heading.  We're using the option under asset grouping by metadata to group by individual entry, so that the asset gets displayed under each heading - so yes, an asset might be listed in one, two or many groups depending on how many categories it had been tagged with by the site editors.