Documentation · updated

How pages are converted: the neutral document, block mapping and the import kit

Each page is turned into one plain document: its content in order, with every component written as a small table that names its block. That document is the middle of everything. Edge Delivery reads it as it is, and the generators for AEM and for other systems start from it. A script written for your site does the conversion, so you can read it, change it and run it again.

Who does what

StepAutomaticChecked by a personHand work
Build the block mappingFrom the scan of your site, or from your AEM code. It says which part of a page becomes which block and where each field is found.An engineer checks low-confidence entries and guessed selectors.Mapping decisions for custom components.
Generate the import kitThe import script, starter blocks and a README are written from the mapping.The files are checked to parse, and the script is run on sample pages.Finishing custom blocks and their styles.
Run it on pagesEach page becomes a document, with a report of blocks written and fields not found.A person compares converted pages with the originals, template by template.Fixing the mapping where a field was not found.

In plain words

Think of a page as a stack of parts: a banner, three cards, a paragraph, a table. The conversion writes that stack down as a document. Plain text and images stay as they are. Each part with a structure becomes a small table: the first row says what it is ("Cards"), the next rows hold its content. A line between sections and a table of page details (title, description) complete it.

This is the format authors use on Edge Delivery Services, where a block is a table whose first row names it and sections are separated by a line. Because every source system is brought to this one form first, a new target only needs a new writer, not a new reader for every system.

The neutral document

Part of the documentWhat it holds
Plain contentHeadings, paragraphs, lists, images and links, in page order.
A block tableOne component. The first row names the block and its variants. Each block-level field is one row. Repeated items, such as cards or slides, are one row each with one cell per field.
A section breakA horizontal line where the old page started a new section. A Section Metadata table carries the section's style when it had one.
The Metadata tablePage title, description and the other page details the script kept.

Two rules keep the document readable by Edge Delivery. Blocks do not nest: a mapped component inside another mapped component stays as content of the outer block, and the report counts it. A data table inside a component becomes its own Table block, row for row, so that no table sits inside a table cell.

The block mapping

The mapping is a list. Each entry names a block, the selector that finds its component on a page, its fields in order, a confidence level and the hand-work items that apply. It is built in one of two ways.

Your sourceHow the mapping is builtWhere
AEM codeFrom the components in your repository: block names, fields, and the files the Universal Editor needs. It runs in your browser.Component to block mapper
Another CMS: WordPress, Drupal, Sitecore, Optimizely, Kentico, Umbraco, HubSpot, SharePoint, Liferay, HCL Digital Experience, Magnolia, Progress Sitefinity, Bloomreach, TYPO3, Joomla, Webflow, Wix, Squarespace, Shopify, GhostFrom what the scan found on your site, with that system's own rules for its components. WordPress and Sitecore SXA have fixed mappings; Drupal's is built from the paragraph and block types the scan saw.The site scan, then the trial on your own pages
A system with no readerOne entry per block the scan found by a class name, with the content kept as one cell and the confidence set to low.The trial on your own pages

Where a field's place on the page had to be guessed from its name and type, the generated script says "Guessed selector" beside it. Those lines are the first thing an engineer reviews on a real page.

What the import script does to a page

  1. Finds the main content. Several places can be listed, best first; the first that exists wins.
  2. Removes what is not page content: header, footer, navigation, breadcrumbs, cookie and consent banners from the common vendors, scripts and styles.
  3. Marks the sections and adds a line between them.
  4. Finds every mapped component and replaces it with its block table, reading the fields in the mapping's order. A field it looked for and did not find is written to the report as block.field.
  5. Drops or unwraps what the mapping says to drop.
  6. Rewrites links and image addresses, and works out the document's new path.
  7. Adds the Metadata table.

The script is in the format Adobe's AEM Importer runs: one file that returns the converted element, its path and a report for each page. So it runs in Adobe's own tool, in your project, without us.

What is in the import kit

FileWhat it is
tools/importer/import.jsThe import script for your site.
blocks/<name>/<name>.js and .cssA starter block for every mapped block. Twelve standard blocks (hero, cards, columns, tabs, accordion, carousel, embed, table, quote, video, form, fragment) are written once and reused. A custom block gets a scaffold that reads the rows in the mapping's order.
component-models.json, component-definition.json, component-filters.jsonOnly when you author in AEM with the Universal Editor: the files that editor and the import need.
README-surge-import.mdHow to run the import, the blocks in the kit, and what needs an engineer.

The mapping is always shown in full on screen. The downloaded kit holds the first 10 blocks for a free account, and every block in a paid engagement. The trial on your own pages gives the same 10.

What the report tells you

In the reportWhat it meansWhat to do
BlocksHow many of each block were written on the page.Compare with the page: is anything missing?
SectionsHow many sections the page was split into.Check the order.
MissingFields the script looked for and did not find, as block.field.Fix the selector in the mapping, or accept that the field is optional.
NestedMapped components that sat inside another one and were kept as content of the outer block.Decide whether the outer block needs a richer design.
ErrorsA selector that did not work, or a block that could not be built.An engineer fixes the mapping.
Kept plain (trial)Blocks the scan named that the kit did not turn into a block.Their content is still there as plain content. Decide whether a block is worth building.

How the generated code is kept safe

  • Class names and other values read from a scanned page end up in the script's comments and strings. They are escaped so that a value cannot end a comment or start new code.
  • In the trial on your own pages, the script runs on our server in a context of its own, without access to files, the network or timers, and with a time limit of 8 seconds per page. The page's HTML is treated as data and is never run.
  • Generated JavaScript, CSS and JSON files are checked to parse in our tests and by the command-line tool.

Questions

Can we change the import script ourselves?

Yes. It is one readable JavaScript file in your project, with a parser per block. The blocks read the rows in the same order the script writes them, so change both together.

Does the conversion use AI?

Import scripts, packages and import files are written by code from rules you can read. Most of every conversion is rules. A model on servers we operate looks at repeating components the rules could not name and says which block each is: cards, columns, an accordion, tabs or a carousel. It never writes content or selectors. Each answer is tried on your own pages. It is used only if no word is lost or added and the block is valid. Your report marks it as placed by AI, for you to review before you install.

What happens to a component the mapping does not know?

Its content stays in the document as plain content, in place. Nothing is deleted without a rule that says so, and the trial lists the blocks that were kept plain.

Do you support the Universal Editor as well as document authoring?

Yes. The same script has two modes. For the Universal Editor the kit adds the model, definition and filter files, and rows follow the model's field order.

Where this comes from

Each statement on this page describes code that exists or repeats a page of this site:

  • The plan, the script generator and the kit (src/eds/importer/plan.ts, import-script.ts, bundle.ts, block-kit.ts)
  • One kit per source system (src/sources/registry.ts)
  • The trial pipeline and its sandbox (src/try/pipeline.ts, sandbox.ts)
  • The wording on AI in the conversion (AI_SECTION in src/content/home-any.ts)
  • The converted document as read by the generators (src/aem/package/convert.ts, src/targets/model.ts)
  • Import kit generator

Facts about another company's product come from that company's own pages:

Surge Migrate is not affiliated with Adobe or with any other vendor named in this documentation. No prices are listed here: see the pricing page and the self-serve prices page, or ask.

Next: How the AEM content package is built, and what installing it changes →