留言板
How to add a meta tag in liferay generated page
petar banicevic,修改在15 年前。
How to add a meta tag in liferay generated page
Junior Member 帖子: 73 加入日期: 08-5-27 最近的帖子
I need to add few meta tags on some pages, particullary private pages:
<meta name="prevent_caching1" http-equiv="Pragma" content="no-cache" />
<meta name="prevent_caching2" http-equiv="Cache-Control" content="no-cache" />
<meta name="prevent_caching3" http-equiv="Expires" content="0" />
How to do this?
<meta name="prevent_caching1" http-equiv="Pragma" content="no-cache" />
<meta name="prevent_caching2" http-equiv="Cache-Control" content="no-cache" />
<meta name="prevent_caching3" http-equiv="Expires" content="0" />
How to do this?
Fuad Efendi,修改在15 年前。
Re: [Liferay Forums][2. Using Liferay] How to add a meta tag in liferay gen
Regular Member 帖子: 180 加入日期: 07-4-5 最近的帖子
You can manage additional META tags via Theme only, look at portal_normal.vm
You can have specific theme for private pages
I don't understand why you need to prevent caching such way...
Note however, HTML http-equiv will be ignored by Web Proxies which do
not parse HTML...
Liferay does not use HTTP Caching for portlet-type pages, it does not
reply with Last-Modified, ETag, Cache-Control, Expires HTTP headers
(except for JavaScript files etc.).
Quoting petar banicevic at Liferay's Community Forums <no-reply@liferay.com>:
> I need to add few meta tags on some pages, particullary private pages:
>
> <meta name="prevent_caching1" http-equiv="Pragma" content="no-cache"
> />
> <meta name="prevent_caching2" http-equiv="Cache-Control"
> content="no-cache" />
> <meta name="prevent_caching3" http-equiv="Expires" content="0" />
>
> How to do this?
> --
> Liferay Community Forum
> mb.312107.1071455@events.liferay.com
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1071455
You can have specific theme for private pages
I don't understand why you need to prevent caching such way...
Note however, HTML http-equiv will be ignored by Web Proxies which do
not parse HTML...
Liferay does not use HTTP Caching for portlet-type pages, it does not
reply with Last-Modified, ETag, Cache-Control, Expires HTTP headers
(except for JavaScript files etc.).
Quoting petar banicevic at Liferay's Community Forums <no-reply@liferay.com>:
> I need to add few meta tags on some pages, particullary private pages:
>
> <meta name="prevent_caching1" http-equiv="Pragma" content="no-cache"
> />
> <meta name="prevent_caching2" http-equiv="Cache-Control"
> content="no-cache" />
> <meta name="prevent_caching3" http-equiv="Expires" content="0" />
>
> How to do this?
> --
> Liferay Community Forum
> mb.312107.1071455@events.liferay.com
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1071455
petar banicevic,修改在15 年前。
RE: Re: [Liferay Forums][2. Using Liferay] How to add a meta tag in liferay
Junior Member 帖子: 73 加入日期: 08-5-27 最近的帖子
Why I need this ?
Because user logs off. then I paste private url to IE and IE reads that from cache. As soon as I click on a portlet liferay goes back to login page.
What bothers me is that private page should not be read from cache at all. I had this problem in asp.net and these tags did the job.
Not really problem of liferay but of IE.
I will take a look if I can programatically modify existing theme or push them thru some httpresponse or something (which can be difficult as I use JSF and backing beans), but let's see...
Thanks a lot fro your reply.
Petar.
PS: Correction tags should be:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
Because user logs off. then I paste private url to IE and IE reads that from cache. As soon as I click on a portlet liferay goes back to login page.
What bothers me is that private page should not be read from cache at all. I had this problem in asp.net and these tags did the job.
Not really problem of liferay but of IE.
I will take a look if I can programatically modify existing theme or push them thru some httpresponse or something (which can be difficult as I use JSF and backing beans), but let's see...
Thanks a lot fro your reply.
Petar.
PS: Correction tags should be:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
Hi Petar,
As a workaround, you can include robots meta tags every time you create a page.
HTH,
Mariano.
As a workaround, you can include robots meta tags every time you create a page.
HTH,
Mariano.
petar banicevic,修改在15 年前。
RE: How to add a meta tag in liferay
Junior Member 帖子: 73 加入日期: 08-5-27 最近的帖子
Mariano,
Give me a word more on this. Function name... I can't follow you ...
Give me a word more on this. Function name... I can't follow you ...
Mariano Cifre,修改在15 年前。
RE: How to add a meta tag in liferay
Junior Member 帖子: 86 加入日期: 08-5-27 最近的帖子
Hi Petar,
Damn! I was wrong!
I thought that you were talking about robots meta data tags...
Just in case it works for you, I'll give you the steps that I wrote until I saw that the result was different
Log in as an administrator.
Add the Communities Portlet.
Search for the community.
Click Actions->Manage Pages.
Click "Private Pages"
Click on the tree that you see on the right side, one of the pages that you have already created. EG: "Members Area"
On the right side, click on "Page"
At the very bottom, you will see "Meta Tags:". Click "[Show]"
There you can add your robots metadata. EG: noindex, nofollow
Go to the page: http://yoursite.com/membersarea
View source and you should see:
<meta name="robots" content="noindex, nofollow" />
The other solution is changing the theme, as Fuad said before, but I don't know if there is a way to know whether it is a private or a public page using velocity... Otherwise you may have 2 themes...
HTH,
Mariano.
Damn! I was wrong!
I thought that you were talking about robots meta data tags...
Just in case it works for you, I'll give you the steps that I wrote until I saw that the result was different
Log in as an administrator.
Add the Communities Portlet.
Search for the community.
Click Actions->Manage Pages.
Click "Private Pages"
Click on the tree that you see on the right side, one of the pages that you have already created. EG: "Members Area"
On the right side, click on "Page"
At the very bottom, you will see "Meta Tags:". Click "[Show]"
There you can add your robots metadata. EG: noindex, nofollow
Go to the page: http://yoursite.com/membersarea
View source and you should see:
<meta name="robots" content="noindex, nofollow" />
The other solution is changing the theme, as Fuad said before, but I don't know if there is a way to know whether it is a private or a public page using velocity... Otherwise you may have 2 themes...
HTH,
Mariano.
rajendra dasari,修改在10 年前。
RE: Re: [Liferay Forums][2. Using Liferay] How to add a meta tag in liferay
New Member 发布: 1 加入日期: 13-7-29 最近的帖子
Hi Fuad,
As you mentioned "Liferay does not use HTTP Caching for portlet-type pages, it does not
reply with Last-Modified, ETag, Cache-Control, Expires HTTP headers "
Now I am facing same problem in my website.
Added the below META tags in to theme portal_normal.vm file header section, but in the cookie files is showing Expires time as feature year with same time.
But it should display with current year and time.
Please help me what is the alternative way to work this in liferay .
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma-directive" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Directive" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
OR
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<meta http-equiv="CACHE-CONTROL" content="NO-STORE, NO-CACHE, MUST-REVALIDATE, POST-CHECK=0, PRE-CHECK=0" />
<meta http-equiv="EXPIRES" content="01 Jan 1970 00:00:00 GMT" />
<meta http-equiv="Last-Modified" content="01 Jan 1970 00:00:00 GMT" />
<meta http-equiv="If-Modified-Since" content="01 Jan 1970 00:00:00 GMT" />
Thanks in advance
As you mentioned "Liferay does not use HTTP Caching for portlet-type pages, it does not
reply with Last-Modified, ETag, Cache-Control, Expires HTTP headers "
Now I am facing same problem in my website.
Added the below META tags in to theme portal_normal.vm file header section, but in the cookie files is showing Expires time as feature year with same time.
But it should display with current year and time.
Please help me what is the alternative way to work this in liferay .
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma-directive" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Directive" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
OR
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<meta http-equiv="CACHE-CONTROL" content="NO-STORE, NO-CACHE, MUST-REVALIDATE, POST-CHECK=0, PRE-CHECK=0" />
<meta http-equiv="EXPIRES" content="01 Jan 1970 00:00:00 GMT" />
<meta http-equiv="Last-Modified" content="01 Jan 1970 00:00:00 GMT" />
<meta http-equiv="If-Modified-Since" content="01 Jan 1970 00:00:00 GMT" />
Thanks in advance