Hi all,
I am building an API which will serve up some HTML for other websites to consume. The general idea is that there will be an experience fragment within AEM, and my API will grab the HTML output of this experience fragment and append that to the API response.
Is there a way within Java that I can programmatically calculate the rendered HTML output of an experience fragment? The fragment will be made up of multiple sightly based components.
Imagine an API response similar to this:
{
"cssLink": "mysite.com/path/to/some.css",
"jsLink": "mysite.com/path/to/some.js",
"html": "<div class='my-fragment'>...</div>"
}
Solved! Go to Solution.
Views
Replies
Total Likes
Please check this if help
use content selector to get HTML without head and other tags.
plain selector may not return the html but text
Hi @dylanmccurry ,
You may directly get the html content with .plain.html i.e, selector plain and extension html
You can use like
{
"cssLink": "mysite.com/path/to/some.css",
"jsLink": "mysite.com/path/to/some.js",
"html": "/experience-fragment-path.plain.html"
}
Thanks
Yeah... I am aware of this mechanism, but I am working on replacing another API which returns the raw html directly.
To minimize impact on dependent services, I am hoping to just recreate the exact signature of the API call.
Views
Replies
Total Likes
Please check this if help
use content selector to get HTML without head and other tags.
plain selector may not return the html but text