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
Remove version number from assets links in Liferay 7.2 GA1
Hi, there!
I'm using the Asset publisher portlet to display a list of assets inside some pages of my projects as in Display configurations of the portlet I set the option to "View in Context" these assets. However, I noticed that there is some number (probably a version number or something else) displayed as a query parameter in the asset full view URL. In the older liferay versions this number was not set, but in liferay 7.2-ga1 yes. Is there any possibility to remove this number from the assets URL?
Thanks in advance,
Eli
I'm using the Asset publisher portlet to display a list of assets inside some pages of my projects as in Display configurations of the portlet I set the option to "View in Context" these assets. However, I noticed that there is some number (probably a version number or something else) displayed as a query parameter in the asset full view URL. In the older liferay versions this number was not set, but in liferay 7.2-ga1 yes. Is there any possibility to remove this number from the assets URL?
Thanks in advance,
Eli
Hi,
Can you please share which part in the url your are referring.
Can you please share which part in the url your are referring.
Hi, Mohammed!
Yes, this is a version number added right after the asset friendly url. It looks like that: domainname.com/-/<asset_friendly_url>/<version_number>?redirect=%2F<render_page>
Yes, this is a version number added right after the asset friendly url. It looks like that: domainname.com/-/<asset_friendly_url>/<version_number>?redirect=%2F<render_page>
I think that is portlet instance id which you are referring as version number
No, I checked and this is the article version actually. It is a number like 1.2, 1.3...2.0 and increments each time I republish the article. By some strange reason this version in the URL causes me problems with the asset full preview. I get a syntax error in the template of type:
"Syntax error in template "companyId#companyGroupId#null" in line 4, column 67: Encountered ".", but was expecting:">""
which is actually some parser error. And more strange is that this error is gone once I remove the article version from the rendered url.
"Syntax error in template "companyId#companyGroupId#null" in line 4, column 67: Encountered ".", but was expecting:">""
which is actually some parser error. And more strange is that this error is gone once I remove the article version from the rendered url.
can you share your template code snippet may be i can try and fix the error
In the Asset publisher ADT I use the standard code to link the assets:
<#assign assetRenderer = curEntry.getAssetRenderer() />
<#assign curEntryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) />
<#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, assetRenderer, curEntry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) />
<h3 class="asset-title"><a href="${viewURL}">${entryTitle}</a></h3>
where stringUtil.equals(assetLinkBehavior, "showFullContent") == false
Then the full_view template code is a standard code that retrieves and show data from all the attributes of the journal article. And here, I should mention that the structure that I created for these assets is a little bit complex. By complex I mean that it has nested and repeatable attributes. I assume that the internal parser might have some difficulties with these attributes, but this is only an assumption.
<#assign assetRenderer = curEntry.getAssetRenderer() />
<#assign curEntryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) />
<#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, assetRenderer, curEntry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) />
<h3 class="asset-title"><a href="${viewURL}">${entryTitle}</a></h3>
where stringUtil.equals(assetLinkBehavior, "showFullContent") == false
Then the full_view template code is a standard code that retrieves and show data from all the attributes of the journal article. And here, I should mention that the structure that I created for these assets is a little bit complex. By complex I mean that it has nested and repeatable attributes. I assume that the internal parser might have some difficulties with these attributes, but this is only an assumption.
Hi, Mohammed!
I found a workarround to solve my problem. Finally, I used the following code for assets full-view links:
Thank you for trying to help me!
Greetings,
Eli
I found a workarround to solve my problem. Finally, I used the following code for assets full-view links:
<#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, curEntry) />
<#if assetLinkBehavior != "showFullContent">
<#assign viewURL = assetRenderer.getURLViewInContext(renderRequest, renderResponse, viewURL)?keep_before_last('/') + '?redirect=' + htmlUtil.escapeURL( themeDisplay.getURLCurrent() ) />
<!--#if-->
<h3 class="asset-title"><a href="${viewURL}">${entryTitle}</a></h3>
This is how I manage to remove the version number from the url and like that assets full view is rendered correctly.Thank you for trying to help me!
Greetings,
Eli
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™