掲示板

Page Meta Tages in Velocity!! Please Help

thumbnail
11年前 に Ahmad Heba Tul Baseet によって更新されました。

Page Meta Tages in Velocity!! Please Help

Junior Member 投稿: 71 参加年月日: 11/05/12 最新の投稿
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
11年前 に Bart Simpson によって更新されました。

RE: Page Meta Tages in Velocity!! Please Help

Liferay Master 投稿: 522 参加年月日: 11/08/29 最新の投稿
You have to get the layout (page) and then call method
com.liferay.portal.model.LayoutModel.getDescription(String languageId)
thumbnail
11年前 に Ahmad Heba Tul Baseet によって更新されました。

RE: Page Meta Tages in Velocity!! Please Help

Junior Member 投稿: 71 参加年月日: 11/05/12 最新の投稿
I need Keywords. Is there any getKeyword Method? I couuldn't find it. Thanks
thumbnail
11年前 に Harish Kumar によって更新されました。

RE: Page Meta Tages in Velocity!! Please Help

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
com.liferay.portal.model.LayoutModel.getKeywords()
thumbnail
11年前 に Gaurav Jain によって更新されました。

RE: Page Meta Tages in Velocity!! Please Help

Regular Member 投稿: 145 参加年月日: 11/01/31 最新の投稿
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
11年前 に Bart Simpson によって更新されました。

RE: Page Meta Tages in Velocity!! Please Help

Liferay Master 投稿: 522 参加年月日: 11/08/29 最新の投稿
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
11年前 に Ahmad Heba Tul Baseet によって更新されました。

RE: Page Meta Tages in Velocity!! Please Help

Junior Member 投稿: 71 参加年月日: 11/05/12 最新の投稿
Hi,

I solved it with the Javascript code....