The Developer’s Guide to Blog SEO
Most “SEO guides” are written for marketers. They tell you to “write quality content” and “build backlinks.” Thanks, very helpful.
This guide is different. This is the technical implementation guide for developers who want their blog to rank. We’re going to cover the actual code changes, structured data schemas, and server configurations that make Google love your site.
I recently overhauled the SEO on this very blog. Here’s everything I learned.
The SEO Stack: What Actually Matters
Before diving into code, understand the hierarchy of SEO factors:
- Technical SEO (40%) - Can Google crawl and understand your site?
- Content Quality (30%) - Is your content genuinely useful?
- Backlinks (20%) - Do other sites vouch for you?
- User Experience (10%) - Core Web Vitals, mobile-friendliness
Most developers ignore #1 and wonder why their brilliant content doesn’t rank. Let’s fix that.
1. Metadata: The Foundation
Every page needs these meta tags in the <head>:
<!-- Primary Meta Tags -->
<title>Your Page Title | Site Name</title>
<meta name="description" content="A compelling 150-160 character description">
<meta name="author" content="Your Name">
<meta name="keywords" content="keyword1, keyword2, keyword3">
<!-- Canonical URL (prevents duplicate content) -->
<link rel="canonical" href="https://yoursite.com/exact-page-url">
<!-- Robots directive -->
<meta name="robots" content="index, follow, max-image-preview:large">
Key Rules:
- Title: Keep under 60 characters. Include your primary keyword.
- Description: 150-160 characters. This appears in search results.
- Canonical: Always self-referential. Never point pagination pages to page 1.
2. Open Graph & Twitter Cards
When someone shares your post on social media, these tags control what appears:
<!-- Open Graph (Facebook, LinkedIn, Discord) -->
<meta property="og:type" content="article">
<meta property="og:url" content="https://yoursite.com/post-url">
<meta property="og:title" content="Your Post Title">
<meta property="og:description" content="Post description">
<meta property="og:image" content="https://yoursite.com/og-image.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<!-- Article-specific (for blog posts) -->
<meta property="article:published_time" content="2025-01-15T10:00:00Z">
<meta property="article:modified_time" content="2025-01-16T14:30:00Z">
<meta property="article:author" content="https://yoursite.com/about">
<meta property="article:section" content="Technology">
<meta property="article:tag" content="SEO">
<meta property="article:tag" content="Web Development">
<!-- Twitter Cards -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@yourhandle">
<meta name="twitter:title" content="Your Post Title">
<meta name="twitter:image" content="https://yoursite.com/og-image.png">
Pro Tip: Your OG image should be exactly 1200x630 pixels. Use a tool like og-image.vercel.app to generate them dynamically.
3. JSON-LD Structured Data (The Secret Weapon)
This is where most blogs fail. Structured data tells Google exactly what type of content you have. It enables Rich Results (those fancy search snippets with ratings, dates, and author photos).
BlogPosting Schema
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "Organization",
"@id": "https://yoursite.com/#organization",
"name": "Your Site Name",
"url": "https://yoursite.com",
"logo": {
"@type": "ImageObject",
"url": "https://yoursite.com/logo.png"
}
},
{
"@type": "Person",
"@id": "https://yoursite.com/#author",
"name": "Your Name",
"url": "https://yoursite.com/about"
},
{
"@type": "BlogPosting",
"@id": "https://yoursite.com/post-url#article",
"headline": "Your Post Title",
"description": "Post description",
"image": "https://yoursite.com/post-image.jpg",
"datePublished": "2025-01-15T10:00:00Z",
"dateModified": "2025-01-16T14:30:00Z",
"author": { "@id": "https://yoursite.com/#author" },
"publisher": { "@id": "https://yoursite.com/#organization" },
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://yoursite.com/post-url"
},
"wordCount": 1500,
"articleSection": "Technology",
"keywords": "SEO, blogging, web development"
}
]
}
</script>
Why @graph?
Using @graph creates entity relationships. Google understands that the author who wrote this post is the same person across your entire site. This builds topical authority.
Validate Your Schema
Always test at Google’s Rich Results Test. If there are errors, Google won’t show rich snippets.
4. Sitemap Optimization
Your sitemap tells search engines what pages exist and their relative importance.
Priority Guidelines:
| Page Type | Priority | Change Frequency |
|---|---|---|
| Homepage | 1.0 | Daily |
| Blog Posts | 0.9 | Weekly |
| Categories | 0.7 | Weekly |
| Tags | 0.6 | Weekly |
| Pagination | 0.5 | Weekly |
| Static Pages | 0.4 | Monthly |
Example Sitemap Entry:
<url>
<loc>https://yoursite.com/blog/seo-guide</loc>
<lastmod>2025-01-16T14:30:00Z</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
Critical: Always include
<lastmod>. It signals freshness to crawlers. Update it whenever you modify content.
5. Robots.txt: Controlling Crawlers
A proper robots.txt prevents crawl budget waste:
User-agent: *
Allow: /
# Block build artifacts
Disallow: /_astro/
Disallow: /node_modules/
Disallow: /.git/
# Block query strings (prevents duplicate content)
Disallow: /*?*
# Allow sitemap explicitly
Allow: /sitemap.xml
Sitemap: https://yoursite.com/sitemap.xml
Block Aggressive Bots
User-agent: AhrefsBot
Crawl-delay: 10
User-agent: SemrushBot
Crawl-delay: 10
User-agent: MJ12bot
Disallow: /
These SEO tool bots can hammer your server. Rate-limit them.
6. Pagination SEO
If your blog has pagination, you need special handling:
<!-- On page 2 -->
<link rel="canonical" href="https://yoursite.com/page/2">
<link rel="prev" href="https://yoursite.com/">
<link rel="next" href="https://yoursite.com/page/3">
Rules:
- Each page should be self-canonical (NOT pointing to page 1)
- Use
rel="prev"andrel="next"to show relationships - Create unique descriptions: “Page 2 of 10 - Browse more articles…”
- Redirect
/page/1to/(prevents duplicate content)
7. URL Hygiene
Clean URLs rank better and are more shareable.
Bad URLs:
/categories/Web%20Development
/tags/C++
/blog?id=123
Good URLs:
/categories/web-development
/tags/cpp
/blog/how-to-do-seo
Use a slugify() function to convert names:
function slugify(text: string): string {
return text
.toLowerCase()
.trim()
.replace(/[\s_]+/g, '-')
.replace(/[^\w\-]+/g, '')
.replace(/\-\-+/g, '-');
}
8. Security Headers (Yes, They Affect SEO)
Google considers security a ranking factor. Add these headers:
{
"headers": [
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "SAMEORIGIN" },
{ "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" },
{ "key": "Strict-Transport-Security", "value": "max-age=63072000; includeSubDomains; preload" }
]
}
HTTPS is mandatory in 2025. No exceptions.
9. Core Web Vitals
Google measures three key metrics:
- LCP (Largest Contentful Paint): < 2.5s
- FID (First Input Delay): < 100ms
- CLS (Cumulative Layout Shift): < 0.1
Quick Wins:
- Use next-gen image formats (WebP, AVIF)
- Add
widthandheightto all images (prevents CLS) - Lazy-load below-the-fold images
- Preconnect to external domains
- Use a CDN (Vercel, Cloudflare)
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="dns-prefetch" href="https://www.google-analytics.com">
10. The Checklist
Before publishing any blog post:
- Title under 60 characters with primary keyword
- Meta description 150-160 characters
- Self-referential canonical URL
- OG image set (1200x630)
- JSON-LD BlogPosting schema
- Only ONE
<h1>on the page - All images have
alttext - Internal links to related posts
- External links to authoritative sources
- Mobile-responsive layout
Conclusion
SEO isn’t magic. It’s engineering.
The sites that rank well are the ones that make it easy for Google to understand their content. Every meta tag, every schema property, every clean URL is a signal that says “I know what I’m doing.”
Implement these changes, wait 2-4 weeks for Google to recrawl, and watch your impressions climb in Search Console.
Now go optimize something.
<FAQ items={[ { question: “How long does it take to see SEO results?”, answer: “Typically 2-4 weeks for Google to recrawl and reindex your pages. Significant ranking changes can take 2-3 months.” }, { question: “Do I need to pay for SEO tools?”, answer: “No. Google Search Console (free) gives you everything you need. Paid tools like Ahrefs are useful but not essential for a blog.” }, { question: “Is this guide specific to Astro?”, answer: “No. These principles apply to any static site generator or framework (Next.js, Hugo, Gatsby, etc.). The implementation details may vary slightly.” }, { question: “Should I submit my sitemap to Google?”, answer: “Yes. Go to Google Search Console > Sitemaps > Add your sitemap URL. This speeds up discovery of new content.” } ]} />