StaNov
StaNov

Reputation: 332

Use link to page from structure in Liferay ADT

I have created structure with field "Link to page".

Now I want to display the link in ADT applied to content aggregator. How do I obtain the URL of the linked page?

I tried this approach, but it returns only some encoded-hash-something from the webcontent.

<#assign
    docXml = saxReaderUtil.read(curEntry.getAssetRenderer().getArticle().getContent())
    page_link = docXml.valueOf("//dynamic-element[@name='page_link']/dynamic-content/text()")
>

<a href="${page_link}">link to page</a>

Upvotes: 0

Views: 2363

Answers (1)

Miroslav Ligas
Miroslav Ligas

Reputation: 1307

What kind of content you are working with? Web content or dynamic data lists?

If you have a web content structure with a link to page field and want to show it in a web content template use this to access the URL

<a href="${LinkToPage.getFriendlyUrl()}">...</a>

If you want to access DDM fields in ADT try this

<#assign fields = storageEngine.getFields(DDMStorageId) />
<#assign contentLink = ddmUtil.getDisplayFieldValue(themeDisplay, fields.get("LinkToPage").getValue(), "ddm-link-to-page") />

Upvotes: 1

Related Questions