Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save epgarcia/db2682b2a303f480be61a18c4dbef4bb to your computer and use it in GitHub Desktop.
Save epgarcia/db2682b2a303f480be61a18c4dbef4bb to your computer and use it in GitHub Desktop.
<#--
General concept: use ADT for list specific markup, and web content template for web content fields markup
Your Asset Publisher ADT:
-->
<#-- List your assets -->
<#if entries?has_content>
<#list entries as curEntry>
${curEntry.getTitle(locale)}
<#-- Make sure it's a web content -->
<#if curEntry.getClassName() == "com.liferay.journal.model.JournalArticle">
<#assign
assetRenderer = curEntry.getAssetRenderer()
journalArticle = assetRenderer.getAssetObject()
/>
<#--
Delegate your rendering to an existing web content template by using the Journal Article Taglib
The ddmTemplateKey is the templateKey displayed under the details section of your web content template (see below)
-->
<h1>Some list markup in my ADT</h1>
<@liferay_journal["journal-article"]
articleId=journalArticle.getArticleId()
ddmTemplateKey="34725"
groupId=journalArticle.getGroupId()
/>
</#if>
</#list>
</#if>
<#--
Your Web Content Template.
Assuming you have a Web Content Structure "X" with two text fields "text1" and "text2" and a document and media field "document1"
with an image
-->
<h2>This is my web content, rendered with a web content template</h2>
<p>${text1.getData()}</p>
<img src="${document1.getData()}" />
<p>${text2.getData()}</p>
<#--
Now setup the Asset Publisher to use the ADT. The web content fields will be displayed as defined in the web content template,
surrounded by the ADT's markup
-->
@rodrigoAbril
Copy link

Any way to have the Asset publisher view item link passed inside the webcontent template?

@nicolaebiz
Copy link

HI...please some help...i need to get a featured image from webcontent Liferay 7.4 GA 102 tu use in my custom Asset publisher ADT...also i didnt find the source of Abstracts asset publisher. Can u tell me pls where ai find?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment