How to get information on whether a content asset is online or not in isml file?

396 Views Asked by At

I try to get content asset is online or not. I know that when we change online attribute to no from sandbox we won't see asset but currently asset is inside a modal, so that modal shows up with no content. That's why I try to check whether asset is online or not.

<div class="base_modal ${isOnline ? '' : 'd-none'}">
    <iscontentasset aid="my_asset" />
</div>

I tried to call isOnline() function in isml but it is not worked.

1

There are 1 best solutions below

0
On BEST ANSWER

Try this.

<isset name="myAsset" value="${require("dw/content/ContentMgr").getContent("my_asset")}" scope="page" />
<isif condition="${myAsset && myAsset.online}">
    <iscontentasset aid="${myAsset.ID}" />
</isif>

You can also try replacing "iscontentasset" with "isprint"

<isprint value="${myAsset.custom && myAsset.custom.body && myAsset.custom.body.markup}" encoding="off"/>