Try our conversational search powered by Generative AI!

How to find blocks with a property (Tag)

Vote:
 

Hi,

I would like to generate pages programatically with content, that has a specific property set, like a tag. I've tried with the "categories", but could not find a way to fetch only blocks with a specific category.

So here the story:

An editor creates blocks in the backend and assigns some kind of tags to them. So one block could have none, one or even some tags assigned. So a block would have a property "tags" as a multiselect from some SelectionFactoryType.
Now I call a page with lets say a GET-param with one tag-name. The controller of the pagetype gets the tagname from the GET, searches for all blocks with this tag and displays then in the page-content-area.

I've found the FindPagesWithCriteria(), but this gives me pages. I like this have this for blocks.
Does this exist or do I have to create my own database fetch?

This could also be very handy for the headless approach, where I would deliver content-blocks with specific attributes.

Thanks for any hints

#294632
Jan 13, 2023 15:22
Vote:
 

I just found Geta.Tags This would be what I want, but is not available for v12. Is there an alternaitve?

#294633
Jan 13, 2023 15:33
Vote:
 

There is a version of Geta Tags for Optimizely CMS 12 though it's had a slight name change:

https://github.com/Geta/geta-optimizely-tags

Alternatively, if you have access to Search and Navigation (Find), you should be able to use that to query the content you're looking for.

#294635
Jan 13, 2023 20:00
valdis - Jan 19, 2023 17:10
thx! added note in GitHub old package repo - https://github.com/Geta/Tags#optimizely-cms12
Vote:
 

Thank you, I'll give it a try.

#294898
Jan 18, 2023 7:26
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.