forum.coppermine-gallery.net

Dev Board => cpg1.4 Testing/Bugs => cpg1.4 Testing/Bugs: FIXED/CLOSED => Topic started by: Makc666 on December 01, 2008, 04:26:40 pm

Title: [Fixed]: [cpg1.5.x]: meta name="keywords" are not separated properly
Post by: Makc666 on December 01, 2008, 04:26:40 pm
For example I have added to keywords to some picture (separate with spaces) as gallery says.

And when I look at HTML source I see this one:
Code: [Select]
<meta name="keywords" content="help tree"/>
But meta name="keywords" must be separated with commas like:
Code: [Select]
<meta name="keywords" content="help,tree"/>
For example you can look at this page's HTML code:
Code: [Select]
<meta name="keywords" content="coppermine,gallery,picture,forum" />
Title: Re: meta name="keywords" are not separated properly
Post by: Makc666 on December 02, 2008, 11:01:05 am
Open:
displayimage.php

Find:
Code: [Select]
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }
Replace with:
Code: [Select]
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".preg_replace('/\s+/', ',', $CURRENT_PIC_DATA['keywords'])."\"/>"; }
Title: Re: meta name="keywords" are not separated properly
Post by: Nibbler on December 23, 2008, 07:03:57 pm
Done for 1.5.
Title: Re: [cpg1.5.x]: meta name="keywords" are not separated properly
Post by: stunning on May 16, 2009, 01:45:33 pm
but i think meta tags are no more useful. from SEO point of view content is the main thing.
Title: Re: [cpg1.5.x]: meta name="keywords" are not separated properly
Post by: Joachim Müller on May 17, 2009, 07:56:57 am
Really? Great to hear that. Welcome to the bugs board, where we talk about bugs and not about usefullness of features. Please keep out of the discussion here.
Title: Re: [cpg1.5.x]: meta name="keywords" are not separated properly
Post by: Joachim Müller on May 24, 2009, 12:00:25 pm
The resources-consuming preg_replace should not be used if you can use the straightforward str_replace

I have replaced
Code: [Select]
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }with
Code: [Select]
    if ($CURRENT_PIC_DATA['keywords']) {
    $meta_keywords = "<meta name=\"keywords\" content=\"".rtrim(str_replace(' ', ',', $CURRENT_PIC_DATA['keywords']),',')."\"/>";
    }
in the SVN repository for cpg1.4.x. Marking thread as "fixed" and moving accordingly.