<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Web content templates: Make Document Library URL relative</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=122624611" />
  <subtitle>Web content templates: Make Document Library URL relative</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=122624611</id>
  <updated>2026-04-04T02:31:04Z</updated>
  <dc:date>2026-04-04T02:31:04Z</dc:date>
  <entry>
    <title>RE: Web content templates: Make Document Library URL relative</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122663478" />
    <author>
      <name>Jamie Sammons</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122663478</id>
    <updated>2024-05-20T16:15:09Z</updated>
    <published>2024-05-20T16:15:08Z</published>
    <summary type="html">&lt;p&gt;Feature Request Created: https://liferay.atlassian.net/browse/LPD-26324&lt;/p&gt;</summary>
    <dc:creator>Jamie Sammons</dc:creator>
    <dc:date>2024-05-20T16:15:08Z</dc:date>
  </entry>
  <entry>
    <title>Web content templates: Make Document Library URL relative</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122624610" />
    <author>
      <name>Tobias Barth</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=122624610</id>
    <updated>2024-05-16T03:38:26Z</updated>
    <published>2024-05-13T08:03:35Z</published>
    <summary type="html">&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;our customer is using Liferay DXP 2023.q4.4 and has an ftl template,
  which renders an image using component.documentUpload.getData()&lt;/p&gt;
&lt;p&gt;They we found out that the &amp;quot;getData()&amp;quot; method is served by
  Java method com.liferay.portlet.documentlibrary.util.getPreviewURL&lt;/p&gt;
&lt;p&gt;The generated URL is absolute, that means it starts with https://domain.com/ &lt;/p&gt;
&lt;p&gt;The issue is now, that, if caching is enabled for the web content
  template, the URL will be cached with full domain name. Since the
  Liferay instance serves two domains - one for internal use within the
  customer's network, allowing access to the Liferay admin UI, and one
  for access from the public internet - wrong URL names are being
  delivered. This way, the html that is delivered to public users
  contains URLs that point into the internal network, and cannot be resolved.&lt;/p&gt;
&lt;p&gt;In order to fix this situation and keep caching enabled, I am asking
  you to:&lt;/p&gt;
&lt;p&gt;
  &lt;strong&gt;Please make it possible to easily retrieve relative URLs for
    document library assets from within .ftl templates&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;As an alternative (which is not preferred by the customer), I could
  imagine that adding the requested host name to the cache key would do
  the job.&lt;/p&gt;
&lt;p&gt;Best,&lt;/p&gt;
&lt;p&gt;Tobias&lt;/p&gt;</summary>
    <dc:creator>Tobias Barth</dc:creator>
    <dc:date>2024-05-13T08:03:35Z</dc:date>
  </entry>
</feed>
