Astro CMS + Markdown + SEO: Building Content Projects Without WordPress
Astro isn’t just a static site generator—it’s a powerful CMS alternative for building fast, SEO-optimized content websites using Markdown, MDX, or a headless CMS. In this article, we’ll dive into how you can build a modern content platform that rivals WordPress without compromising SEO.
🏗️ Architecture: Astro + Markdown + MDX
Astro’s content-driven architecture allows developers to manage articles with .md and .mdx files using Content Collections. Each file includes frontmatter, which serves as a source of dynamic metadata and structure.
---
title: "Astro vs WordPress"
description: "A comparison of static vs dynamic CMS approaches"
publishDate: 2025-07-01
tags: ["Astro", "WordPress", "SEO"]
ogImage: "/images/astro-vs-wp.png"
---
Use these values across pages, layouts, and <head> for seamless SEO integration.
🧠 Dynamic Metadata From Frontmatter
Astro makes it easy to dynamically insert metadata like:
<!-- src/layouts/BlogPost.astro -->
---
const { title, description, ogImage } = Astro.props;
---
<head>
<title>{title}</title>
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={ogImage} />
</head>
This guarantees accurate, page-specific SEO tags—essential for ranking.
🗺️ Automating sitemap.xml and robots.txt
Use official integrations for automation:
npm install @astrojs/sitemap
// astro.config.mjs
import sitemap from "@astrojs/sitemap";
export default {
site: "https://yourdomain.com",
integrations: [sitemap()],
};
For robots.txt, create a static file:
User-agent: *
Allow: /
Sitemap: https://yourdomain.com/sitemap-index.xml
📦 Best Practices: schema.org Markup (JSON-LD)
Structured data helps search engines understand your content:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "{title}",
"description": "{description}",
"datePublished": "{publishDate}",
"author": {
"@type": "Person",
"name": "Adam Walker"
}
}
</script>
Place it inside your article or layout template conditionally.
🌐 Using Headless CMS: Sanity, Contentful & More
Astro works well with headless CMSs such as:
- Sanity.io
- Contentful
- Strapi
- DatoCMS
Fetch content using APIs and map data to Astro props. For example:
const res = await fetch('https://cdn.contentful.com/...');
const data = await res.json();
Dynamic metadata can still be injected the same way:
<title>{data.title}</title>
<meta name="description" content={data.description} />
SEO Impact:
✅ Centralized content
✅ Better control over structured data
✅ Easier translation & scaling
❗ Slight increase in TTFB (can be mitigated with caching or static builds)
✅ Conclusion
Astro offers the power and flexibility of a CMS—without the bloat of WordPress. By combining Markdown or headless CMS with automated metadata and SEO best practices, you can build scalable content platforms that rank high and load fast.
Whether you prefer .mdx or a fully decoupled CMS like Sanity, Astro empowers SEO-first development without compromise.