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

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

eZ debug

Timing: Jan 18 2025 03:05:47
Script start
Timing: Jan 18 2025 03:05:47
Module start 'layout'
Timing: Jan 18 2025 03:05:47
Module start 'content'
Timing: Jan 18 2025 03:05:48
Module end 'content'
Timing: Jan 18 2025 03:05:48
Script end

Main resources:

Total runtime0.7250 sec
Peak memory usage4,096.0000 KB
Database Queries82

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0042 591.2266152.6406
Module start 'layout' 0.00420.0027 743.867239.4766
Module start 'content' 0.00690.7165 783.3438714.3516
Module end 'content' 0.72340.0015 1,497.695324.1250
Script end 0.7249  1,521.8203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.4035160.0002
Check MTime0.00130.1770160.0001
Mysql Total
Database connection0.00060.086110.0006
Mysqli_queries0.649089.5210820.0079
Looping result0.00070.0966800.0000
Template Total0.701496.820.3507
Template load0.00220.299520.0011
Template processing0.699396.453420.3496
Template load and register function0.00020.022410.0002
states
state_id_array0.00080.115910.0008
state_identifier_array0.00090.117620.0004
Override
Cache load0.00180.2501760.0000
Sytem overhead
Fetch class attribute can translate value0.00040.059140.0001
Fetch class attribute name0.00100.1386130.0001
XML
Image XML parsing0.00150.205140.0004
class_abstraction
Instantiating content class attribute0.00010.0077160.0000
General
dbfile0.00100.1380290.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 38
 Number of unique templates used: 9

Time used to render debug report: 0.0001 secs