2

I have a content search web part that displays a single blog. I have the body area that might contain too much text to display on a main page. What is the easiest way to cut it to 3 lines or a 200 number of character (and add the 'click here for more...' bit)

I have followed this guide but it is applied to an article page and not a blog and I cannot match the corresponding fields

http://www.myphotoadventures.nl/2014/06/04/display-template-show-limits-characters/

2
  • I'm not sure I understand - you state you have the body field, but then you state you can't find corresponding fields. Just for clarity - are you stating that you want to trim the body field - but that you do not know what field to use in the Display template? Commented Oct 10, 2014 at 16:15
  • if you read the link I posted, it is shown how to apply it on the article page. I need it on the blog post. In the article page there is no 'body' as in the blog post. I have done it and it does not work, therefore there needs to be something especially made for the blog post. In addition, in the example the text is flat text, while I want to keep the rich text.
    – susan
    Commented Oct 13, 2014 at 9:25

2 Answers 2

2
+25

You may be able to accomplish this by creating a new calculated column called "Short Description". It would essentially be a =LEFT([Column1],LEN([Column1])-25) and then you could do a CONCAT to add your ellipse "...". Or something similar.

Then you could just show the Short Description in your search.

Field Formulas: http://msdn.microsoft.com/en-us/library/bb862071(v=office.14).aspx

1
  • For a bounty of 50 I would like a clean cut code. Also it would be very instructive since there is no element in the content search current templates that has that type of code.
    – susan
    Commented Oct 9, 2014 at 7:17
0

I personally would take the approach of writing a custom template for it, and doing the work in JavaScript. The templating system for Content Search web parts is pretty straightforward, and you can look at the out of the box ones for reference.

This seems to be a fairly good guide to the templates and how to customise them: http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/09/03/3588171.aspx

1
  • To reduce the number of characters displayed from a blog post, I cannot reference any of the existing one, since there is no such a template to begin with. The guide you have linked does not provide such example.
    – susan
    Commented Oct 10, 2014 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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