MetaDataArray description won't take hold

Author Message

James Packham

Friday 23 April 2004 9:03:31 am

Hi,

I'm trying to setup my meta tags to be automatically generated from the site.ini files and so far all of them work except for description. For some reason I get:

<meta name="description" content="Home " />

When in the site.ini.append I've put:

MetaDataArray[description]=This site is the one-stop......

I've no idea where the word Home came from, it doesn't appear anywhere is the file. At first I thought it might be an override issue, so I checked in settings/override/site.ini.append.php, but there's nothing in there to do with the MetaDataArray.

Has anyone got any thoughts?

Regards,

James

Rinze Cats

Wednesday 30 June 2004 3:15:57 am

did you ever solve this problem? I am experiencing the exact same problem
rinze

Paul Forsyth

Wednesday 30 June 2004 3:49:35 am

Its coded in index.php:

    $metaDescription = "";
    if ( isset( $moduleResult['path'] ) and
         is_array( $moduleResult['path'] ) )
    {
        foreach ( $moduleResult['path'] as $pathPart )
        {
            if ( isset( $pathPart['text'] ) )
                $metaDescription .= $pathPart['text'] . " ";
        }
    }
    $meta['description'] = $metaDescription;

Basically description holds path information. If you want your description to come through you will need to comment out this code.

A better way would be to test for the presence of a description element in the meta array and use it instead if it exists.

paul

--
http://www.visionwt.com

Rinze Cats

Wednesday 30 June 2004 7:36:50 am

I think this is a design error in ezpublish? Why make every metatag customizable, except the description? When looking in the default site.ini, it even assigns a value to metadaraarray[description] without ever using it by design. I find this strange.

Do you know which php file contains the code that reads the meta information from the site.ini file? I think the function used should be altered to use the description value when present.

A note on the side: many thanx for all your contributions in the forum paul, they have proved very usefull to me!

Paul Forsyth

Wednesday 30 June 2004 8:23:12 am

I should have entered the whole code fragment for meta tags. Here it is from index.php:

    $meta = $ini->variable( 'SiteSettings', 'MetaDataArray' );

    $metaDescription = "";
    if ( isset( $moduleResult['path'] ) and
         is_array( $moduleResult['path'] ) )
    {
        foreach ( $moduleResult['path'] as $pathPart )
        {
            if ( isset( $pathPart['text'] ) )
                $metaDescription .= $pathPart['text'] . " ";
        }
    }
    $meta['description'] = $metaDescription;

As you can see the $meta variable is populated from the site.ini MetaDataArray array. The easiest way to fix this is to change the line:

    $meta['description'] = $metaDescription;

to:

    $meta['path_description'] = $metaDescription;

This should stop the default description from being overriden. I notice that description works on the ez web site and some our older visionwt sites. But new sites are affected. Digging through the index.php revisions the change occured some 17 months ago:

http://pubsvn.ez.no/websvn/diff.php?repname=nextgen&path=/trunk/index.php&rev=1461&sc=1

which should have impacted us some time ago...

Hope this helps!

paul

--
http://www.visionwt.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.