cms · wordpress · markdown
Moving from WordPress to a static site: a practical migration plan
How to move a WordPress site to Hugo, Astro, Eleventy or Jekyll: exporting content, converting to Markdown, handling shortcodes and media, and keeping every URL working.
Updated · first published · 5 min read
Key points
- The WordPress export file (WXR) contains posts, pages, metadata, categories and tags, but not the media files themselves — download those separately.
- Convert to Markdown with front matter, then search the output for leftover shortcodes; each one needs a component or manual rewrite on the new platform.
- Decide on URLs before you build. Either keep WordPress's permalink structure or redirect every old URL with a server-level 301.
- Hugo's aliases and similar features create client-side redirects; server-level 301s are better for search engines when your host supports them.
- Forms, comments, search and scheduled publishing are server features in WordPress. List them early, because each needs a replacement.
A static site generator turns Markdown files into plain HTML at build time. There is no database to query, no PHP to patch and no admin panel to protect, which is why so many blogs, documentation sites and marketing sites move off WordPress.
The move has three parts that are easy to blur together: getting the content out, re-creating its structure in the new tool's terms, and keeping its URLs working. Treat them as separate jobs and the migration becomes predictable.
Before you export: take an inventory
Spend an hour listing what the site actually does before converting anything. WordPress quietly provides a lot through plugins and the server:
- Content types: posts, pages, and any custom post types (products, events, portfolios)
- Taxonomies: categories, tags and custom taxonomies, plus their archive pages
- Dynamic features: contact forms, comments, site search, newsletter sign-ups, scheduled posts
- Plugin output: galleries, sliders, tables, related posts, SEO metadata
- Shortcodes: anything in square brackets inside the content, such as
[gallery]or[contact-form-7 id="12"]
Everything in the last three groups needs a decision on the new platform: a replacement service, a component, a build-time equivalent, or removal. Finding them now is much cheaper than finding them in the converted Markdown.
Export the content
In the WordPress admin, Tools → Export produces a WXR file — WordPress eXtended RSS, an XML format. It contains posts and pages with their content, dates, authors, slugs, status, categories, tags, custom fields and comments.
It doesn't contain the media files. Attachments appear as records with their original URLs, so images keep pointing at the old server until you download them and update the links. Copy the wp-content/uploads folder from the server (or use a backup) so you have every file at its original path.
Convert to Markdown with front matter
Each post becomes a Markdown file. The metadata goes into front matter — a YAML (or TOML) block at the top of the file that the generator reads:
---
title: "Choosing a CSV delimiter"
date: 2024-03-18T09:30:00Z
slug: choosing-a-csv-delimiter
categories: [Data]
tags: [csv, excel]
description: "Commas, semicolons and tabs, and when to use each."
aliases: ["/2024/03/choosing-a-csv-delimiter/"]
---
The WordPress to Markdown converter reads the WXR file and writes one Markdown file per post and page in this shape, converts both block-editor and classic-editor HTML to clean Markdown, lists every image to re-host, and puts the old permalink in the front matter so you can redirect it. For HTML pasted from elsewhere — a page builder's output, a single article — use the HTML to Markdown converter.
Front matter conventions differ between generators. Hugo uses draft: true where Jekyll uses published: false, and Hugo accepts TOML front matter between +++ lines. If you're switching between generators later, the front matter converter rewrites the block between YAML, TOML and JSON and renames the fields that differ.
Clean up what didn't convert
Some things have no Markdown equivalent and come through as text. Search the output for them:
- Shortcodes. Search for
[followed by a letter. Decide per shortcode: replace it with your generator's equivalent (Hugo shortcodes, Astro or MDX components, Eleventy shortcodes), rewrite the content by hand, or remove it. - Embeds. WordPress turns a bare YouTube or Twitter URL on its own line into an embed. In Markdown it's just a URL until you add an embed component.
- Inline styles and classes from page builders. They're usually better dropped and replaced by the new theme's styles.
- Image sizes. WordPress generates
image-300x200.jpg,image-1024x683.jpgand so on, and content often links to a resized copy. Point images at the original and let the new build pipeline produce responsive sizes.
Re-host the media
Copy the uploads into your new project — static/ in Hugo, public/ in Astro and Next.js, a passthrough folder in Eleventy — then update the URLs in the Markdown. If you keep the same /wp-content/uploads/... paths, existing image links (including those in search results and on other sites) keep working without redirects.
If you're changing the domain at the same time and need to update a database that will stay in service — a WooCommerce store, say — use a serialisation-aware replacement. WordPress stores many settings as PHP serialised strings that record their own length, and a plain find-and-replace corrupts them. The WordPress search-replace tool works on a SQL dump and recalculates those lengths.
Keep every URL working
This is where WordPress migrations most often lose traffic. WordPress URLs usually look like /2024/03/choosing-a-csv-delimiter/ or /choosing-a-csv-delimiter/, and category archives like /category/data/. Your new generator has its own defaults.
You have two options:
- Keep the same URLs. Configure the generator's permalink pattern to match WordPress's. Hugo, Jekyll, Eleventy and Astro can all reproduce date-based or slug-only paths. This is the safest choice.
- Change the URLs and redirect. Build a map of old URL to new URL — the converter's output gives you the old side, and the URL mapping tool pairs it with the new site's URLs — then turn it into server rules with the redirect generator.
A note on aliases: Hugo's aliases front matter and Jekyll's jekyll-redirect-from plugin create small HTML pages with a meta refresh, because a static site can't send HTTP status codes on its own. Search engines do follow them, but a real 301 from the server or host (Netlify _redirects, Vercel vercel.json, nginx, Cloudflare) is the stronger signal. Use server-level redirects wherever your host supports them.
Don't forget the URLs WordPress generated without you thinking about them: category and tag archives, author pages, paginated archives (/page/2/), the feed at /feed/, and attachment pages. Redirect the ones that had traffic or links; let the rest return 404.
Replace the dynamic features
- Comments: export them from the WXR file and either render them statically, move to a hosted or Git-based comment system, or retire them.
- Forms: use your host's form handling or a form service.
- Search: generate an index at build time and search it in the browser.
- Scheduled posts: set a future date and rebuild on a schedule, or publish when you merge.
Launch checklist
- Every post and page converted; drafts and private posts handled deliberately
- Leftover shortcodes and embeds found and resolved
- Media copied and linked from the new paths
- URL structure kept, or every important URL redirected with a 301
- Old feed URL redirected to the new feed
- New XML sitemap submitted to Google Search Console and Bing Webmaster Tools
- Forms, comments and search replaced and tested
The content conversion takes minutes. The inventory and the URL plan are what make the move feel uneventful — which is exactly how a migration should feel.
About the author
Abdessamad Bettal, full-stack engineer and the developer of migration.tools — free, private, browser-based tools for moving databases, data, websites and content between systems.