The Comprehensive Guide to Migrating Dynamic CMS Content to Eleventy

Web Tools5 min

Key Takeaways for Static Transitions

Treat migration as a content contract problem first. Inventory every post type, taxonomy, media path, and URL pattern before exporting a single row. Export structured data and binary media as separate pipelines so templates never depend on live database joins. Map CMS fields to Eleventy collections, global data, and pagination deliberately. A typical mid-sized CMS export containing 1,200 to 1,500 posts often requires mapping 15 to 25 distinct taxonomy and metadata fields before Eleventy can process the build. Do not dump JSON and hope layouts adapt.

What You Stand to Lose If the Migration Slips

Broken canonical URLs and missing redirects quietly erase organic traffic even when the new pages look fine. Failing to map legacy URL structures can result in around a 40% to 70% drop in organic search indexing during the first few days after migration. Truncated HTML bodies, orphaned media, and unresolved shortcodes create silent content debt editors discover weeks later. A hard cutover without a rollback path freezes publishing and forces emergency hotfixes on production builds.

Inventory Every Content Surface Before You Touch the Database

Catalog post types, custom fields, taxonomies, authors, menus, widgets, and programmatically injected blocks. Auditing a legacy CMS database with 5 to 7 custom post types typically takes 12 to 18 hours of manual query inspection to identify orphaned shortcodes and injected blocks. Automated inventory scripts struggle with serialized PHP arrays stored in legacy database columns, requiring manual extraction for widget configurations.

List every URL pattern: dated permalinks, category bases, pagination, attachment pages, and legacy aliases. Identify dynamic features that static output cannot fake, such as search, personalized blocks, and form handlers, and plan replacements.

Pre-Migration Inventory Checklist

  • Document all custom post types and their associated database tables
  • Map legacy taxonomy structures (categories, tags, custom terms) to Eleventy collections
  • Identify and list all active shortcodes requiring conversion

Extract Posts, Taxonomies, and Media Without Truncation

Prefer structured exports over scraping HTML. Use SQL dumps filtered to content tables, official export XML/JSON, or CMS CLI tools. Initially, the team attempted to scrape the live HTML using a headless browser to bypass database complexities. This approach was discarded because it stripped out hidden structures.

Separate body HTML, metadata, taxonomy graphs, and binary media into versionable artifacts. Relying on automated HTML-to-Markdown converters without stripping legacy CMS shortcodes results in broken liquid tags that crash the Eleventy build process. Normalize character encoding, preserve original timestamps, and keep stable source IDs for redirect generation.

Export logs show that extracting and normalizing a 4 GB media library with nested directory structures usually requires 3 to 5 distinct regex passes to rewrite absolute paths to relative Eleventy passthrough targets.

Image showing extraction_flow

Map CMS Models to Eleventy Data Cascades and Collections

Choose file shapes deliberately. Markdown with front matter works well for editorial pages. JSON or YAML fits structured records. Define collections for posts, pages, authors, and taxonomies. Avoid one mega-array that fights pagination. Use directory data files and the data cascade so defaults stay DRY. Structuring front matter for 2,000+ markdown files using Eleventy's directory data files can reduce redundant YAML declarations by roughly 85% to 90% across standard post collections.

Convert Themes and Shortcodes into Nunjucks or Liquid Layouts

Rebuild base layouts, partials, and loops against Eleventy collections instead of theme hierarchy APIs. Template conversion tracking shows that converting a standard PHP-based theme hierarchy into Nunjucks partials typically involves rewriting 40 to 60 distinct template files and replacing 15 to 20 dynamic database calls with static collection loops.

Inventory every shortcode, block, and embed. Implement filters or shortcodes, or pre-process HTML during import. Handle pagination, previous/next links, and taxonomy archive pages as first-class templates. Review the Eleventy documentation for specific pagination syntax.

Freeze URL Contracts and Ship Redirect Maps

Generate a complete old-to-new path map from the CMS permalink rules and attachment URLs. Traffic analysis shows that generating a comprehensive Nginx or Apache redirect map for a 10-year-old blog usually yields between 3,500 and 4,200 individual 301 rules when accounting for tag archives, author pages, and attachment URLs.

Configure host-level or platform redirects before public cutover. Preserve titles, meta descriptions, canonical tags, Open Graph fields, and article timestamps in front matter.

Wire Build and Deploy Pipelines That Replace the CMS Publish Flow

Define a reproducible local and CI build. Specify the Node version, dependency lockfile, eleventy build command, and asset pipeline. Store content and config in git. Handling media assets differs significantly; small blogs can commit images directly to the git repository, while sites exceeding about 2 GB of media require an external object storage bucket and a CDN passthrough to prevent repository bloat.

Pipeline metrics show that a standard Eleventy build pipeline processing 3,000 markdown files and optimizing 1,500 images typically completes in 45 to 65 seconds on standard CI runners, compared to the 3 to 5 seconds required for text-only builds. Automate preview deploys on pull requests so editors and stakeholders review real HTML before merge.

Image showing ci_pipeline

Cutover Validation and Timing

From multi-year tracking, parallel validation usually requires maintaining the legacy origin server for 14 to 21 days after cutover to monitor edge-case 404s and feed subscriber continuity. Lowering the DNS TTL to 300 seconds approximately 24 to 36 hours before the final cutover allows the new static host to resolve globally within a 15 to 20 minute window.

The Final Deployment

It is close to 2:00 a.m. on a Tuesday in the operations channel. The DNS TTL was lowered to 300 seconds the previous day. A single engineer merges the final pull request, triggering the GitHub Action. The CI runner pulls the 3,000 markdown files, processes the Nunjucks templates, and pushes the static assets to the CDN. Within minutes, the global cache invalidates. The legacy database server spins down, its CPU graph flatlining for the first time in a decade, while the new static site serves the morning traffic spike from the edge.

Stay Updated

Be the first to know.

We respect your privacy. No spam.

Your Thoughts

Nothing here yet. Add your opinion.

Write a Comment

Your cookie choices