To migrate from Squarespace to Astro, export your site from Squarespace’s import and export settings (it produces a WordPress-format XML file), convert that file to Markdown with a converter, download images from Squarespace’s CDN, rebuild the design as Astro pages and components, and redirect every URL that changes. The export covers blog posts and basic pages; products, design and some page types need to be moved by hand.
This Squarespace to Astro guide walks through each step with commands and code, and ends with a launch checklist that protects your search traffic.
Key Takeaways
- Squarespace exports to a WordPress XML file. It covers basic pages and blog posts, not the design or every page type.
npx wordpress-export-to-markdownturns that XML into Markdown files with frontmatter.- Images stay on
images.squarespace-cdn.comuntil you download them.- Match Squarespace’s blog URL format (date-based or plain) with Astro routes, or redirect.
- Products export separately as CSV and move to a commerce service.
What Squarespace’s export includes
Squarespace’s export is designed for moving to WordPress, so it’s partial:
| Content | Included in export | How to move it |
|---|---|---|
| Blog posts (one blog) | Yes | Convert XML to Markdown |
| Basic pages | Yes, as text and images | Convert, then rebuild layout in Astro |
| Gallery pages | Partly | Rebuild as an Astro gallery |
| Product pages | No | Export products CSV from Commerce |
| Events, albums, other special pages | Mostly no | Copy by hand |
| Site design, fonts, custom CSS | No | Rebuild in Astro |
| Form submissions and settings | No | Replace with a form backend |
Squarespace’s help pages list exactly what’s included for your site version; check them before relying on the export. If your site has several blogs, plan to export them one at a time or copy the extras manually.
If you’re still deciding, Astro vs Squarespace covers what you gain and what you give up.
Step 1: Inventory URLs
Save every URL from your live sitemap (/sitemap.xml) into a spreadsheet with columns for the new URL and whether it needs a redirect. Add your top landing pages from Google Search Console so the important ones get checked first. This list becomes your redirect plan and your launch test.
Step 2: Export and convert content
In Squarespace, open the site’s settings, find the import and export section, and choose Export. Pick the WordPress option and download the .xml file.
Convert it to Markdown with the open-source wordpress-export-to-markdown tool:
npx wordpress-export-to-markdown --input=squarespace-export.xml --output=content-export
The tool asks a few questions (folder structure, whether to save images, date prefixes). Choose one folder per post without date prefixes; that keeps slugs clean. It writes Markdown files with title, date and other frontmatter, and can download images it finds.
Step 3: Set up Astro and load the posts
npm create astro@latest my-site
cd my-site
Copy the converted posts into src/content/blog/ and define the collection to match the frontmatter the converter wrote:
// src/content.config.ts
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const blog = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
schema: z.object({
title: z.string(),
date: z.coerce.date(),
description: z.string().default(''),
categories: z.array(z.string()).default([]),
tags: z.array(z.string()).default([]),
}),
});
export const collections = { blog };
Run npm run dev. If a post fails schema validation, Astro names the file and the field, which makes cleanup fast. The Content Collections docs explain schemas in depth.
Step 4: Download remaining images
Images the converter didn’t catch still point to Squarespace’s CDN, often with a ?format= query. Save them locally:
// scripts/squarespace-images.mjs
import { readFileSync, writeFileSync, mkdirSync, globSync } from 'node:fs';
import { basename } from 'node:path';
mkdirSync('public/images', { recursive: true });
const pattern = /https:\/\/images\.squarespace-cdn\.com\/[^\s)"]+/g;
for (const file of globSync('src/content/blog/**/*.md')) {
let text = readFileSync(file, 'utf8');
for (const src of new Set(text.match(pattern) ?? [])) {
const clean = src.split('?')[0];
const name = decodeURIComponent(basename(clean)).replace(/[^\w.-]/g, '-').toLowerCase();
const res = await fetch(clean);
writeFileSync(`public/images/${name}`, Buffer.from(await res.arrayBuffer()));
text = text.replaceAll(src, `/images/${name}`);
}
writeFileSync(file, text);
}
Then search for anything left: grep -rl "squarespace-cdn" src/. Images on regular pages (hero images, team photos) belong in src/assets/ so Astro’s <Image /> can resize and convert them.
Step 5: Rebuild the design
Squarespace’s design doesn’t export, so recreate it as an Astro layout plus section components. Most Squarespace sites are built from a small set of section types, which map neatly onto components:
---
// src/pages/index.astro
import BaseLayout from '../layouts/BaseLayout.astro';
import Hero from '../components/Hero.astro';
import Services from '../components/Services.astro';
import Testimonials from '../components/Testimonials.astro';
import ContactCta from '../components/ContactCta.astro';
---
<BaseLayout title="Studio North" description="Interior design for homes and small offices in Leeds.">
<Hero heading="Calm, practical interiors" image="living-room" />
<Services />
<Testimonials />
<ContactCta />
</BaseLayout>
Building these from scratch is the largest part of the migration. A finished Astro theme can replace most of it: Komal Nakrani Astro themes include the common small-business page sets (services, about, gallery, contact) as editable components, and each has a live preview.
Step 6: Match blog URLs
Squarespace blog posts use one of a few URL formats depending on your blog settings, such as /blog/post-slug or a date-based form like /blog/2024/3/14/post-slug. Check a few live posts and mirror the pattern.
For the plain format, a dynamic route is enough:
---
// src/pages/blog/[slug].astro
import { getCollection, render } from 'astro:content';
import BaseLayout from '../../layouts/BaseLayout.astro';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map((post) => ({ params: { slug: post.id }, props: { post } }));
}
const { post } = Astro.props;
const { Content } = await render(post);
---
<BaseLayout title={post.data.title} description={post.data.description}>
<article>
<h1>{post.data.title}</h1>
<Content />
</article>
</BaseLayout>
For date-based URLs, either use a rest parameter route (src/pages/blog/[...path].astro) that builds the date path from each post’s frontmatter, or switch to plain slugs and redirect the old date paths. The routing guide covers rest parameters.
Squarespace serves URLs without a trailing slash. Set trailingSlash in astro.config.mjs to match your choice and keep canonicals consistent.
Step 7: Redirects, forms and commerce
Redirects. For every URL that changes, add a 301 at the host:
# public/_redirects (Netlify and Cloudflare Pages)
/our-services /services 301
/blog/2024/3/14/spring-refresh /blog/spring-refresh 301
Forms. Replace Squarespace form blocks with a form backend or a server route. See contact forms on a static Astro site.
Commerce. Export products as CSV from the Commerce section and import them into Shopify, Snipcart or another service, then link or embed product pages.
Other blocks. Newsletter blocks become an email provider’s form; scheduling blocks become a booking tool embed; social feeds become simple links.
Launch checklist
- Every URL in the spreadsheet returns 200 or a 301 on the new site.
- Page titles and meta descriptions copied from Squarespace’s SEO settings.
- Images load from your domain, with alt text.
- Forms send to the right inbox.
- Sitemap generated and submitted in Search Console.
- Domain DNS pointed at the new host. If the domain was registered through Squarespace, update its DNS records or transfer it.
- Squarespace subscription kept for a short overlap, then cancelled.
FAQ
Can I export my Squarespace site to Astro?
Not as a working site. Squarespace exports blog posts and basic pages as a WordPress XML file, which you convert to Markdown for Astro. The design, products and some page types have to be rebuilt or moved separately.
How do I convert a Squarespace export to Markdown?
Run npx wordpress-export-to-markdown on the XML file Squarespace gives you. It writes one Markdown file per post with frontmatter and can download images, ready to copy into an Astro content collection.
Will my Squarespace URLs still work on Astro?
Only if you recreate the same paths or redirect them. Mirror your blog’s URL format with Astro routes, keep page slugs the same, and add 301 redirects at your host for anything that changes.
What happens to my Squarespace images?
They stay on Squarespace’s CDN until your site is cancelled, so download them into your Astro project before launch and update the paths in your content.
How long does a Squarespace to Astro migration take?
A small brochure site with a blog can move in a few days, most of it spent rebuilding the design. Starting from an Astro theme shortens that, and the content conversion itself takes an hour or two.