Results 1 to 3 of 3
  1. #1
    New Pligger creep's Avatar
    Joined
    Nov 2006
    Posts
    11
    Thanks
    Received:0
    Given: 0

    Dynamic meta description tag generation fix

    Not sure if this is the right place, but since original truncate_content() function don't doing all necessary "truncate" and often outputs html meta description tag in wrong way i consider this a bug and would like to share my fix with the community:

    Found truncate_content() function in /libs/link.php

    PHP Code:
        function truncate_content(){
            
    $TruncatedContent substr($this->content0StorySummary_ContentTruncate);
            if(
    strlen($this->content) > StorySummary_ContentTruncate){$TruncatedContent .= "...";}
            return 
    $TruncatedContent;
        } 
    and replace it with this new one:

    PHP Code:
        function truncate_content(){

            
    $TruncatedContent htmlspecialchars($this->content);
            
    $TruncatedContent preg_replace('/\s+/'' 'trim($TruncatedContent));

            if(
    strlen($TruncatedContent) > StorySummary_ContentTruncate) {
            
    // Set the replacement for the "string break" in the wordwrap function
            
    $cutmarker "**cut_here**";
            
    // Using wordwrap() to set the cutmarker
            // NOTE: wordwrap (PHP 4 >= 4.0.2, PHP 5)
            
    $TruncatedContent wordwrap($TruncatedContentStorySummary_ContentTruncate$cutmarker);
            
    $TruncatedContent explode($cutmarker$TruncatedContent);
            
    $TruncatedContent $TruncatedContent[0] . "...";
            }
            return 
    $TruncatedContent;
        } 
    After this the meta description tag will be generated in right way.

    Enjoy!

  2. #2
    Constant Pligger revolver's Avatar
    Joined
    Oct 2006
    Posts
    220
    Thanks
    Received:0
    Given: 0
    What's wrong with the current output of the description meta tag?

  3. #3
    Casual Pligger formicin's Avatar
    Joined
    Jan 2007
    Posts
    68
    Thanks
    Received:0
    Given: 0
    If your story description has new lines, the description tag looks like:

    Code:
    <meta name="description" content="blabla
    
    newline was there..." />
    It should look like
    Code:
    <meta name="description" content="blabla &lt;br /&gt; &lt;br /&gt;newline was there..." />

Similar Threads

  1. Meta Description Problems
    By HelloKitty in forum Questions & Comments
    Replies: 1
    Last Post: 11-24-2009, 12:04 AM
  2. meta-description
    By etrader in forum Questions & Comments
    Replies: 7
    Last Post: 10-10-2009, 02:39 AM
  3. Meta Description
    By Unknown in forum Questions & Comments
    Replies: 5
    Last Post: 12-21-2007, 04:31 PM
  4. meta description
    By h8dk97 in forum Questions & Comments
    Replies: 1
    Last Post: 12-03-2006, 08:26 PM
  5. where is the code which generates dynamic meta tags?
    By creep in forum Questions & Comments
    Replies: 3
    Last Post: 11-23-2006, 08:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Web Hosting Services by Midphase Dreamhost Web Hosting Donate to Pligg