How to get the Expiry Date of a Web Content item in an .FTLHow to get the Expiry Date of a Web Content item in an .FTLhttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1201305922024-03-28T09:37:03Z2024-03-28T09:37:03ZRE: How to get the Expiry Date of a Web Content item in an .FTLMashuk Choudhuryhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1201309942020-10-23T15:15:28Z2020-10-23T15:15:28ZThanks Mohammed, that works great <img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" >Mashuk Choudhury2020-10-23T15:15:28ZRE: How to get the Expiry Date of a Web Content item in an .FTLMohammed Yasinhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1201359762020-10-23T14:17:08Z2020-10-23T14:17:08Z<html><head></head><body>Hi,<br>You can access assetRenderer and check whether asset is displayable or not , below method will check whether article is expired or not. <pre><code>${entry.getAssetRenderer().isDisplayable()?then('Y', 'N')}</code></pre><br>Also you can fetch expiration date as below <br><pre><code>${entry.getAssetRenderer().getArticle().getExpirationDate()}
</code></pre><pre><code></code></pre></body></html>Mohammed Yasin2020-10-23T14:17:08ZHow to get the Expiry Date of a Web Content item in an .FTLMashuk Choudhuryhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1201305912020-10-29T17:59:33Z2020-10-23T12:02:39ZHi,<br />
I have expired a piece of web content, which now no longer appears on
the site. However Google has indexed the url and if you search for a
particular term, Google returns a result set that contains the page with
this webcontent. When you click on the link from Google, it does take
you to that expired piece of web content, which is not desirable.<br />
The page has been constructed using a display-page and having an asset
publisher portlet to render the web content. Because of this, it is not
checking for expired content and renders the content if you hit the url.<br />
My possible solution for fixing this is to check the expiry date of the
web content in the freemarker template and if the content has expired,
then redirect to a 404 page. My challenge now is getting the expiry
date. Using the AssetEntry object when I try to get the expirationDate
it returns a null even though the content has been expired.<br />
I printed out the AssetEntry object to the screen
${assetEntry.toString()} and I can see the expiration