Forums / Setup & design / EZ Publish 4.3 - Adding meta data on each page

EZ Publish 4.3 - Adding meta data on each page

Author Message

Anaya P

Wednesday 22 September 2010 7:58:21 am

Hi Guys,

I would like to have an option on each page to add meta data.

In past have used feZ Meta Data extension on EZ Publish 4.0.6, but it does not work with 4.3, I think, as there is no tab in the admin interface for meta data.

So does anyone know whether this extension works with 4.3 or not?

And if it is not compatible with 4.3, then is there any other extension exist which provides same functionality?

Regards

Anaya

Sebastiaan van der Vliet

Wednesday 22 September 2010 11:40:56 am

Hi,

What you could do: fetch the current node from your pagelayout.tpl, pass it on to the page head template. In the page head template, add the code below. It will make a meta description from your first xmlblock attribute, and add the keywords in your first ezkeywords field in the object/node that you are looking at.

{section name=meta loop=$site.meta}
        {switch match=$meta:key}
            {case match='description'}
                {if is_set($this_node)}
                    <meta name="description" content="{foreach $this_node.object.current.contentobject_attributes as $attribute}{if eq($attribute.data_type_string,"ezxmltext")}{$attribute.content.output.output_text|strip_tags|shorten(500)|simplify()|trim()|wash()}{if $attribute.content.output.output_text}{break}{/if}{/if}{/foreach}" />
                {else}
                    <meta name="{$meta:key|wash}" content="{$meta:item|wash}" />
                {/if}
            {/case}
    
            {case match='keywords'}
                {if is_set($this_node)}
                    <meta name="{$meta:key|wash}" content="{foreach $this_node.object.current.contentobject_attributes as $attribute}{if eq($attribute.data_type_string,"ezkeyword")}{$attribute.content.keyword_string|wash},{/if}{/foreach} {$meta:item|wash}" />
                {else}
                    <meta name="{$meta:key|wash}" content="{$meta:item|wash}" />
                {/if}
            {/case}
    
            {case}
                <meta name="{$meta:key|wash}" content="{$meta:item|wash}" />
            {/case}
        {/switch}
    {/section}

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

Gaetano Giunta

Wednesday 22 September 2010 1:26:16 pm

While the solution proposed by Sebastiaan is correct, it is a bit of a performance hog.

I always suggest to store that kind of meta-tag-information from the current object in the persistent variable (in full.tpl), and use the persistent variable in pagelayout.tpl to display it

Principal Consultant International Business
Member of the Community Project Board

Frédéric DAVID

Thursday 23 September 2010 12:51:46 am

Hi,

I developed feZ Meta Data. I didn't test it on eZ publish 4.3. I think you can find some bugs with admin2.

Just a question, why do you want a tab to feZ Meta Data, i dont't understand the goal of it.

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

Anaya P

Thursday 23 September 2010 2:48:20 am

thanks guys for your reply.

"

Hi,

I developed feZ Meta Data. I didn't test it on eZ publish 4.3. I think you can find some bugs with admin2.

Just a question, why do you want a tab to feZ Meta Data, i dont't understand the goal of it.

"

Regarding meta data tab - when implemented on 4.0.6, there is meta tab along with Location/Relations tabs. Also there is meta data section on the page.

But when tried to install on 4.3, there were neither the section nor the tab, so do not know how to and where to add meta data on each page. I think it is just my lack of knowledge. Sorry.

Regards

Anaya.

Frédéric DAVID

Sunday 26 September 2010 4:32:42 am

I update this morning feZ Meta Data.

I added the admin2 design to work on eZ publish 4.3

For the moment, just svn is updated. I will do an archive this evening or tomorrow.

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

Anaya P

Monday 04 October 2010 8:42:49 am

"

I update this morning feZ Meta Data.

I added the admin2 design to work on eZ publish 4.3

For the moment, just svn is updated. I will do an archive this evening or tomorrow.

"

Thanks for updating the extension.

I have downloaded svn and can see meta tab in the admin interface now.

But values put for keywords, description in the tab, do not appear on the page. Do I need to change something here?

Thanks for your help.

Regards

Anaya.

Frédéric DAVID

Tuesday 05 October 2010 6:02:26 am

On my test version, it work fine. I have a little bug on the design, but that's all.

Do you test with a limited account ? I try to see your bug...

Edit :

On a new version, i have somes permissions bugs. I try to fix it this evening.

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

Anaya P

Tuesday 05 October 2010 7:26:44 am

Thanks for your reply.

I have followed correct steps when installed and activated this extension. I can see the data entered in the table and in the admin also. Somehow it is not displayed in the page.

I have got custom design extension,which has page_head.tpl template.

In site.ini added meta data extension below my custom extension.

If I copy the custom meta data code from your extension page_head.tpl to my custom extension's page_head.tpl, it works fine.

And I have got full admin rights. I am not able to understand how your code checks whether meta data information is added in the meta data tab and overwrites it in the page template. Is it related to the extension order in site.ini?

Regards

Anaya

Frédéric DAVID

Tuesday 05 October 2010 8:16:02 am

"

And I have got full admin rights. I am not able to understand how your code checks whether meta data information is added in the meta data tab and overwrites it in the page template. Is it related to the extension order in site.ini?

"

Hi,

eZ publish loads a template ( in your case page_head.tpl ) with association of :

  • extension order in site.ini
  • design defined in site.ini ( SiteDesign > AdditionalSiteDesignList > StandardDesign )

Regards

Fred

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata