Search code examples
liferayfacebook-opengraphmetaspring-portlet-mvc

Change OG metatags from Liferay portlet


I want to change OG metatags based on request params. I use Liferay 6.0.6 and Spring Portlet MVC 3.1.2.

If user comes to URL example.com?param=value1, I want to set:

<meta property="og:image" content="/image1.png">

If user comes to example.com?param=value2, I want to set:

<meta property="og:image" content="/image2.png">

Liferay can set title, subtitle, description and keywords through PortalUtil. Can I set these OG metatags somehow similar?


Solution

  • Try to have a look at <liferay-util:html-top>. It's discussed e.g. here http://www.liferay.com/web/samuel.kong/blog/-/blogs/adding-a-javascript-to-every-page