Forums / General / Adding Metadata per page

Adding Metadata per page

Author Message

Rinze Cats

Wednesday 31 March 2004 4:22:28 am

I can't figure out how to add metadata to my pages.

In the general pagelayout.tpl for my site I have stored my page global page layout. In the dynamic part of the page, I call {$module_result.content}

The content loads fine, but the metadata content should be loaded in the header, and not in the location where I call {$module_result.content}.

in other words: can I access the content of a article outside the view template of a class (more specific, in the general pagelayout.tpl or page_head.tpl).

I don't want to copy all of the code in my pagelayout.tpl to my class templates in order to achieve this! I like my code centralized!

Many thanx for any help / suggestions!
greetz
rinze

Paul Forsyth

Wednesday 31 March 2004 4:48:46 am

$module_result.content is just a string, so put it where you want.

But, i can't really see why you want to do this.

paul

Rinze Cats

Wednesday 31 March 2004 5:29:35 am

All my web pages need a custom header, for instance to give each page it's own keywords.

When someone creates a new page he/she should be able to add these keywords. In the template for this class, I can display these fields.

When I view the page, the call {$module_result.content} from pagelayout.tpl loads the class and class template. However, metadata tags need to be added at the top of the page. So at the top of my pagelayout.tpl I would have to call {$module_result.content} in order to load the class and an alternate class template (displaying only the meta data fields).

I really don't know if this is possible and/or how to do this.

I hope my problem or what I am trying to do is clear?

Paul Forsyth

Wednesday 31 March 2004 5:47:07 am

When you say the top of the page, do you mean between the html <head> tags, or just somewhere else?

If you want to show another view of your object you can use node_view_gui, or content_view_gui. I haven't tested this in a pagelayout, but it should work.

paul

Rinze Cats

Wednesday 31 March 2004 6:12:37 am

Hi paul,

yes I mean between my <head></head> tags.

I want to keep the content of a page, and the meta tag information in a single class.
Ideally I would take the class and a template to extract the meta information in the header of my pagelayout.tpl. in the dynamic content part I would take the class and a template to display the content fields of the class. This would work probably the same way when you want to display an article in full view, and display a summary of the same article on an index page, just by applying a different template.

The only thing is that it concerns the page header, so i'll have to do it by making two calls from the pagelayout.tpl (I figure).

if there is a completely different way to go about it, i'd love hear it! I am completely new to ez publish. I have experience with CMS systems however!

thanx rinze
btw: I shall try your suggestions!

Bruce Morrison

Wednesday 31 March 2004 4:15:01 pm

Hi Rinze

We are currently building a site with the same requirments. i.e. each page is required to have unique title description, keywords and copyright meta tags.

What we have done is add text line attributes to each content type for these (reusing the object title of course).

In the content object template (e.g full.tpl) you can have code like

{default content_object=$node.object
         content_version=$node.contentobject_version_object
}

{set-block name=Meta scope=global variable=title}
{$node.name}
{/set-block}

{set-block name=Meta scope=global variable=description}
{$content_version.data_map.metadescription.content}
{/set-block}

{set-block name=Meta scope=global variable=keywords}
{$content_version.data_map.metakeywords.content}
{/set-block}

{set-block name=Meta scope=global variable=copyright}
{$content_version.data_map.metacopyright.content}
{/set-block}

....
....

{/default}

and in pagelayout.tpl

<head>
...
<meta name="Title" content="{$Meta:title}" />

{section show=is_set($Meta:description)}
<meta name="Description" content="{Meta:description}" />
{/section}

{section show=is_set($Meta:copyright)}
<meta name="Rights" content="{$Meta:copyright}" />
{/section}

{section show=is_set($Meta:keywords)}
<meta name="Keywords" content="{$Meta:keywords}"/ >
{/section}

...
...
</head>

Unfortinually this does not work when the ViewCache is turned on. Luckily for us we are using eZ Publish to producce a static site and can generate that with caching off.

Hope this helps.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Paul Forsyth

Wednesday 31 March 2004 11:19:55 pm

Yip, thats a much better method.

You should be able to deal with viewcaching by simply looking at $module_result.node_id or $DesignKeys:used, and fetch the node. For example:

{let current_node=false()}
{section show=or(is_set($module_result.node_id), is_set($DesignKeys:used.node))}

   {section show=is_set($module_result.node_id)}
      {set current_node=fetch(content, node, hash(node_id, $module_result.node_id))}
   {section-else}
      {set current_node=fetch(content, node, hash(node_id, $DesignKeys:used.node))}
   {/section}

{section-else}

   {set current_node=$node}

{/section}

Now print your meta data

{/let}

paul

Rinze Cats

Thursday 01 April 2004 1:20:22 am

this appears to be exactly what I need!
i'll try to implement it and then I guess I owe you guys a beer ;-)

thank you!

Rinze Cats

Thursday 01 April 2004 4:21:37 am

implemented it with suc6!

thanx guys!

Jorge estévez

Tuesday 05 October 2004 9:25:55 pm

