[Fixed]: [cpg1.5.x]: meta name="keywords" are not separated properly [Fixed]: [cpg1.5.x]: meta name="keywords" are not separated properly
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

[Fixed]: [cpg1.5.x]: meta name="keywords" are not separated properly

Started by Makc666, December 01, 2008, 04:26:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Makc666

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:
<meta name="keywords" content="help tree"/>

But meta name="keywords" must be separated with commas like:
<meta name="keywords" content="help,tree"/>

For example you can look at this page's HTML code:
<meta name="keywords" content="coppermine,gallery,picture,forum" />

Makc666

Open:
displayimage.php

Find:
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }

Replace with:
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".preg_replace('/\s+/', ',', $CURRENT_PIC_DATA['keywords'])."\"/>"; }


stunning

but i think meta tags are no more useful. from SEO point of view content is the main thing.

Joachim Müller

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.

Joachim Müller

The resources-consuming preg_replace should not be used if you can use the straightforward str_replace

I have replaced if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }with    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.