# SEO Stufe 2 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Statisches GitLab-Pages-Portfolio mit SEO-Grundgerüst (sitemap.xml, robots.txt), seitenspezifischen Titles/Descriptions, Canonical + Open Graph und JSON-LD-strukturierten Daten (LocalBusiness, Person, BreadcrumbList, ImageObject, Service) auf allen 21 Seiten ausstatten — mit zentralem Domain-Platzhalter für den späteren Wechsel auf `leon-tonhaeuser.de`.
**Architecture:** Vier neue Dateien (zwei JS-Module, sitemap.xml, robots.txt) + zwei `` ein:
```html
```
(Anführungszeichen und Einrückung wie umgebende Zeilen — Tab-Einrückung in `index.html` ist Tab.)
Verwende in dieser Datei Tab-Einrückung, da `index.html` Tab-eingerückt ist.
- [ ] **Step 3: Validierung**
Run:
```bash
grep -n 'seo-config.js\|seo.js' public/index.html
```
Expected: Zwei Zeilen mit den neuen Includes.
- [ ] **Step 4: Committen**
```bash
git add public/index.html
git commit -m "feat: SEO-Script-Includes auf Startseite"
```
---
## Task 6: SEO-Includes auf 15 weiteren Hauptseiten einbauen
**Files:**
- Modify: 15 HTML-Dateien (alle außer `index.html`, `404.html` und archiv-Dateien)
Betroffen:
- `public/portfolio.html`
- `public/portfolio-aufstiegsfeier.html`
- `public/portfolio-frauen-bundesliga.html`
- `public/portfolio-hamburger-sv.html`
- `public/portfolio-rhine-ruhr-3x3.html`
- `public/portfolio-rhine-ruhr-basketball.html`
- `public/portfolio-rhine-ruhr-beachvolleyball.html`
- `public/portfolio-rhine-ruhr-sport.html`
- `public/portfolio-svg-lueneburg.html`
- `public/leistungen.html`
- `public/über-mich.html`
- `public/kontakt.html`
- `public/datenschutz.html`
- `public/impressum.html`
- `public/blog.html`
- [ ] **Step 1: Include-Pattern pro Datei finden**
Run:
```bash
grep -n 'custom/transitions.js' public/portfolio.html public/portfolio-aufstiegsfeier.html public/portfolio-frauen-bundesliga.html public/portfolio-hamburger-sv.html public/portfolio-rhine-ruhr-3x3.html public/portfolio-rhine-ruhr-basketball.html public/portfolio-rhine-ruhr-beachvolleyball.html public/portfolio-rhine-ruhr-sport.html public/portfolio-svg-lueneburg.html public/leistungen.html public/über-mich.html public/kontakt.html public/datenschutz.html public/impressum.html public/blog.html
```
Expected: Pro Datei genau eine Zeile.
- [ ] **Step 2: Pro Datei Include ergänzen (sed-Befehl für jede Datei)**
Diese 15 Dateien sind Tab-eingerückt. Führe aus:
```bash
for f in public/portfolio.html public/portfolio-aufstiegsfeier.html public/portfolio-frauen-bundesliga.html public/portfolio-hamburger-sv.html public/portfolio-rhine-ruhr-3x3.html public/portfolio-rhine-ruhr-basketball.html public/portfolio-rhine-ruhr-beachvolleyball.html public/portfolio-rhine-ruhr-sport.html public/portfolio-svg-lueneburg.html public/leistungen.html public/über-mich.html public/kontakt.html public/datenschutz.html public/impressum.html public/blog.html; do
python3 -c "
import sys, re
p = '$f'
with open(p, 'r', encoding='utf-8') as fh:
content = fh.read()
# Suche die Zeile mit custom/transitions.js, ersetze durch Block + zwei neue Zeilen
new_content = re.sub(
r'(\t?)()',
r'\1\2\n\1\n\1',
content,
count=1
)
if new_content == content:
print(f'NO MATCH in {p}', file=sys.stderr)
sys.exit(1)
with open(p, 'w', encoding='utf-8') as fh:
fh.write(new_content)
print(f'OK {p}')
"
done
```
Expected: 15 Zeilen mit `OK `.
- [ ] **Step 3: Validierung pro Datei**
Run:
```bash
for f in public/portfolio.html public/portfolio-aufstiegsfeier.html public/portfolio-frauen-bundesliga.html public/portfolio-hamburger-sv.html public/portfolio-rhine-ruhr-3x3.html public/portfolio-rhine-ruhr-basketball.html public/portfolio-rhine-ruhr-beachvolleyball.html public/portfolio-rhine-ruhr-sport.html public/portfolio-svg-lueneburg.html public/leistungen.html public/über-mich.html public/kontakt.html public/datenschutz.html public/impressum.html public/blog.html; do
c=$(grep -c 'seo-config.js\|seo.js' "$f")
if [ "$c" != "2" ]; then echo "FAIL $f: $c includes"; else echo "OK $f"; fi
done
```
Expected: 15× `OK `.
- [ ] **Step 4: Committen**
```bash
git add public/portfolio.html public/portfolio-aufstiegsfeier.html public/portfolio-frauen-bundesliga.html public/portfolio-hamburger-sv.html public/portfolio-rhine-ruhr-3x3.html public/portfolio-rhine-ruhr-basketball.html public/portfolio-rhine-ruhr-beachvolleyball.html public/portfolio-rhine-ruhr-sport.html public/portfolio-svg-lueneburg.html public/leistungen.html public/über-mich.html public/kontakt.html public/datenschutz.html public/impressum.html public/blog.html
git commit -m "feat: SEO-Script-Includes auf 15 Hauptseiten"
```
---
## Task 7: SEO-Includes auf 404.html + archiv-Seiten einbauen
**Files:**
- Modify: 5 Dateien (unterschiedliche Einrückung als Tab-Dateien)
Betroffen:
- `public/404.html` (custom-Include in Wurzel: `custom/...`)
- `public/archiv/frauen-bundesliga.html` (Include in Unterordner: `../custom/...`)
- `public/archiv/hamburger-sv.html`
- `public/archiv/hsv-bundesliga.html`
- `public/archiv/svg-luenburg.html`
- [ ] **Step 1: 404.html ergänzen (root-relativ)**
```bash
python3 -c "
import re
p = 'public/404.html'
with open(p, 'r', encoding='utf-8') as fh: content = fh.read()
new_content = re.sub(
r'(\t?)()',
r'\1\2\n\1\n\1',
content, count=1
)
if new_content == content: raise SystemExit('no match')
with open(p, 'w', encoding='utf-8') as fh: fh.write(new_content)
print('OK')
"
```
Expected: `OK`.
- [ ] **Step 2: archiv-Dateien ergänzen (relativ `../`)**
```bash
for f in public/archiv/frauen-bundesliga.html public/archiv/hamburger-sv.html public/archiv/hsv-bundesliga.html public/archiv/svg-luenburg.html; do
python3 -c "
import re
p = '$f'
with open(p, 'r', encoding='utf-8') as fh: content = fh.read()
new_content = re.sub(
r'(\t?)()',
r'\1\2\n\1\n\1',
content, count=1
)
if new_content == content: raise SystemExit('no match in $f')
with open(p, 'w', encoding='utf-8') as fh: fh.write(new_content)
print('OK $f')
"
done
```
Expected: 4× `OK `.
- [ ] **Step 3: Validierung**
Run:
```bash
for f in public/404.html public/archiv/frauen-bundesliga.html public/archiv/hamburger-sv.html public/archiv/hsv-bundesliga.html public/archiv/svg-luenburg.html; do
c=$(grep -cE 'seo-config\.js|seo\.js' "$f")
if [ "$c" != "2" ]; then echo "FAIL $f: $c"; else echo "OK $f"; fi
done
```
Expected: 5× `OK `.
- [ ] **Step 4: Committen**
```bash
git add public/404.html public/archiv/frauen-bundesliga.html public/archiv/hamburger-sv.html public/archiv/hsv-bundesliga.html public/archiv/svg-luenburg.html
git commit -m "feat: SEO-Script-Includes auf 404 + archiv-Seiten"
```
---
## Task 8: Smoke-Test aller 21 Seiten
- [ ] **Step 1: Server starten**
```bash
lsof -ti:8002 | xargs -r kill -9 2>/dev/null; sleep 0.3
(npx --yes serve -p 8002 public > /tmp/seo-serve.log 2>&1 & echo $! > /tmp/seo-serve.pid)
sleep 4
```
Expected: Server läuft auf Port 8002.
- [ ] **Step 2: Alle 21 URLs prüfen**
```bash
fail=0
for p in / /portfolio /portfolio-aufstiegsfeier /portfolio-frauen-bundesliga /portfolio-hamburger-sv /portfolio-rhine-ruhr-3x3 /portfolio-rhine-ruhr-basketball /portfolio-rhine-ruhr-beachvolleyball /portfolio-rhine-ruhr-sport /portfolio-svg-lueneburg /leistungen /%C3%BCber-mich /kontakt /datenschutz /impressum /blog /404 /archiv/frauen-bundesliga /archiv/hamburger-sv /archiv/hsv-bundesliga /archiv/svg-luenburg; do
code=$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:8002$p")
if [ "$code" != "200" ]; then echo "FAIL $p → $code"; fail=1; fi
done
exit $fail
```
Expected: Exit-Code `0`, keine FAIL-Zeilen.
- [ ] **Step 3: SEO-Skripte sind erreichbar**
```bash
for s in /custom/seo-config.js /custom/seo.js; do
code=$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:8002$s")
echo "$s → $code"
done
```
Expected: Beide `→ 200`.
- [ ] **Step 4: Meta-Tags auf Startseite prüfen**
```bash
curl -s http://localhost:8002/ | grep -E 'seo-config\.js|seo\.js'
```
Expected: Beide Dateinamen erscheinen im HTML.
- [ ] **Step 5: Server stoppen**
```bash
kill -9 "$(cat /tmp/seo-serve.pid)" 2>/dev/null
lsof -ti:8002 | xargs -r kill -9 2>/dev/null
echo done
```
Expected: `done`.
---
## Task 9: Headless-Render-Test für JSON-LD-Injektion
**Files:**
- Create: `/tmp/seo-headless-test.mjs` (lokal, nicht ins Repo committen)
- [ ] **Step 1: Test-Script schreiben**
Inhalt der Datei `/tmp/seo-headless-test.mjs`:
```js
import puppeteer from 'puppeteer';
import { spawn } from 'node:child_process';
import { setTimeout as wait } from 'node:timers/promises';
const PORT = 8003;
const server = spawn('npx', ['--yes', 'serve', '-p', String(PORT), 'public'], { stdio: 'ignore' });
await wait(4000);
try {
const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
const tests = [
{ path: '/', expectTitle: 'Sportfotografie aus Uelzen', expectJsonLd: 'seo-person-business' },
{ path: '/portfolio-rhine-ruhr-basketball', expectTitle: 'Rhine-Ruhr 2025 – Basketball', expectJsonLd: 'seo-image' },
{ path: '/leistungen', expectTitle: 'Leistungen | Leon Tonhäuser', expectJsonLd: 'seo-service' }
];
let failures = 0;
for (const t of tests) {
const page = await browser.newPage();
await page.goto(`http://localhost:${PORT}${t.path}`, { waitUntil: 'networkidle0' });
const title = await page.title();
const hasLd = await page.evaluate(id => !!document.getElementById(id), t.expectJsonLd);
const ok = title.includes(t.expectTitle) && hasLd;
console.log(`${ok ? 'OK' : 'FAIL'} ${t.path}: title="${title}" ld=${hasLd}`);
if (!ok) failures++;
await page.close();
}
await browser.close();
if (failures > 0) process.exit(1);
} finally {
server.kill('SIGKILL');
}
```
- [ ] **Step 2: Server temporär stoppen falls aktiv, dann Test starten**
```bash
lsof -ti:8003 | xargs -r kill -9 2>/dev/null
node /tmp/seo-headless-test.mjs
```
Expected: 3× `OK :` und Exit-Code `0`.
Falls Puppeteer fehlt: `npm install --no-save puppeteer` einmalig lokal ausführen.
- [ ] **Step 3: Test-Script aufräumen**
```bash
rm /tmp/seo-headless-test.mjs
```
- [ ] **Step 4: Test-Ergebnis in Commit-Message dokumentieren (kein neuer Commit nötig)**
---
## Task 10: Push und Branch-Status finalisieren
- [ ] **Step 1: Alle Änderungen pushen**
```bash
git status --short
git push origin feature/site-redesign
```
Expected: Push erfolgreich, alle neuen Dateien sind auf `origin/feature/site-redesign`.
- [ ] **Step 2: Branch-Status ausgeben**
```bash
git log --oneline main..HEAD
```
Expected: Liste der Commits aus Tasks 1–7 (6 SEO-Commits + ggf. vorherige).
- [ ] **Step 3: Hand-Off an Leon**
Antwort an Leon mit:
- Liste der 6 neuen/geänderten Dateien
- Hinweis: `https://search.google.com/test/rich-results` gegen `/` und `/portfolio-rhine-ruhr-basketball` testen
- Hinweis: Domain-Wechsel = 1 Variable (`SITE_URL`) in `seo-config.js` ersetzen
- Hinweis: Stufe 3 (Content-Tuning) wartet, bis regelmäßig neue Inhalte produziert werden
---
## Self-Review
**Spec-Coverage:**
- §2 (Umfang): Tasks 1–7 abgedeckt ✓
- §3 (Architektur): Domain-Platzhalter in Task 1 ✓
- §4.1 (seo-config.js): Task 1 ✓
- §4.2 (seo.js): Task 2 ✓
- §4.3 (sitemap.xml): Task 4 ✓
- §4.4 (robots.txt): Task 3 ✓
- §5 (Title + Desc pro Seite): Page-Map in Task 1 ✓
- §6.1 (ProfessionalService + Person): Task 2 `personBusinessGraph` ✓
- §6.2 (BreadcrumbList): Task 2 `breadcrumbListGraph` ✓
- §6.3 (ImageObject): Task 2 `imageObjectGraph` ✓
- §6 Service (Bonus): Task 2 `serviceGraph` ✓
- §7 Tests: Tasks 8 + 9 ✓
- §8 Rollout: Task 10 ✓
- §9 Risiken: Idempotenz-Marker in Task 2 (`data-seo-injected`), try/catch ✓; OG-Bild-Auswahl in Task 1 dokumentiert ✓; Reihenfolge in Plan klar ✓
**Placeholder-Scan:** Keine "TBD"/"TODO"/"ähnlich wie"-Platzhalter. Alle Code-Blöcke sind vollständig.
**Type-Konsistenz:** `cfg` / `page` / `biz` / `setMeta(name, content, attr)` / `setLink(rel, href)` / `injectJsonLd(id, data)` werden in Task 2 definiert und nur dort verwendet. Konsistent.
**Spec-Lücken:** Keine. Alle 11 Spec-Sektionen haben mindestens einen Task.