Implementation Guide: Meta Description Fix

Complete step-by-step walkthrough for fixing 558 duplicate meta descriptions using FREE Google Gemini Flash API.


📋 Pre-Implementation Checklist

Before starting, verify:


Phase 1: Setup (5 minutes)

Step 1.1: Get FREE API Key

  1. Visit: https://makersuite.google.com/app/apikey
  2. Sign in with Google account
  3. Click: "Create API Key"
  4. Copy the key (format: AIza...)
  5. Save somewhere safe temporarily

No credit card required. Completely FREE forever.

Step 1.2: Install Dependencies

Open PowerShell in C:\dev\itblogpros\:

cd C:\dev\itblogpros
npm install @google/generative-ai gray-matter fs-extra

Expected output:

added 15 packages in 8s

Step 1.3: Configure API Key

Option A: Environment Variable (Recommended)

PowerShell:

$env:GEMINI_API_KEY="your-api-key-here"

CMD:

set GEMINI_API_KEY=your-api-key-here

Option B: Hardcode in Script

Edit generate-meta-descriptions-gemini.js line 28:

const genAI = new GoogleGenerativeAI('AIza_your_key_here');

Step 1.4: Verify Setup

node generate-meta-descriptions-gemini.js --test

Expected: Processes one post successfully.


Phase 2: Validation (2 minutes)

Step 2.1: Check Current State

node validate-meta-descriptions.js

Expected output:

Validating 558 posts...

❌ Missing descriptions: 0
⚠️  Using default description: 300+
⚠️  Duplicate descriptions: 558

Total issues: 858

Step 2.2: Check URL Duplicates

node check-url-duplicates.js

Expected: Shows URL pattern issues.


Phase 3: Test Run (3 minutes)

Step 3.1: Single Post Test

node generate-meta-descriptions-gemini.js --test

Expected output:

[2025-11-28T10:30:00.000Z] Meta Description Generator v2.0 - Started
[2025-11-28T10:30:00.100Z] TEST MODE: Processing single post

[2025-11-28T10:30:05.200Z] [1/1] Processing: 2025-01-15-wifi-7.md
[2025-11-28T10:30:05.800Z] API call 1: Generating for "WiFi 7 vs WiFi 6..."
[2025-11-28T10:30:07.200Z] ✓ Generated (145 chars): Discover if WiFi 7...
[2025-11-28T10:30:07.300Z] [DRY RUN] Would update: 2025-01-15-wifi-7.md

✓ Successfully generated: 1
⊘ Skipped: 0
✗ Errors: 0

Verify:

Step 3.2: Preview 10 Posts

node generate-meta-descriptions-gemini.js --limit=10

Expected: Processes 10 posts in ~1 minute (dry run).

Check quality:

Step 3.3: Test Write Mode

node generate-meta-descriptions-gemini.js --test --write

Expected: Actually updates one post file.

Verify file changed:

Get-Content posts\2025-01-15-wifi-7-vs-wifi-6.md | Select-String "description"

Phase 4: Full Generation (12 minutes)

Step 4.1: Backup (Optional but Recommended)

Copy-Item -Path posts -Destination posts-backup-$(Get-Date -Format 'yyyy-MM-dd') -Recurse

Step 4.2: Run Full Generation

node generate-meta-descriptions-gemini.js --write

Expected:

Console output:

[2025-11-28T10:30:00.000Z] Processing 558 posts...

[2025-11-28T10:30:05.200Z] [1/558] Processing: 2025-01-15-wifi-7.md
[2025-11-28T10:30:07.300Z] ✓ Updated: 2025-01-15-wifi-7.md

[2025-11-28T10:30:12.800Z] [2/558] Processing: 2025-01-16-smart-home.md
[2025-11-28T10:30:13.500Z] ⊘ Skipped - already has good description

[2025-11-28T10:35:00.000Z] Checkpoint saved: 50 posts completed

... continues ...

[2025-11-28T10:42:00.000Z] SUMMARY
[2025-11-28T10:42:00.000Z] ✓ Successfully generated: 408
[2025-11-28T10:42:00.000Z] ⊘ Skipped: 150
[2025-11-28T10:42:00.000Z] ✗ Errors: 0
[2025-11-28T10:42:00.000Z] 💰 Cost: $0.00

Step 4.3: Monitor Progress

Watch for:

If interrupted:

node generate-meta-descriptions-gemini.js --resume --write

Phase 5: Validation (2 minutes)

Step 5.1: Validate Results

node validate-meta-descriptions.js

