meta keywords displayed as description in google

General chit chat about razor, not specifically related to a topic but about razorCMS

meta keywords displayed as description in google

Postby Jiff » Sun Jul 15, 2012 8:51 pm

razorcms up to date
blade-meta
theme: razorCMS
==================

Hi forumers,

I just realized that google is displaying:
* page title correctly (the blue 1st line),
* page digest incorrectly, it seems it displays: page_menu_name page_keywords page_digest

displaying page_menu_name is not a problem, but page_keyword is!

this is a capture of google display, page_menu_name == "Prestations"; page_digest is after the "...":
Code: Select all
3AIT ยป Prestations - Informatique Pro Debian Linux Nantes & Environs
Prestations nantes,linux,nantes,informatique,professionnel,serveur,email,serveur  email ... Envoyer et recevoir vos fax, les archiver sous forme de PDF, faxer ...


If possible, I'd like it to only display page_digest, or even page_menu_name & page_digest, but not page_keywords!

How can I change this behavior?

Note: a wget of the same page shows every tags stands on one line, except:
<meta name="description".../><meta name="keywords".../>
may be that's the reason of this mess, but I'm not tough enough in php to know where/how to add a line jump to avoid that.

JY
Jiff
 
Posts: 15
Joined: Mon Jun 25, 2012 10:48 pm

Re: meta keywords displayed as description in google

Postby Adminer » Sun Jul 15, 2012 11:00 pm

Jiff wrote:displaying page_menu_name is not a problem, but page_keyword is!
How can I change this behavior?


Hi!
Find the folder: theme/default_xhtml.php

You can find there:

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title><?php loadSettings('sitename'); ?> &raquo; <?php loadPageTitle(); ?></title>
    <?php BsocketB('public-xhtml-head1'); ?>
    <link rel="stylesheet" type="text/css" href="<?php cssLocation(); ?>" />
    <link rel="shortcut icon" href="theme/images/favicon.ico" type="image/x-icon"/>
    <?php BsocketB('public-xhtml-head2'); ?>
    <script type="text/javascript" src="<?php scriptPath(); ?>navbar.js"></script>
</head>
<body>
    <div id="brace">
    <div id="pageframe">
    <div id="pageframer">
        <div id="headermid">
        <div id="headerr">
        <div id="header">
            <h1><?php loadSettings('sitename'); ?></h1>
            <h2><?php loadSettings('siteslogan'); ?></h2>
       <?php BsocketB('public-xhtml-header'); ?>
        </div>
        </div>
        </div>


So, you have a "blades" there to input as you want:
<title><?php loadSettings('sitename'); ?> &raquo; <?php loadPageTitle(); ?></title>
for sitename and page title,

<?php BsocketB('public-xhtml-head1'); ?>
to display everything you want in this place,

<?php BsocketB('public-xhtml-head2'); ?>
to display everything you want in this place

what you have defined in your bladepacks.



OK. Now, you have a Meta blade pack with a file: system_metaForPages.php
and there is definition in front in line:
$bladeList['xhtmlMetaData'] = 'public-xhtml-head1';

Now, you have a definition with 'xhtmlMetaData' function to display the results of this function... in a place: 'public-xhtml-head1

Lets have a look at 'xhtmlMetaData' function in system_metaForPages.php:

// blade - output xhtml META DATA //
function xhtmlMetaData() {
global $razorArray,$slabFlag;
echo "<meta name='description' content='".$razorArray['meta'][$slabFlag]['metades']."' />";
echo "<meta name='keywords' content='".$razorArray['meta'][$slabFlag]['metakey']."' />";
}
// end /////////////////////////////

In PHP echo command is to display you want.
If you remove this line: echo "<meta name='keywords' content='".$razorArray['meta'][$slabFlag]['metakey']."' />";
you remove your keywords from displaing in a place: 'public-xhtml-head1'
:-)


Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: meta keywords displayed as description in google

Postby Jiff » Sun Jul 15, 2012 11:31 pm

Thanks once again Adminer!

I modified these lines to be:
Code: Select all
function xhtmlMetaData() {
    global $razorArray,$slabFlag;
    echo "<meta name='description' content='".$razorArray['meta'][$slabFlag]['metades']."' />";
    echo "\n    ";
    echo "<meta name='keywords' content='".$razorArray['meta'][$slabFlag]['metakey']."' />";
    echo "\n";
}

and it's working perfectly.
I hope it is this inline that perturbates google (otherwise, I'm out of options:(

Also thanks for the very well done files analyse:)
This is what gets me mad with php: unless you grep a lot in a lot of places, you never know where can be the function||variable you're looking for, calls aren't using a module prefix (like lua or erlang: module_name.function_name(parms)) and they are so chopped in so many pieces that it looks like a nightmare to be a php maintainer.

Regards
JY
Jiff
 
Posts: 15
Joined: Mon Jun 25, 2012 10:48 pm


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron