4

I have a set of entries which each have 0 or more tags (no limit). For each entry, I am aiming to display 3 'related entries', related by the tags field.

e.g. If entry 1 is tagged with 'apples', 'bananas' and 'pears', then the first results returned would be entries with all 3 tags, followed by 2, followed by just one, then those with none of the tags.

Is this possible? I can't see anything in the documentation about ordering by relevance of the 'relatedTo' parameter.

1

I would consider using Search because it already orders by relevance. You could define the search query using the tags. Make sense?

| improve this answer | |
  • When this question was asked I don't think the score parameter was available, but this has been the option we have been using since that Craft update! – Mike Vaux Jun 28 '16 at 14:39
  • Nice Mike! Glad you have a solution. – Matt P Jun 28 '16 at 14:40
2

I've made a plugin called Similar that does exactly this. Give it a go.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.