Foros de discusión

Page Meta Tages in Velocity!! Please Help

thumbnail
Ahmad Heba Tul Baseet, modificado hace 11 años.

Page Meta Tages in Velocity!! Please Help

Junior Member Mensajes: 71 Fecha de incorporación: 12/05/11 Mensajes recientes
Hi all,
I wrote a portlet and in that Protlet, I wrote some meta Keywords with the help of PortalUtil.setPageKeywords(keyword, null);

Now I want to use this in my velocity theme. I cant do that. I tried every thing, but in vain. Can please somebody tell me, how I can use page Meta Keywords in velocity template. Is there any possibility. Thanks in advance
thumbnail
Bart Simpson, modificado hace 11 años.

RE: Page Meta Tages in Velocity!! Please Help

Liferay Master Mensajes: 522 Fecha de incorporación: 29/08/11 Mensajes recientes
You have to get the layout (page) and then call method
com.liferay.portal.model.LayoutModel.getDescription(String languageId)
thumbnail
Ahmad Heba Tul Baseet, modificado hace 11 años.

RE: Page Meta Tages in Velocity!! Please Help

Junior Member Mensajes: 71 Fecha de incorporación: 12/05/11 Mensajes recientes
I need Keywords. Is there any getKeyword Method? I couuldn't find it. Thanks
thumbnail
Harish Kumar, modificado hace 11 años.

RE: Page Meta Tages in Velocity!! Please Help

Expert Mensajes: 483 Fecha de incorporación: 31/07/10 Mensajes recientes
com.liferay.portal.model.LayoutModel.getKeywords()
thumbnail
Gaurav Jain, modificado hace 11 años.

RE: Page Meta Tages in Velocity!! Please Help

Regular Member Mensajes: 145 Fecha de incorporación: 31/01/11 Mensajes recientes
Ahmad Heba Tul Baseet:
I need Keywords. Is there any getKeyword Method? I couuldn't find it. Thanks


Hi Ahmad,
if you are setting page keywords using PortalUtil.setPageKeywords(keyword, request);
then you won't be able to access it using LayoutModel.getKeywords() as this one gets keywords of current page; while PortalUtil method just set the keywords in the request.

To access those keywords you may use in your theme velocity :
$request.getAttribute("LIFERAY_SHARED_PAGE_KEYWORDS")
where "LIFERAY_SHARED_PAGE_KEYWORDS" is actually constant in WebKeys as WebKeys.PAGE_KEYWORDS.

You may further check implementation of setPageKeywords method of PortalUtil in com.liferay.portal.util.PortalImpl.addPageKeywords(String keywords, HttpServletRequest request)
thumbnail
Bart Simpson, modificado hace 11 años.

RE: Page Meta Tages in Velocity!! Please Help

Liferay Master Mensajes: 522 Fecha de incorporación: 29/08/11 Mensajes recientes
Bart Simpson:
You have to get the layout (page) and then call method
com.liferay.portal.model.LayoutModel.getDescription(String languageId)

Oops sorry for the wrong method, the correct one is
com.liferay.portal.model.LayoutModel.getKeywords()
thumbnail
Ahmad Heba Tul Baseet, modificado hace 11 años.

RE: Page Meta Tages in Velocity!! Please Help

Junior Member Mensajes: 71 Fecha de incorporación: 12/05/11 Mensajes recientes
Hi,

I solved it with the Javascript code....