Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!
SOLVED

Including an html file from DAM within an html

Avatar

Level 1

Hi. Does Sightly provide any functionality for an html file placed in the DAM to be included in another html. I've tried data-sly-include but that didn't seem to work for html files placed in the DAM. 

 

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Level 10
6 Replies

Avatar

Level 9

Can you please elaborate on the requirement?

Thanks,

Kishore

Avatar

Level 10

What are you trying to do - nest HTML? 

Avatar

Level 1

I have an html file in my DAM with the following content in it : 

<p> Line 1 </p> <p> Line 2 </p>

 

I'd like to place this content within an html of one of my components. As I mentioned earlier, I've tried using data-sly-include in the component specifying the path of the file in the DAM but that didn't work out. 

PS. I was able to implement this using <div w3-include-html="path to DAM asset"> but was wondering if Sightly provides any way to do the same. 

Avatar

Level 10

To display HTML located in the dam into a Sighly component - try using syntax @  http://www.w3schools.com/howto/howto_html_include.asp. The reason why include does not work is because the HTML in the DAM does not have a resource type. Its an asset like a JPG - and can be referenced using an URL. 

Avatar

Level 10

What is the file type stored in the DAM ? 

I would recommend  to store HTML as a property of a node. Then read that property to be included. 

Avatar

Correct answer by
Level 10