You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Marco Pöhler <MP...@eprofessional.de> on 2003/09/02 10:27:35 UTC

setting the webpage title from a portlet

Hi,

I just started with Jetspeed - thanks for the tutorials, it was quite easy
and fast to develop my first portlets. Now I've written a Velocity based
portlet which works fine, but I can't figure out how to set the title of the
webpage containing the portlet. My Portlet shows products and if a single
product is shown, the name of the product should be in the webpage title,
too. This is important to get a better ranking in the search engines.

The webpage title seems to be a merge of the
JetspeedRessources.properties/portalpage.title_prefix and the title set in
the psml. Does you know where this merge is done ? Is it possible to set the
webpage title regular from a portlet ?

Thanks in advance

Marco

P.S.: I'm using jetspeed1.4-b4

AW: setting the webpage title from a portlet

Posted by Marco Pöhler <ma...@poehlerpoehler.de>.
Hi David,

> In order to do change the title programmatically, you will need to
> write your own Turbine Layout module, and put your dynamic info in the
> context, then access it in your template like above

thanks for the hint ! That work's great ! Here is what I've done, if anyone
is interested:

- I copied org.apache.turbine.modules.layouts.VelocityDirectLayout to
my.package.layouts.MyOwnLayout class

- I put what I needed in the context

- added module.packages=my.package to TurbineRessources.properties (without
the layouts part !!!)

- Also in TurbineRessources.properties I changed the default Layout to my
custom Layout services.VelocityService.default.layout = MyOwnLayout

- In templates/vm/layouts/html/default.vm I used the context content to
populate the title

that's it.

Thanks again!

Marco




Re: AW: setting the webpage title from a portlet

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Wednesday, September 3, 2003, at 02:01  AM, Marco Pöhler wrote:

> Hi David,
>
>> http://jakarta.apache.org/jetspeed/api/org/apache/jetspeed/portal/
>> Portlet.html#setTitle(java.lang.String)
>
> This sets the title of the portlet, isn't it ? I wish to set the title 
> of
> the webpage, this means something like this:
>
Oops, you can't find good help these days :-)

You can't set the title from a portlet, its too late.
However it is possible.

also see

In the JR.p, see:

portalpage.title_prefex=

that sets the prefix in 
webapp/WEB-INF/templates/vm/layouts/html/default.vm

  #set ($titlePrefix = $config.getString("portalpage.title_prefix"))
     <title>#if ($titlePrefix)$titlePrefix 
#end$!{data.profile.document.portlets.getMetaInfo().title}</title>

So as you can see the title is set as a combination of the title prefix 
from the JR.p, and the title from PSML file (of the outermost portlets 
collection in the PSML file)

In order to do change the title programmatically, you will need to 
write your own Turbine Layout module, and put your dynamic info in the 
context, then access it in your template like above

--
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
+01 707 773-4646
+01 707 529 9194


AW: setting the webpage title from a portlet

Posted by Marco Pöhler <ma...@poehlerpoehler.de>.
Hi David,

> http://jakarta.apache.org/jetspeed/api/org/apache/jetspeed/portal/
> Portlet.html#setTitle(java.lang.String)

This sets the title of the portlet, isn't it ? I wish to set the title of
the webpage, this means something like this:

<html>
<head>
<title>CONTENTS SET BY A PORTLET</title>
</head>
<body>
...
</body>
</html>

I need the name of a product in the webpage title. The title of the portlet
is not important to me.

Do you have any idea to do this from a portlet ? Any hint where I can make a
hack ?


kind regards

Marco


Re: setting the webpage title from a portlet

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Tuesday, September 2, 2003, at 01:27  AM, Marco Pöhler wrote:

> Hi,
>
> I just started with Jetspeed - thanks for the tutorials, it was quite  
> easy
> and fast to develop my first portlets. Now I've written a Velocity  
> based
> portlet which works fine, but I can't figure out how to set the title  
> of the
> webpage containing the portlet. My Portlet shows products and if a  
> single
> product is shown, the name of the product should be in the webpage  
> title,
> too. This is important to get a better ranking in the search engines.
>
> The webpage title seems to be a merge of the
> JetspeedRessources.properties/portalpage.title_prefix and the title  
> set in
> the psml. Does you know where this merge is done ? Is it possible to  
> set the
> webpage title regular from a portlet ?
>

http://jakarta.apache.org/jetspeed/api/org/apache/jetspeed/portal/ 
Portlet.html#setTitle(java.lang.String)

--
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
+01 707 773-4646
+01 707 529 9194