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
RE: Get list of web content templates
Hello!
How to get the names of all web content templates that are used on the web page?
How to get the names of all web content templates that are used on the web page?
Nikita Laitinen:
How to get the names of all web content templates that are used on the web page?
I guess you mean programmatically?
You'll have to know what you're looking for: E.g. you can analyze the page and check which Web Content Display portlet is on there, retrieve its configuration, check for the article's configured template. You'd need to do that with any other way an article can appear on a page, e.g. through analyzing what AssetPublisher shows (which might be different for any visitor when filtering with user properties). Also, the method will likely differ between Widget- and Content-Pages.
You can start with this ugly but informative portlet: https://github.com/olafk/layout-info-web
Yes, you're right, I mean programmatically.
I will check that portlet.
Thanks for the info!
I will check that portlet.
Thanks for the info!
Would be easier with jQuery if each widget title said the template/structure name instead of <span class="portlet-name-text">Web Content Display</span>. You could then for each <section> in jQuery and abstract the name of the templates on the page. All you'd get now is repeated "Web Content Display" as names. Also you could group them, say there were 3 Card Smalls on the page like "Card Small (3)" and of course this could be put into a sidebar or information panel.
It seemed to be done for content pages you can get a tree structure of what's on the page, but hasn't been done for widget pages which is a missed opportunity.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™