Find page sibling with most same tags

Hi, I’m struggling with this problem for hours and days now.

I have different articles on my website and each article can have multiple tags (field of type multiselect). On each of them article sites I also want to recommend three more articles that have the most agreement of those tags.

For example:
Article1 has topics A, B, C
Article2 has topic B, D
Article3 has topic B, C
Article4 has topic C
Article5 has topic A, B, C
Article6 has topic A, B, C, D

When I’m on the site of Article1 I also want to show the Articles 5, 6 (because they both have all the tags that has Arcticle1) and Article3 (because we want to recommend 3 articles and Article3 has the most agreent after Article 5 and 6.

I am not sure how to implement that so it is efficient. I have already an idea but I don’t know if it is possible with kirby since it’s not a real programming language. Are there any Kirby methods I can use or is it possible to iterate through an array like array[int i]? Nothing seems to work and what is working is pretty unefficient.

There’s a great plugin for that: https://github.com/texnixe/kirby3-related

EDIT: Well, there seems to be an even better plugin for that :point_down:

2 Likes

PHP is a programming language.

There is a plugin for this: https://getkirby.com/plugins/texnixe/similar

1 Like

@thguenther @pixelijn perfect thank you! I’m pretty new to Kirby and I thought it would be also be possible without a plugin and I’m just to stupid :smiley:

It would be possible without a plugin, yes.

It would, but wouldn’t be that efficient or where is the difference?

Well, if you don’t want to rely on a plugin, you can do the coding yourself. If using a plugin is fine for you, use the plugin, of course, instead of reinventing the wheel.