3

I'm currently implementing a search function on a website based on craft, and I was wondering if there was a way of actually showing a small snippet of text that shows in what context the search actually matched.

At the moment the result simply returns the corresponding {{entry.title}}, however I would like the result to also display something like [...] a chain of mountains with the highest *peak* being around x-thousand metres [...] when 'peak' was the search term.

Is there any way to achieve this within Craft? thanks

2

Yes, there is. There is a plugin called Weighted Search which I have used a few times which does exactly that. https://straightupcraft.com/craft-plugins/weighted-search

  • That's great, I'll have a look at it. Thanks Laura! – justussimon91 Nov 23 '16 at 14:55
  • No problem. Happy to help. – Laura Montgomery Nov 23 '16 at 15:22

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.