From 72b2b0374396deea0d3b3dc0ffe476f8520b566a Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 12 Aug 2009 13:52:50 +0800 Subject: [PATCH] Use the description of the first tagged item for the DESCRIPTION tag. Signed-off-by: Bharat Mediratta --- .../metadescription/views/metadescription_block.html.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/metadescription/views/metadescription_block.html.php b/modules/metadescription/views/metadescription_block.html.php index 5083c55b..bfeacf2a 100644 --- a/modules/metadescription/views/metadescription_block.html.php +++ b/modules/metadescription/views/metadescription_block.html.php @@ -23,10 +23,17 @@ if ($metaDescription == "") { $metaDescription = p::clean($item->title); } + // If this page belongs to a tag, use the description of the first item instead. + if ($theme->tag()) { + if (count($children) > 0) { + $metaDescription = trim(nl2br(p::purify($children[0]->description))); + } + } // If it's still empty, use $metaTags. if ($metaDescription == "") { $metaDescription = $metaTags; } + // Strip HTML $metaDescription = strip_tags($metaDescription); // Strip Line Breaks