diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php
index 34ecde36a2..572b4b4dd3 100644
--- a/main/inc/lib/api.lib.php
+++ b/main/inc/lib/api.lib.php
@@ -613,6 +613,8 @@ define('MAX_ONLINE_USERS', 12);
// Number of characters maximum to show in preview of course blog posts
define('BLOG_MAX_PREVIEW_CHARS', 800);
+// HTML string to replace with a 'Read more...' link
+define('BLOG_PAGE_BREAK', '
');
// Make sure the CHAMILO_LOAD_WYSIWYG constant is defined
// To remove CKeditor libs from HTML, set this constant to true before loading
diff --git a/main/inc/lib/blog.lib.php b/main/inc/lib/blog.lib.php
index 552df1cfb1..822db1c0ac 100755
--- a/main/inc/lib/blog.lib.php
+++ b/main/inc/lib/blog.lib.php
@@ -3075,6 +3075,12 @@ class Blog
*/
private static function getPostExtract($fullText, $length = BLOG_MAX_PREVIEW_CHARS)
{
+ $parts = explode(BLOG_PAGE_BREAK, $fullText);
+
+ if (count($parts) > 1) {
+ return $parts[0];
+ }
+
// Remove any HTML from the string
$text = strip_tags($fullText);
$text = api_html_entity_decode($text);