Expand my Community achievements bar.

SOLVED

Access SHTML file from website - AEMaaCS

Avatar

Level 2

Hi,

 

Environment: AEMasCS

 

I have a requirement to access the SHTML file using my website domain. So, I uploaded the SHTML file into my DAM, activated to publish instance, and tried to access the shtml file using my website domain. Unfortunately, I am unable to execute the directives inside the shtml file and browser rendering only the static text on the browser. This I am trying in AEM as a Cloud service environment. Does anyone have leads to render the shtml file on the browser from the AEM DAM?

 

On file upload, jcr:mimeType is blank. In this case, file is downloaded instead of rendered.

When I update the jcr:mimeType to text/html explicitly then render the static content only(not executing the directives).

 

Here is my SHTML code:

<!-- filename: index.shtml -->

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Server-Parsed HTML Example</title>
</head>
<body>

<!--#echo var="DATE_LOCAL" -->
<h1>Welcome to My Website!</h1>

<!--#if expr="$DATE_LOCAL = /Monday/" -->
<p>Happy Monday!</p>
<!--#else -->
<p>Hope you're having a great day!</p>
<!--#endif -->

<p>This page was last modified on <!--#echo var="LAST_MODIFIED" -->.</p>

<p>Internal URL: <!--#include virtual="/content/experience-fragments/test/global/en/components/xf/master.html" --></p>
<p>External URL: <!--#exec cmd="curl https://www.google.com" --></p>

</body>
</html>

Output:

Welcome to My Website!

Happy Monday!
Hope you're having a great day

This page was last modified on 

Internal URL: 
External URL: 

 

Thanks,

Suresh

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @sureshsenapathi ,

 

sHTML files are basically SSI HTML, which means server-side execution of these scripts is necessary. But AEM does not support sHTML scripting as mentioned here: AEM Core Concepts | Adobe Experience Manager, which is why these tags are not working for you.

Even if you serve these files from DAM even then it won't work as these tags needs to be evaluated server side. Also, .shtml is not a supported file extension in AEM DAM: Supported file formats and MIME types | Adobe Experience Manager

AFAIK sHTMLs can be executed via Apache webserver itself. And in AEMaaCS setup we have Apache web server, where dispatcher module is configured. I haven't tried this myself but you can try adding the following configs in your webserver files: Apache httpd Tutorial: Introduction to Server Side Includes - Apache HTTP Server Version 2.4. This will enable SSI on some specific filetypes, in your case .shtml files. You can give it a try, let me know how it goes.

-Vikas Chaudhary

View solution in original post

2 Replies

Avatar

Correct answer by
Level 3

Hi @sureshsenapathi ,

 

sHTML files are basically SSI HTML, which means server-side execution of these scripts is necessary. But AEM does not support sHTML scripting as mentioned here: AEM Core Concepts | Adobe Experience Manager, which is why these tags are not working for you.

Even if you serve these files from DAM even then it won't work as these tags needs to be evaluated server side. Also, .shtml is not a supported file extension in AEM DAM: Supported file formats and MIME types | Adobe Experience Manager

AFAIK sHTMLs can be executed via Apache webserver itself. And in AEMaaCS setup we have Apache web server, where dispatcher module is configured. I haven't tried this myself but you can try adding the following configs in your webserver files: Apache httpd Tutorial: Introduction to Server Side Includes - Apache HTTP Server Version 2.4. This will enable SSI on some specific filetypes, in your case .shtml files. You can give it a try, let me know how it goes.

-Vikas Chaudhary

Hi Vikas,

Thank you for your response.

Yes, you are correct. shtml is not supported by AEM. I am trying to access it via the Apache server in AEMaaCS. i tried to upload the shtml file into AEM DAM and accessed using the dispatcher URL. it did not work. Upon further investigation, I found some issues with the original rendition storage. I am not sure how the rendition is created in DAM after uploading. I opened the original rendition(/content/dam/x.shtml/jcr:content/renditions/original) in crxde and just added space, saved, and activated. I can render the SSI tags after re-saved the original rendition. I don't know why this behavior. I found shtml working after resaving the original rendition. 

here are steps I performed,

1. uploaded a shtml file into DAM

2. open CRXDE and navigate to original rendition node of the asset

3. Open the Original rendition and just add space or enter after any line and save.

4. Activate the shtml file and access the shtml using the publish URL(AEMaaCS).

 

I can render the SSI. I am ma still investigating why the SSI tags are not executed upon uploading the asset into DAM.

Please let me know if you see this behavior and if you have any leads.

 

Please note, that I can render the SSI tags without any issues in the on-premise environment(AEM 6.5 + Apache). In this environment, I can render without doing any modifications to the file via CRXDE. shtml is accessible after i upload and activate to the publish.

 

Thanks,

Suresh