← Back to DAGDA | Support | Source: https://github.com/Automattic/static-site-importer
Skip to content

About

Import static HTML sites into WordPress block themes

Resources

Contributing

Stars

93 stars

Watchers

0 watching

Forks

Latest commit

 

History

5,567 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Static Site Importer

Import a static site or generated website artifact into WordPress pages and an intentional companion block or classic theme.

Try Static Site Importer in WordPress Playground

Static Site Importer (SSI) is a WordPress plugin. It takes pasted HTML, website files, a ZIP, a public URL, a Figma design or a generated website artifact. It compiles the content with the Blocks Engine PHP transformer, then writes the result into WordPress as native, editable pages and a generated theme.

Requirements and install

  • WordPress 7.1 or later.
  • PHP 8.3 or later.
  • Composer dependencies. Release ZIPs bundle them; for a checkout, run composer install.

Install a release ZIP like any plugin, or try it with no install in the Playground demo above. SSI requires automattic/blocks-engine-php-transformer with a stable caret range; the committed lockfile pins the exact release.

Import surfaces

SSI is an infrastructure plugin. Its surfaces are WordPress abilities, WP-CLI, REST and PHP APIs. It registers no wp-admin screen. The import form in the Playground demo comes from a separate demo plugin that calls the REST API.

WP-CLI. wp static-site-importer import takes exactly one of --request=<json file>, --url=<url> or --plan=<saved plan>:

wp static-site-importer import --url=https://example.com/ --slug=example --activate

wp static-site-importer import --url=https://example.com/ --operation=plan --slug=example > plan-receipt.json
jq '.response' plan-receipt.json > plan.json
wp static-site-importer import --plan=/absolute/path/to/plan.json

The command handles continuation by itself and prints one JSON receipt. It exits non-zero only on a genuine import failure. See WP-CLI for every option, request files, resuming a run, and the media, recompose, materialize-wordpress-site-plan and validate-artifact commands.

Ability and REST. The static-site-importer/import ability is the one canonical contract. It takes source.type (html, files, zip, url or figma) and operation (plan or apply). The ability is exposed through the Abilities REST API. POST /wp-json/static-site-importer/v1/imports normalizes a source and runs the same ability. A plan needs edit_posts; an apply needs switch_themes. See REST API and abilities for the other abilities and the URL and ZIP intake rules.

What you get

  • Pages. Each source document becomes a native WordPress page, with its body stored as block markup in post_content. Local .html links are rewritten to permalinks, and index.html becomes the front page when the theme is activated. Old URLs keep working through Redirection rules.
  • A block or classic theme. By default, SSI writes a generated block theme with theme.json, style.css, header and footer template parts, core/post-content templates and page patterns. --theme-materialization=classic writes a managed classic theme instead. You can also import into the existing theme.
  • Navigation. Supported header and footer menus become deterministic wp_navigation entities referenced from the template parts.
  • Synced patterns. Shared sections the producer declares become synced wp_block patterns. A reimport reconciles them, and owner edits are kept.
  • Media. Images go to the Media Library. Captures with deferred media import first and fetch their media in later batches.
  • Plugins and entities, when the source needs them. These include WooCommerce products, Jetpack forms, Redirection rules, The Events Calendar events and TranslatePress translations.
  • Site identity. The import sets the title, tagline, logo and icon, and removes untouched WordPress seed content. See Site identity.
  • Report-only findings. Every import returns a materialization receipt and an import report. They hold a classified loss ledger, quality scores and diagnostics. Findings report follow-up work but never reject an import that materialized. See Import report.

Generated theme shape describes the exact files. Website artifact export turns a theme back into a portable artifact.

Security in one paragraph

All input is treated as untrusted static content. Non-static files are skipped. Server code in the entrypoint fails the import. URL imports refuse private and reserved addresses. Source JavaScript is removed by default under the inert client script policy. Details are in Content-only security.

Current limits

  • Local imports discover sibling *.html files beside the entry file, plus nested Markdown documents. They do not crawl for missing assets.
  • URL imports collect the sitemap and same-origin linked routes. They do not run JavaScript, and they do not use platform-specific APIs.
  • MDX, Astro, Eleventy, Hugo and other build tools are out of scope. Build those sites to static HTML first. .mdx files are skipped and reported.
  • Navigation persistence is limited to header and footer shapes that convert without guessing.
  • Some layouts still import with core/html fallbacks or imperfect visual parity. The import loop below exists to find and fix those cases.
  • Committed first-party fixtures are tests/fixtures/wordpress-is-dead/ and tests/fixtures/mixed-source-site/. The wider site corpus lives in Blocks Engine.

Make the importer better with an AI-assisted loop

Most improvements start with a real site that imports badly. The import loop works with ordinary tools:

  1. Capture the site.
  2. Re-import it.
  3. Evaluate it at 390, 768 and 1440 px and in the editor.
  4. Find which repository owns each defect.
  5. Reduce the defect to a minimal page.
  6. File a reproducible issue.
  7. Fix it with a failing test.
  8. Confirm the fix on every route.

A coding agent can run any step. Homeboy can run the whole loop unattended. The acceptance bar has three parts: no fallback blocks, visual parity, and native blocks that edit without validation errors.

Architecture

SSI owns the WordPress side of the stack: intake, safety, materialization, media, providers and reports. Blocks Engine owns compilation and the blocks-engine/wordpress-site-plan. Data Liberation Agent owns site capture. See Stack and the product handoff contract.

Documentation and contributing

  • docs/README.md: the index of guides, architecture, contracts and lab pages.
  • CONTRIBUTING.md: setup, tests, test philosophy, owning-layer rules, PR conventions and releases.
  • AGENTS.md: instructions for coding agents.
  • docs/CHANGELOG.md: the release history, generated by Homeboy.

License

GPL-2.0-or-later.

About

Import static HTML sites into WordPress block themes

Resources

Contributing

Stars

93 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages