How I Finally Escaped Copy-Paste Hell
The exact 30-minute Astro migration I used on every single one of my sites
December 05, 2025 • Mike
Result: Same perfect Lighthouse 100 scores • Same raw HTML/CSS control • But now one header change updates 300 pages instantly.
Step 0 – Create the project (2 minutes)
npm create astro@latest mikesblogdesign-new
# Choose:
# • Empty project
# • Yes to TypeScript
# • Yes to install dependencies
cd mikesblogdesign-new
npm run dev
Step 1 – Drop in your existing HTML (literally)
Just copy any of your current pages and rename to .astro:
<!-- src/pages/index.astro -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>MikesBlogDesign</title>
<link rel="stylesheet" href="/styles/global.css" />
</head>
<body>
<!-- Your exact same header you've been copy-pasting for years -->
<header>...</header>
<main><h1>Home</h1>...</main>
<footer>...</footer>
</body>
</html>
Step 2 – Extract Header & Footer once (the life-changing part)
src/components/Header.astro
---
---
<header>
<nav>
<a href="/">Home</a>
<a href="/category/artificial-intelligence/">AI</a>
<a href="/category/productivity/">Productivity</a>
<a href="/category/health/">Health</a>
<a href="/about/">About</a>
</nav>
</header>
src/components/Footer.astro
---
---
<footer>
<p>© 2025 MikesBlogDesign • Hand-crafted with ♥ and Astro</p>
</footer>
Step 3 – Replace the old copy-pasted code on every page
---
// src/pages/index.astro (and every other page)
import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Home • MikesBlogDesign</title>
<link rel="stylesheet" href="/styles/global.css" />
</head>
<body>
<Header />
<main>
<h1>Welcome back</h1>
<!-- Only unique content here from now on -->
</main>
<Footer />
</body>
</html>
Pro tip: Open Cursor → select all .astro files → type “replace the raw header and footer HTML with