Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to add meta property dynamically from freemarker template
Hello, I want to add to the head of some pages the meta og:image. I added this code to my template:
Looking at the documentation I founded this:The Liferay-Util taglib is also available via a macro for your FreeMarker theme templates and web content templates. Follow this syntax:
Thanks
<liferay-util:html-top outputkey="htmltop">
<meta property="og:image" content="${imagen_destacados.getData()}">
</liferay-util:html-top>
but it doesn´t work.Does anyone have any idee of the reason why it doesn't work for me?Looking at the documentation I founded this:The Liferay-Util taglib is also available via a macro for your FreeMarker theme templates and web content templates. Follow this syntax:
Is this what i need to put in my template? I tried to put it in my template but it doen't work..<@liferay_util["tag-name"] attribute="string value" attribute=10 />
Thanks
I managed to do it with <@liferay_util ["html-top"] /> but it works only when browsing between pages. If I access the page directly, I cannot add to the head what I need.
I use Liferay 7.2 that being a SPA application may have to do with this matter
Anyone have any ideas?
I use Liferay 7.2 that being a SPA application may have to do with this matter
Anyone have any ideas?
I finally got it to work correctly with:<@liferay_util["html-top"]>
<meta name="image" property="og:image" content="srcImage">
</@>
<meta name="image" property="og:image" content="srcImage">
</@>
Cool, I found myself with the same problem and your answer helped.
It's not working for me, someone has other solution?
The current version of Liferay includes Open Graph Tags in the layouts. In the layout setup, look for the Open Graph area five nights at freddy's
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™