Hi everyone,
I am exploring Edge Delivery Service (EDS) with document-based authoring and wanted to check if Experience Fragments (XFs) are supported in this approach. Specifically:
Solved! Go to Solution.
Hi @SurabhiAc3
EDS does support loading content from another page but it all client side, Please check fragment block
https://github.com/adobe/aem-block-collection/tree/main/blocks/fragment
Hi @SurabhiAc3
EDS does support loading content from another page but it all client side, Please check fragment block
https://github.com/adobe/aem-block-collection/tree/main/blocks/fragment
@SurabhiAc3 yes you should be able to load external html file into EDS.. you can create your own custom block and write JS to include html from external paths.
Please refer to below code from adobe docs on how they included header and footer.
import { getMetadata } from '../../scripts/aem.js';
import { loadFragment } from '../fragment/fragment.js';
...
export default async function decorate(block) {
// load nav as fragment
// Get the path to the AEM page fragment that defines the header content from the <meta name="nav"> tag. This is set via the site's Metadata file.
const navMeta = getMetadata('nav');
// If the navMeta is not defined, use the default path `/nav`.
const navPath = navMeta ? new URL(navMeta, window.location).pathname : '/nav';
// Make an XHR (AJAX) call to request the AEM page fragment and serialize it to a HTML DOM tree.
const fragment = await loadFragment(navPath);
// Add the content from the fragment HTML to the block and decorate it as needed
...
}
@SurabhiAc3 Did you find the suggestions helpful? If you need more information, please let us know. If a response resolved your issue, kindly mark it as correct to help others in the future. Alternatively, if you discovered a solution on your own, we'd appreciate it if you could share it with the community. Thank you !
Views
Replies
Total Likes
Views
Likes
Replies