SharePoint Products TechCenter > SharePoint Products and Technologies Forums > SharePoint - Social Computing > Sharepoint Blog/ how to set a "read more" link to limit the lines of text on the posting?
Ask a questionAsk a question
 

AnswerSharepoint Blog/ how to set a "read more" link to limit the lines of text on the posting?

  • Monday, October 26, 2009 7:01 PMpotogold2009 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi folks,
    I am  looking for the switch to limit the lines of text showing on a blog post, and to have a "read more", or "more" link to the category. Can you advise me? Thank you in advance, Gary

Answers

  • Wednesday, October 28, 2009 7:46 AMXue-Mei Chang-MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

    I think you can limit the text in a post using SharePoint Designer:

    1.     Open the blog site in SPD and open the default.aspx page;

    2.     Locate the post list view, and "Convert to XSLT Data View";

    3.     Look for the body text, you will see the code like this: <xsl:value-of select="@Body"/>;

    4.     Replace the code to this <xsl:value-of select="substring(@Body,1,62+m)"/> (“m” is the count of the characters you want to display in the post). If the code like this <xsl:value-of select="substring(@Body,1,72)"/> , it will display 10 characters in the default page.

    If you want to set “read more” link, I think you should use JavaScript to set the button.

    Hope it helps.


    Xue-Mei Chang
  • Wednesday, October 28, 2009 8:08 AMJenny Fergeus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Gary!

    This is a great post on how to achieve this, and also how to avoid that half words are displayed etc: http://mdasblog.wordpress.com/2009/01/20/displaying-the-first-n-words-of-a-long-text-column-with-xsl/

    Good luck!
    Jenny

All Replies

  • Wednesday, October 28, 2009 7:46 AMXue-Mei Chang-MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

    I think you can limit the text in a post using SharePoint Designer:

    1.     Open the blog site in SPD and open the default.aspx page;

    2.     Locate the post list view, and "Convert to XSLT Data View";

    3.     Look for the body text, you will see the code like this: <xsl:value-of select="@Body"/>;

    4.     Replace the code to this <xsl:value-of select="substring(@Body,1,62+m)"/> (“m” is the count of the characters you want to display in the post). If the code like this <xsl:value-of select="substring(@Body,1,72)"/> , it will display 10 characters in the default page.

    If you want to set “read more” link, I think you should use JavaScript to set the button.

    Hope it helps.


    Xue-Mei Chang
  • Wednesday, October 28, 2009 8:08 AMJenny Fergeus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Gary!

    This is a great post on how to achieve this, and also how to avoid that half words are displayed etc: http://mdasblog.wordpress.com/2009/01/20/displaying-the-first-n-words-of-a-long-text-column-with-xsl/

    Good luck!
    Jenny