Skip to navigation Skip to main content
Eleventy
Eleventy Documentation
Stable
3.0.0
Canary
3.0.1-alpha.1
Toggle Menu
Eleventy 1.93s
Next.js 70.65s

Migrating from IndieWeb Avatar for https://wordpress.orgWordPress to Eleventy

Use @11ty/import

Eleventy provides a command line tool to import various data sources to projects as static content files.

This importer accepts a number of different types of import sources—in this example we’ll use a WordPress blog home page URL. This will convert all of the posts (via the WordPress REST API) from that blog to static content files in your local project.

> npx @11ty/import wordpress https://example.com/
Wrote 141 documents and 810 assets (933 cleaned, unused) from WordPress (7 errors) in 2.14 seconds (v1.0.0)

The importer will:

  1. Import the post content to the file system maintaining the same URL structure (change the root directory with --output)
  2. Download all of the assets referenced in that content to your project (so that you can version them in git, for example) and change the reference URLs in the markup to point to those files.
  3. Will not overwriting existing content (unless using the --overwrite option) so that you can repeat the same import command to only fetch new content.
  4. All downloads are cached locally so that you can stop and resume a large import without losing your import progress (using the Eleventy Fetch plugin).
  5. Optionally convert the content to Markdown.

Try it out with --dryrun first to be safe!

Alternatively, use a WordPress Export File

If you would like to permanently escape the WordPress ecosystem, you can do a one-time export of your content via the Admin panel of your WordPress site. At time of writing this feature exists in the WordPress sidebar in ToolsExportExport content (section) → Export all (button).

This will create a compressed XML file with all of your posts (drafts included) for download. You can optionally also export your media library, but that is unnecessary for the purposes of this guide.

You can use lonekorean/wordpress-export-to-markdown to convert your exported XML file to markdown files (or another similar tool). This tool will also download any media from your post and page content too.

Now you can place these markdown files in your Eleventy input directory and we’ll build them for you! If you use the Image transform plugin, we’ll optimize your images automatically too!

WordPress XML Export to Markdown Tools

Community Resources

Resources via 11tybundle.dev (Migrating to Eleventy) curated by IndieWeb Avatar for https://www.bobmonsour.com/Bob Monsour.