Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ahmad Heba Tul Baseet
Page Meta Tages in Velocity!! Please Help
October 30, 2012 2:29 AM
Answer

Ahmad Heba Tul Baseet

Rank: Junior Member

Posts: 68

Join Date: May 12, 2011

Recent Posts

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
Bart Simpson
RE: Page Meta Tages in Velocity!! Please Help
October 30, 2012 2:40 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

You have to get the layout (page) and then call method
1com.liferay.portal.model.LayoutModel.getDescription(String languageId)
Ahmad Heba Tul Baseet
RE: Page Meta Tages in Velocity!! Please Help
October 30, 2012 3:26 AM
Answer

Ahmad Heba Tul Baseet

Rank: Junior Member

Posts: 68

Join Date: May 12, 2011

Recent Posts

I need Keywords. Is there any getKeyword Method? I couuldn't find it. Thanks
Harish Kumar
RE: Page Meta Tages in Velocity!! Please Help
October 30, 2012 3:43 AM
Answer

Harish Kumar

Rank: Expert

Posts: 347

Join Date: July 31, 2010

Recent Posts

1com.liferay.portal.model.LayoutModel.getKeywords()
Bart Simpson
RE: Page Meta Tages in Velocity!! Please Help
October 30, 2012 9:21 PM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

Bart Simpson:
You have to get the layout (page) and then call method
1com.liferay.portal.model.LayoutModel.getDescription(String languageId)

Oops sorry for the wrong method, the correct one is
1com.liferay.portal.model.LayoutModel.getKeywords()
Gaurav Jain
RE: Page Meta Tages in Velocity!! Please Help
October 30, 2012 11:18 PM
Answer

Gaurav Jain

Rank: Regular Member

Posts: 143

Join Date: January 31, 2011

Recent Posts

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)
Ahmad Heba Tul Baseet
RE: Page Meta Tages in Velocity!! Please Help
November 7, 2012 7:02 AM
Answer

Ahmad Heba Tul Baseet

Rank: Junior Member

Posts: 68

Join Date: May 12, 2011

Recent Posts

Hi,

I solved it with the Javascript code....