Forum Discussion

miikka's avatar
miikka
Maven
10 years ago

Using html asset in custom component

I have a file with a bit of HTML stored as .html file in the Asset library.

 

But when trying to use that in a custom component

<#include asset.get("/html/assets/header_en_non-auth.html")>

in the preview it says

 

The ""http://xx.yy.com/html/assets/header_en_auth.html?FAC271340083837713A9A30F4B680D51"" widget cannot be found.

 

From the Asset library I can open the file and see it correctly and I can also see it using the full URL from the error message.

2 Replies

  • Hi miikka,

     

    I think you have to use ifrmae for adding .html file to custom component.

    example:

    File name: 1.html

    <html>
    	<body>
    		<h1>Header file</h1>
    	<body>
    </html>

    File name: 2.html

    <html>
    	<body>
    		<iframe src="1.html"></iframe>
    		<h2>header2 file</h2>
    	<body>
    </html>

    Regards,

    Mahesh Revanwar

     

    If my post is helpful and answers your question, please give "Kudos" and "Accept it as a Solution."

     

     

  • miikka's avatar
    miikka
    Maven
    10 years ago

    Hi Mahesh,

    and thanks for your response. The suggestion of using an iframe could work in certain scenarios but unfortunately it does not work for me. The HTML piece I'm trying to include in a component has a few dynamic elements (like user name) which can be parsed when included (according to FreeMarker syntax). And the template we have does not really allow iframes to be used. So I need to figure out some other way then.

     

    Cheers,

    Miikka