Edge Delivery Services how-tos · updated

What is auto blocking in AEM Edge Delivery Services, and how do you use it?

Auto blocking creates blocks in code from ordinary content or page metadata, so authors don't have to insert a block table themselves. It runs early in page decoration, in buildAutoBlocks() in your project's scripts.js, and builds the same DOM a block would have if the author had created it.

Why it exists

Tables make documents harder to read and edit, so aem.live recommends leaving as much as possible as default content (headings, text, images, links). Auto blocking keeps that authoring simplicity while letting developers keep layout and behaviour in a block.

Typical uses

  • An article header built from the h1, the first image and author and date metadata, for pages whose template metadata says 'article'.
  • An embed block wrapped around a YouTube link an author pasted on its own line.
  • Links to fragments, modals or forms turned into the matching block.

Auto blocking is often driven by the template metadata property: if every page with template 'blog-post' needs the same header, add it in code rather than asking every author to insert it.

What to watch

Because auto blocking runs before blocks load, keep it cheap: a few DOM queries, no network requests. If the auto block contains the hero image, remember it affects which element becomes the LCP candidate.

Illustrative buildAutoBlocks() adding an embed block around YouTube links

function buildAutoBlocks(main) {
  main.querySelectorAll('a[href*="youtube.com"]').forEach((a) => {
    if (a.closest('.block')) return;
    const block = buildBlock('embed', [[a.cloneNode(true)]]);
    a.closest('p')?.replaceWith(block);
  });
}

How to do it

  1. List content patterns authors already write naturally (a lone video link, an article h1 + image).
  2. Decide which block each pattern should become.
  3. Add the logic to buildAutoBlocks() in scripts.js, using the boilerplate's block-building helper.
  4. Gate template-wide auto blocks on the template metadata value.
  5. Preview pages and confirm the generated block matches what an authored block produces.

Related pages on this site

Questions

Where does auto blocking code live?

In buildAutoBlocks() in your project's scripts.js, according to aem.live.

Does auto blocking slow the page?

It runs in the eager phase before LCP, so keep it to simple DOM work with no network calls.

Can authors still add the block manually?

Yes. Make sure your auto-blocking code skips content that is already inside a block.

Sources

Facts about Adobe's platform are from the linked Adobe pages, checked 10 Nov 2026. Explanations and examples are ours unless marked as Adobe's.

Scan, Convert, Verify, Install

How Surge Migrate helps with a move to Edge Delivery Services

Surge Migrate moves a website from any CMS to any CMS, and Edge Delivery Services is one of the systems it writes. Pages are converted automatically, and you check the result before you install anything.

  1. 1

    Scan

    Names the system behind your site, counts pages and templates, lists the blocks to build and the work no tool does, and gives an effort range with its working.

    Scan a site →
  2. 2

    Convert

    Each page becomes an Edge Delivery document, an AEM Core Component page and import files for 7 other systems. 10 pages free; 500 or 2,000 pages in one paid run.

    Convert your pages →
  3. 3

    Verify

    A download is offered only when its own format check passes. The report lists every field not found and every component kept as plain content. Compare old and new pages side by side.

    Parity check →
  4. 4

    Install

    You import with the target system's own tool, on your own environment. Each download's README gives the command. Your system changes only when you run it.

    How each import was tested →

Import kit and one document per page, in the format of Adobe's AEM Importer. The free EDS block mapper shows which of your components map to EDS blocks. For AEM 6.5 code, the free readiness scan lists Cloud Service blockers in your browser. Nothing is uploaded.