Featured asset using metadata and search page


(Oliver Kass) #1

Hi folks,

 

I'm in the middle of building a new events section using a Matrix search page and have hit a bit of a stumbling block when trying to implement "featured" events. What I'd like to be able to do is force a Standard Page asset to the top of the search listing through metadata tags. 

 

So for example all Standard Page assets are tagged with "upcoming event" but one of them is also tagged with "featured event" - i'd like this asset to appear at the top of the listing with a different style applied.

 

I also only want the featured event to appear on page 1 of the listing so when the user clicks along the pagination it no longer appears.

 

Any ideas if there is a simple way to do this? I've tried a few iterations of groups, position settings etc but haven't quite managed to nail it.

 

Thanks

 

Oli


(Tim Davison) #2

Asset grouping, by keyword.  You can use modifiers in the grouping field as well, so can do something like 'asset_metadata_YOUR.FIELD.HERE^eq:featured event'.  (I've also used ^contains to great effect to force an alternative non-intrinsic sort order).  Using modifiers in the keyword grouping field may result in numerical output values, so play around with the sort order to get the features first.

 

Not sure how grouping goes with pagination.  My understanding is it won't repeat on subsequent pages so should be fine for what you need.  

 

If you need to provide group names:

If you're not using group_name keyword then ignore this paragraph.  One side-effect of using modifiers in the group by keyword is the resultant group names can be nonsensical.  For example, if your keyword has ^eq then the group name will be 0 or 1 (i.e. true|false), not the value of the metadata field.  To get a meaningful group name in your group bodycopy you'll have to do some funky translation, like %group_name^eq:1:<h2>Features!!</h2>%.  

 

EDIT: Updated original reply for clarity.


(Oliver Kass) #3

Thanks Tim, I get the first paragraph of your tip but not following the info on resultant group name being 0 or 1 etc... any chance you can expand on the above a wee bit?

 

Oli


(Tim Davison) #4

Sorry - was late last night and on re-reading I see I've covered 2 separate topics.  I've updated the original reply a bit.


(Oliver Kass) #5

Ah, thanks Tim. I'm going to try this out today and see if I can get it working...