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 can I get link to document in web content with resource importer?
Hi
I use resource importer to import pages/content together with theme (LR 7.1).
And I have web content, structure and template. Structure has image and text.
How can I tell web content to use image as document library document (uploaded also with resource importer)?
When I add image later and check web content, content is:
(with generated IDs inside for document)But I can't just hard-code IDs
If I define only document name in themes/my-theme/src/WEB-INF/src/resources-importer/journal/articles/home-banner/home-banner.xml, like:
Is it possible to specify link to document in web content with resource importer? (in my case from file [my-theme]/src/WEB-INF/src/resources-importer/journal/articles/home-banner/home-banner.xml to [my-theme]/src/WEB-INF/src/resources-importer/document_library/documents/home-banner-image.jpg )
Any help appreciated
Regards,
Vitaliy

I use resource importer to import pages/content together with theme (LR 7.1).
And I have web content, structure and template. Structure has image and text.
How can I tell web content to use image as document library document (uploaded also with resource importer)?
When I add image later and check web content, content is:
<root available-locales="en_US" default-locale="en_US">
<dynamic-element name="bannerImage" type="image" index-type="text" instance-id="jbml">
<dynamic-content language-id="en_US">
{
"classPK":"35922",
"groupId":"35902",
"name":"home-banner-image.jpg",
"alt":"",
"title":"home-banner-image.jpg",
"type":"document",
"uuid":"ba0b3c4c-c580-fbe0-5b27-d1e4aede36b4",
"fileEntryId":"35922",
"resourcePrimKey":"36045"
}</dynamic-content>
</dynamic-element>
<dynamic-element name="bannerText" type="text" index-type="keyword" instance-id="asun">
<dynamic-content language-id="en_US">Home Banner Text</dynamic-content>
</dynamic-element>
</root>
(with generated IDs inside for document)But I can't just hard-code IDs

If I define only document name in themes/my-theme/src/WEB-INF/src/resources-importer/journal/articles/home-banner/home-banner.xml, like:
<dynamic-content language-id="en_US"> "home-banner-image.jpg"</dynamic-content>
it also does not work.Is it possible to specify link to document in web content with resource importer? (in my case from file [my-theme]/src/WEB-INF/src/resources-importer/journal/articles/home-banner/home-banner.xml to [my-theme]/src/WEB-INF/src/resources-importer/document_library/documents/home-banner-image.jpg )
Any help appreciated

Regards,
Vitaliy
Update:
Finally, I have encountered this issue:
https://liferay.dev/forums/-/message_boards/message/111978556#_com_liferay_message_boards_web_portlet_MBPortlet_message_112044826
If I use link to document like:
web content is processed by resource importer, and $FILE is replaced with link for example:
<dynamic-content>
<![CDATA[/documents/39002/0/myfile.png/13db6d1d-e438-620a-4873-825b48fe9d4e?version=1.0&t=1562307406201]]>
</dynamic-content>
and web content is saved.
But when I try to open/edit this web content - it fails, because it expects JSON instead of link.
Any ideas?
Finally, I have encountered this issue:
https://liferay.dev/forums/-/message_boards/message/111978556#_com_liferay_message_boards_web_portlet_MBPortlet_message_112044826
If I use link to document like:
<dynamic-content>[$FILE=myfile.png$]</dynamic-content>
web content is processed by resource importer, and $FILE is replaced with link for example:
<dynamic-content>
<![CDATA[/documents/39002/0/myfile.png/13db6d1d-e438-620a-4873-825b48fe9d4e?version=1.0&t=1562307406201]]>
</dynamic-content>
and web content is saved.
But when I try to open/edit this web content - it fails, because it expects JSON instead of link.
Any ideas?
Hi Guys, Did anyone find solution for this issue?
Regards,Aravinth
Regards,Aravinth
As of now I achieved it through, I created both text box and document image type fields in structure and added condition in the template to manage based on the condition.
<#if Image.getData()?? && Image.getData() != "">
<#assign imgSrcVal = Image.getData()/>
<#else>
<#assign imgSrcVal = resourceImporterImage.getData()/>
<!--#if-->
<img src="${imgSrcVal}">
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™