Expected output:

Validating 558 posts...

✅ All meta descriptions are valid!
Total issues: 0

Step 5.2: Spot Check Quality

View sample descriptions:

Get-Content posts\2025-01-15-wifi-7-vs-wifi-6.md | Select-String "description"
Get-Content posts\2025-01-16-ai-home-assistants.md | Select-String "description"
Get-Content posts\2021-03-23-improve-virgin-media-wifi.md | Select-String "description"

Verify:


Phase 6: Fix URL Duplicates (5 minutes)

CRITICAL: This prevents future duplicate issues.

Step 6.1: Update posts/posts.json

Edit C:\dev\itblogpros\posts\posts.json:

{
  "layout": "layout.njk",
  "tags": "post",
  "permalink": "/posts/IMPLEMENTATION-GUIDE-GEMINI/"
}

Step 6.2: Create _redirects File

Create C:\dev\itblogpros\_redirects:

/2025/:month/:day/*  /posts/2025-:month-:day-:splat 301
/2024/:month/:day/*  /posts/2024-:month-:day-:splat 301
/2023/:month/:day/*  /posts/2023-:month-:day-:splat 301
/2022/:month/:day/*  /posts/2022-:month-:day-:splat 301
/2021/:month/:day/*  /posts/2021-:month-:day-:splat 301
/priority-meta-backups/*  /posts/:splat 301

Step 6.3: Update .eleventy.js

Add to .eleventy.js:

// Copy _redirects to output
eleventyConfig.addPassthroughCopy("_redirects");

Step 6.4: Rebuild Site

npx @11ty/eleventy

Verify _redirects copied:

Test-Path _site\_redirects
# Should return: True

Step 6.5: Test Redirects

After deployment, test old URLs redirect to new:


Phase 7: Deployment (3 minutes)

Step 7.1: Commit Changes

git status
git add .
git commit -m "Fix: Generated unique meta descriptions for all 558 posts + URL consolidation"

Step 7.2: Push to Trigger Deploy

git push origin main

Expected: Cloudflare Pages auto-deploys.

Step 7.3: Verify Deployment

  1. Visit itblogpros.com
  2. View page source of a few posts
  3. Verify unique meta descriptions
  4. Test a redirect URL

Phase 8: SEO Submission (2 minutes)

Step 8.1: Generate New Sitemap

Site should auto-generate, or manually:

npx @11ty/eleventy

Step 8.2: Submit to Bing

  1. Visit: https://www.bing.com/webmasters
  2. Go to Sitemaps
  3. Submit: https://itblogpros.com/sitemap.xml
  4. Click "Submit"

Step 8.3: Request Re-Index

In Bing Webmaster Tools:


Troubleshooting Guide

Issue: "Cannot find module"

Solution:

npm install @google/generative-ai gray-matter fs-extra

Issue: "API key not set"

Solution:

$env:GEMINI_API_KEY="your-key-here"

Or edit line 28 in script.

Issue: "Rate limit exceeded"

Solution: Script handles automatically. If persists:

  1. Wait 1 hour
  2. Check API key status
  3. Resume with --resume --write

Issue: Script stops with errors

Solution:

  1. Check meta-generation.log for details
  2. Fix root cause
  3. Resume: node generate-meta-descriptions-gemini.js --resume --write

Issue: Descriptions too generic

Solution:

  1. Check article content quality
  2. Verify post has substantial content (>500 words)
  3. Manually improve poor descriptions

Issue: Progress file corrupted

Solution:

del .meta-generation-progress.json
node generate-meta-descriptions-gemini.js --write

Starts fresh. Safe to do.


Expected Timeline

Phase Time Activity
Setup 5 min API key + dependencies
Validation 2 min Check current state
Test Run 3 min Verify quality
Generation 12 min Process all 558 posts
Validation 2 min Verify results
URL Fix 5 min Consolidate URLs
Deploy 3 min Commit + push
SEO 2 min Submit sitemap
Total 34 min End-to-end

Actual processing: 12 minutes
Setup/validation: 22 minutes
Cost: $0.00


Success Criteria

Immediate:

Week 1:

Month 1:


What to Monitor

Daily (Week 1):

Weekly (Month 1):

Monthly (Ongoing):


Need Help?

Review:

Check:


🎉 You're ready to implement! Follow these steps in order, and you'll have 558 unique, SEO-optimized meta descriptions in about 34 minutes total (12 minutes of actual processing).

Cost: $0.00 | Impact: Moderate to Significant | Difficulty: Easy