diff options
| author | Christian Fowler <spider@viovio.com> | 2009-11-11 19:11:42 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2009-11-11 19:11:42 +0000 |
| commit | 3d1c13d4658c1b55ce02062ff1afb59b06df46cb (patch) | |
| tree | f5682d2394309151d041c07a6ea1927772ab66eb | |
| parent | 3bb7521be1e2da6a9b544d2eae1cf60734f808b4 (diff) | |
| download | kernel-R270.tar.gz kernel-R270.tar.bz2 kernel-R270.zip | |
add default meta description for valid gContent during display so you are not penalized/ignored by web crawlersR270
| -rwxr-xr-x | BitSystem.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/BitSystem.php b/BitSystem.php index c396a09..d8561f9 100755 --- a/BitSystem.php +++ b/BitSystem.php @@ -3,7 +3,7 @@ * Main bitweaver systems functions * * @package kernel - * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitSystem.php,v 1.225 2009/11/10 20:44:43 wjames5 Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitSystem.php,v 1.226 2009/11/11 19:11:42 spiderr Exp $ * @author spider <spider@steelsun.com> */ // +----------------------------------------------------------------------+ @@ -392,7 +392,7 @@ class BitSystem extends BitBase { * @access public */ function display( $pMid, $pBrowserTitle = NULL, $pOptionsHash = array() ) { - global $gBitSmarty, $gBitThemes; + global $gBitSmarty, $gBitThemes, $gContent; $gBitSmarty->verifyCompileDir(); // see if we have a custom status other than 200 OK @@ -436,6 +436,20 @@ class BitSystem extends BitBase { $this->setBrowserTitle( $pBrowserTitle ); } + // populate meta description with something useful so you are not penalized/ignored by web crawlers + if( is_object( $gContent ) && $gContent->isValid() ) { + if( $summary = $gContent->getField( 'summary' ) ) { + $desc = $gContent->parseData( $summary ); + } elseif( $desc = $gContent->getField( 'parsed' ) ) { + } elseif( $summary = $gContent->getField( 'data' ) ) { + $desc = $gContent->parseData( $summary ); + } + if( !empty( $desc ) ) { + $desc = $gContent->getContentTypeDescription().': '.$desc; + $gBitSmarty->assign_by_ref( 'metaDescription', substr( strip_tags( $desc ), 0, 256 ) ); + } + } + $this->preDisplay( $pMid ); $gBitSmarty->assign( 'mid', $pMid ); // $gBitSmarty->assign( 'page', !empty( $_REQUEST['page'] ) ? $_REQUEST['page'] : NULL ); |