Hello,

I just cannot figure this out, I have tryed several times to add the code at the pagelayout.tpl and to the full.tpl (eg.article), disabled viewcache but I still have no results at all...

Can someone please explain in more details how to do it...

I just cannot have the same metatags on each page, it's just not a well practice to leave it like that!

Thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Monday 25 October 2004 9:50:43 pm

As posted before:

This does not work when the ViewCache is turned on. Luckily for us we are using eZ Publish to producce a static site and can generate that with caching off.

Is there a better implementation available with ViewCache turn ON ?

In site.ini we can change:

[SiteSettings]
# Name of the site, will be used in default templates in titles.
SiteName=eZ publish
# URL of site, often used to link to site in emails etc.
SiteURL=example.com
# List of metadata to set in pagelayout
MetaDataArray[author]=eZ systems
MetaDataArray[copyright]=eZ systems
MetaDataArray[description]=Content Management System
MetaDataArray[keywords]=cms, publish, e-commerce, content management, development framework

change it and put it in your settings/siteaccess/<site>/site.ini.append ;)

But this will not allow us to use different meta datas in each page, and this is very important so spiders can get the correct information from each page...

A better page generated by ez should contain keywords from the current node, and it's parents keywords as well, just as the page title is generated (backwards).

I hope someone has done some work on this, this is a topic that is of the most importance for pages on a site (that is my believe)

But with View cache turn off the pages will be fetched too slow.

Please comment..

Thanks!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Ekkehard Dörre

Tuesday 26 October 2004 1:44:26 am

... more Info perhaps in this tread:
http://ez.no/community/forum/developer/meta_description_tag

Greetings, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Trond Lyngbø

Friday 04 February 2005 8:00:40 am

On my webpage the metatags are not working as they are supposed to. I have filled out the nessecary info in the EZ Admin but some tekst tells me that there is som difference between this file and the ini settings. Is there some way to "reset" the meta tags and start over?

Certified:

-Cisco CCNP -Microsoft MCSE -Citrix CCA
-Master CIW Designer -Master CIW Administrator

Trond Lyngbø

Sunday 27 February 2005 11:56:24 am

I've edited the description tag manually (ini file) and by the EZ Admin, but it still is displaying <meta name="description" content="Hjem " /> at the index page. This is affecting the search engine ranking of that page. Any suggestions how to fix this? Every other meta tag info is correctly displayed, but not the description tag. Why? How do I fix this?

Trond :-)

Certified:
-Cisco CCNP -Microsoft MCSE -Citrix CCA
-Master CIW Designer -Master CIW Administrator

Website: www.MesterWeb.no

K259

Monday 12 June 2006 4:03:53 pm

Hi!

We also have this problem. All the meta tags are working without description. Can someone please tell me if this is a known problem..and how can I fix it?

Tnx.

Jens Tiedemann

Monday 08 October 2007 3:40:00 am

According to our marketing agency, meta data plays a vital role in search optimization (getting on top of google etc.). And in order to be effective, we need to specify metadata seperately for each page!

Is this the most recent information on this topic? Or has somebody come up with new/better ways of adding meta data for each page? Especially in connection with the newer ezwebin extension?

Best regards
Jens

André R.

Monday 08 October 2007 5:27:55 am

Sort off, I have a patch that are being reviewed for ezwebin right now.
It basically uses a hash variable on persistent_variable to set all sorts of aspects of pagelayout. How the variables are generated (from content, hardcoded or something else) is up to you!
Since it's using persistent_variable, it's also view cache safe.

Full example of passing settings from a node template:

{set scope=global persistent_variable=hash('show_path', false(),
                           'left_menu', false(),
                           'top_menu', 'my_special_top_menu',
                           'website_toolbar', false(),
                           'extra_menu', false(),
                           'site_title', 'My special title',
                           'author', 'Me, myself and I',
                           'copyright', '2008 (c) Company',
                           'description', 'My description text',
                           'keywords', 'text, text, text, and more text'
)}

But since the patch also moves all the init code in ezwebin to a template operator this is actually faster then without the patch..

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Tony Wood

Wednesday 10 October 2007 9:04:27 am

I think there are two types of meta data here.

The type that is needed to be friendly to search engines, although google gives low prominence to meta tag as they have been mis-used so much. There prefer the content itself and header tags etc etc.

The second type of meta data is to create categories of content of taxonomies within the site. Right now eZ has no method of storing this information. You can use selections but they are a poor long term method.

How have others added content categorization to site?

Tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

André R.

Wednesday 10 October 2007 9:20:55 am

Hi Tony!

Are you talking about predefined taxonomies (like selection) or user defined (like keyword/tags) ?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Tony Wood

Wednesday 10 October 2007 9:24:43 am

Keywords are great for Folksonomy or Controlled language. I am looking for categorisation for example on this site a category for a forum message might be "call for help", "technical question", "suggestion". I know that content can be seen to have contextual metadata because of it's parent etc, but I am looking to mark each page. This I feel should be a standard feature in a ECMS.

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future