Edge Delivery Services how-tos · updated

How an Edge Delivery Services block works: folder, markup and decorate()

An Edge Delivery Services block is a folder under /blocks named after the block. It holds a CSS file and a JavaScript module with the same name, and the block loader adds the files when an author uses that block on a page. The JavaScript module exports a default function that receives the block element and rewrites the nested div markup into the structure you want to style.

What the author creates

In Word, Google Docs or Document Authoring, an author adds a table whose first row holds the block name, for example 'Cards'. The rows and cells below become the block's content. On the server this is rendered as nested div elements: one div with the block's class, a div per row and a div per cell. In the simplest case a block has a single cell.

What the developer writes

The block name is used three ways: as the folder name, as the CSS and JS file names, and as the CSS class on the block element. aem.live describes the JavaScript as an ES module whose default export runs when the block loads. Keep every CSS selector scoped to the block class so styles never leak into other blocks.

PartWhere it livesExample for a 'cards' block
Folder/blocks/<name>//blocks/cards/
Styles/blocks/<name>/<name>.css/blocks/cards/cards.css, selectors start with .cards
Behaviour/blocks/<name>/<name>.jsexport default function decorate(block) { … }
Markup classAdded from the table header<div class="cards">

Adobe's guidance is to absorb complexity in code rather than pushing it onto authors: an author should be able to copy and paste a block and understand it. Prefer simple semantic markup plus modest DOM changes over very complex CSS selectors.

Illustrative decorate() for a cards block (turns rows into a list)

export default function decorate(block) {
  const ul = document.createElement('ul');
  [...block.children].forEach((row) => {
    const li = document.createElement('li');
    while (row.firstElementChild) li.append(row.firstElementChild);
    ul.append(li);
  });
  block.replaceChildren(ul);
}

How to do it

  1. Agree the block's authoring table with authors first: name, rows and what each cell holds.
  2. Create /blocks/<name>/<name>.css and <name>.js with the same name as the table header (lower case, hyphenated).
  3. In the JS, export a default function that takes the block element and reshapes its rows and cells.
  4. Scope every CSS selector with the block class.
  5. Preview a page that uses the block and check the decorated DOM in the browser's dev tools.

Related pages on this site

Questions

Can blocks be nested inside other blocks?

aem.live says blocks should never be nested because it makes authoring very hard. Use sections, or have one block reference content another way.

Does every block need JavaScript?

No. Some blocks only need CSS on the default markup; add JS when you need to restructure the DOM or add behaviour.

Where does a block's name come from?

From the first row of the author's table. It becomes the folder name, the file names and the CSS class.

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.