Skip to content

Commit

Permalink
Use the description of the first tagged item for the DESCRIPTION tag.
Browse files Browse the repository at this point in the history
Signed-off-by: Bharat Mediratta <bharat@menalto.com>
  • Loading branch information
rWatcher authored and bharat committed Aug 14, 2009
1 parent 40b669e commit 72b2b03
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/metadescription/views/metadescription_block.html.php
Expand Up @@ -23,10 +23,17 @@
if ($metaDescription == "") { if ($metaDescription == "") {
$metaDescription = p::clean($item->title); $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 it's still empty, use $metaTags.
if ($metaDescription == "") { if ($metaDescription == "") {
$metaDescription = $metaTags; $metaDescription = $metaTags;
} }

// Strip HTML // Strip HTML
$metaDescription = strip_tags($metaDescription); $metaDescription = strip_tags($metaDescription);
// Strip Line Breaks // Strip Line Breaks
Expand Down

0 comments on commit 72b2b03

Please sign in to comment.