From b95712578a333aec21d10075e21d8f8535a772c8 Mon Sep 17 00:00:00 2001 From: Moc Date: Mon, 5 Sep 2022 20:45:50 +0200 Subject: [PATCH] #4687 - Cleanup download meta description Not ideal yet. See comment by @CaMer0n: https://github.com/e107inc/e107/issues/4687#issuecomment-1215081731 --- e107_plugins/download/handlers/download_class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/e107_plugins/download/handlers/download_class.php b/e107_plugins/download/handlers/download_class.php index 56e45a1a0..dddef735a 100644 --- a/e107_plugins/download/handlers/download_class.php +++ b/e107_plugins/download/handlers/download_class.php @@ -379,13 +379,17 @@ class download $tp = e107::getParser(); $metaImage = $tp->thumbUrl($row['download_image'], array('w'=>500), null, true); - $metaDescription = $tp->toHTML($row['download_description'],true); - $metaDescription = preg_replace('/\v(?:[\v\h]+)/', '', $metaDescription); // remove all line-breaks and excess whitespace - $metaDescription = $tp->text_truncate($metaDescription, 290); // + '...' - e107::meta('description', $tp->toText($metaDescription)); + // $metaDescription = $tp->toHTML($row['download_description'],true); + // $metaDescription = preg_replace('/\v(?:[\v\h]+)/', '', $metaDescription); // remove all line-breaks and excess whitespace + // $metaDescription = $tp->text_truncate($metaDescription, 290); // + '...' + + $metaDescription = e107::getParser()->toText($row['download_description']); + $metaDescription = e107::getParser()->truncate($metaDescription, 150); + + e107::meta('description', $metaDescription); e107::meta('keywords', $row['download_keywords']); - e107::meta('og:description', $tp->toText($metaDescription)); + e107::meta('og:description', $metaDescription); e107::meta('og:image', $metaImage); e107::meta('twitter:image:src', $metaImage);