How to find blocks with a property (Tag)



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

Jan 13, 2023 15:22

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

Jan 13, 2023 15:33

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

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.

Jan 13, 2023 20:00
valdis - Jan 19, 2023 17:10
thx! added note in GitHub old package repo -

Thank you, I'll give it a try.

Jan 18, 2023 7:26
* 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.