Filtering by metadata value in Search Page asset


(Ryan Archer) #1

I'm looking to make a listing of assets (News Items) filtered by a specific metadata value. I looked at using an asset listing page but it does not have the functionality I'm looking for (it will sort but it won't exclude).

I want to embed a list of news feed items in a page but have them filtered according to a metadata value. If a news item does not have the 'preset' metadata value, it is not listed.

 

I have 'kinda' got this working before for relational asset listing http://forums.squizsuite.net/index.php?showtopic=4332&hl=%2Bcan+%2Byou+%2Bfilter+%2Basset+%2Blisting+%2Bbased+%2Bmetadata%3F

But this time I don't want to have the page that its nested in have metadata value to compare the search page output to. I want to force a metadata value manually.

 

E.G. All news items that have the metadata value of "purple" are listed in the nested content. All other news items are not listed.

 

How is this possible?


(Ryan Archer) #2

Think I got somewhere with it by just specifying the (metadata) value of the variable in the nested content screen (not using keyword replacement but inputting the variable itself). This seems to work as it lists all the results as links. Issue now is - can the search page listing return the summary text of each news item along with the linked title? I can't see anything for it in the list of keyword replacements http://manuals.matrix.squizsuite.net/keyword-replacements/chapters/search


(Nic Hubbard) #3

can the search page listing return the summary text of each news item along with the linked title? I can't see anything for it in the list of keyword replacements http://manuals.matrix.squizsuite.net/keyword-replacements/chapters/search

 

Of course it can. Have you customized the Type Format so that the keyword drop down will show keywords for your News Item?


(Ryan Archer) #4

He he yeah I did see that option about an hour later after posting. Feel a bit sheepish really. I ended up getting to a dead end though as I needed the type of news feed to change depending on the public user group the user was assigned through using browser cookies and triggers. Could not find a trigger action to pass the nested design area content a metadata value either. I have 'shelved' it until we upgrade to v5.1 - it seems soooo much better with the new system.

 

For now it's a case of "Computer says no..."


(Tim Davison) #5

I'm just guessing here, but if you are already setting the public user group with cookies/triggers, would it be a small step then to set it as a session variable as well, which could then be referenced via globals keyword?

 

Failing that you could have javascript that automatically pushes to the page and appends the value in the cookie as an arg, that you then reference in the search page.


(Ryan Archer) #6

Wow yeah it should have been working all along.... I had made the %globals_cookie_user_group% keyword up when setting up the triggers. The "Gotcha" moment was when I changed the nested content to take in that value.

I 'assumed' that the news feeds would update auto to the changes I was making in the metadata asset, not so it seems. I had to go into the metadata for each news item and make sure the right one was correctly selected.

 

Also it did help by making the 'search fields' use word logic for 'any word' rather than the exact word. Basically I'd already did it but when updating the metadata schema I assumed it would update the metadata on the assets it was applied to (whoops).


(Tim Davison) #7

Yeah, when you update metadata schemas, especially defaults or changing the values of selects, you have to do a regen, which can be a real hassle on larger sites.  We've all been caught out by this before.   ;)