docs: SEO-Stufe-2 Implementierungsplan (10 Tasks, 6 Commits)
Aufgeteilt in SEO-Config + Injektor + sitemap/robots + 21 HTML-Includes + Smoke- und Headless-Test. Domain-Wechsel = 1 Variable. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
bf7e0905b3
commit
f16ffb6dd7
1 file changed
+864
@@ -0,0 +1,864 @@
|
|||||||
|
# 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 `<script>`-Includes pro HTML-Seite (21 Edits). Kein Build-Schritt. Framer-Export wird nicht angefasst. SEO-Injection läuft im Browser via DOMContentLoaded.
|
||||||
|
|
||||||
|
**Tech Stack:** Vanilla JS (kein Build, kein Framework), Schema.org JSON-LD, GitLab Pages Static Hosting. Bestehende `transitions.js` und `site.css` als Pattern-Vorlage für die `<script>`-Includes.
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- **Branch:** `feature/site-redesign` (nie direkt auf `main`).
|
||||||
|
- **Domain-Platzhalter:** `https://www.leon-tonhaeuser.de` — eine Quelle (`seo-config.js`), einmaliger Such-und-Ersetz beim Domain-Switch.
|
||||||
|
- **Keine Build-Tools:** Plain HTML/JS/CSS, alles wird statisch deployed.
|
||||||
|
- **Framer-Export tabu:** Bestehende `<meta>`-Tags von Framer bleiben unangetastet, neue Tags werden via JS injiziert (vermeidet Re-Render-Konflikte).
|
||||||
|
- **Datumsformat:** ISO 8601 für `lastmod` (`YYYY-MM-DD`).
|
||||||
|
- **Commit-Sprache:** Deutsch, Imperativ, Conventional-Commits-Präfix (`feat:`, `fix:`, `docs:`, `chore:`).
|
||||||
|
- **Keine Tests-Framework:** Verifikation über curl, Lighthouse und grep.
|
||||||
|
- **Sprache:** Deutsch (`<html lang="de">` bereits gesetzt).
|
||||||
|
- **JSON-LD-Injection muss idempotent sein** via Marker `data-seo-injected="true"`.
|
||||||
|
- **Telefon-Format:** Schema-konform `+49-162-5434418`. Quelle: `public/impressum.html:98`.
|
||||||
|
- **E-Mail:** `mail@leon-tonhaeuser.de`. Quelle: `public/impressum.html:100`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
| Datei | Verantwortlichkeit |
|
||||||
|
|---|---|
|
||||||
|
| `public/custom/seo-config.js` | Zentrale Konfiguration: Domain, OG-Bild, Business-Daten, Page-Map (Title/Desc pro Pfad) |
|
||||||
|
| `public/custom/seo.js` | Injiziert Meta-Tags, Open Graph, Twitter Card und JSON-LD beim DOMContentLoaded |
|
||||||
|
| `public/sitemap.xml` | Liste aller indexierbaren URLs mit Priorität + lastmod |
|
||||||
|
| `public/robots.txt` | Crawler-Regeln + Sitemap-Verweis |
|
||||||
|
| `public/*.html` (16 Dateien) + `public/archiv/*.html` (4 Dateien) | Jeweils 2 `<script>`-Includes für `seo-config.js` + `seo.js` ergänzen |
|
||||||
|
|
||||||
|
**Modifizierte Dateien:**
|
||||||
|
- `public/index.html`
|
||||||
|
- `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`
|
||||||
|
- `public/404.html`
|
||||||
|
- `public/archiv/frauen-bundesliga.html`
|
||||||
|
- `public/archiv/hamburger-sv.html`
|
||||||
|
- `public/archiv/hsv-bundesliga.html`
|
||||||
|
- `public/archiv/svg-luenburg.html`
|
||||||
|
|
||||||
|
**Bestehende Dateien (NICHT modifiziert):** `public/custom/transitions.js`, `public/custom/tiefenflug.js`, `public/custom/site.css`, `public/custom/tiefenflug.css`, `public/assets/*`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task 1: SEO-Config-Modul anlegen
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `public/custom/seo-config.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `window.SEO_CONFIG` global mit Properties `SITE_URL`, `SITE_NAME`, `DEFAULT_DESCRIPTION`, `DEFAULT_OG_IMAGE`, `BUSINESS`, `PAGES`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Datei erstellen mit Domain-Platzhalter und Page-Map**
|
||||||
|
|
||||||
|
Inhalt der Datei `public/custom/seo-config.js`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Zentrale SEO-Konfiguration. EINZIGE Quelle für Domain-URL.
|
||||||
|
// Beim Domain-Wechsel: SITE_URL und alle Vorkommen in PAGES-/BUSINESS-Block ersetzen.
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
window.SEO_CONFIG = {
|
||||||
|
SITE_URL: 'https://www.leon-tonhaeuser.de',
|
||||||
|
SITE_NAME: 'Leon Tonhäuser | Sportfotograf',
|
||||||
|
DEFAULT_DESCRIPTION: 'Sportfotograf für regionale Sportevents in Uelzen, Lüneburg und Umgebung. Rhine-Ruhr 2025, Frauen-Bundesliga und mehr im Portfolio.',
|
||||||
|
DEFAULT_OG_IMAGE: '/assets/images_TjoYzMAQxwv1bHENgPbqipmQUU.png',
|
||||||
|
BUSINESS: {
|
||||||
|
name: 'Leon Tonhäuser Fotografie',
|
||||||
|
type: 'ProfessionalService',
|
||||||
|
telephone: '+49-162-5434418',
|
||||||
|
email: 'mail@leon-tonhaeuser.de',
|
||||||
|
addressLocality: 'Uelzen',
|
||||||
|
addressRegion: 'Niedersachsen',
|
||||||
|
addressCountry: 'DE',
|
||||||
|
areaServed: ['Uelzen', 'Lüneburg', 'Hamburg', 'Bad Bevensen', 'Winsen (Luhe)'],
|
||||||
|
priceRange: '€€'
|
||||||
|
},
|
||||||
|
PAGES: {
|
||||||
|
'/': {
|
||||||
|
title: 'Leon Tonhäuser | Sport- & Eventfotografie aus Uelzen',
|
||||||
|
desc: 'Sportfotograf für regionale Sportevents in Uelzen, Lüneburg und Hamburg. Rhine-Ruhr 2025, Frauen-Bundesliga und mehr im Portfolio. Jetzt anfragen.',
|
||||||
|
jsonld: ['person-business']
|
||||||
|
},
|
||||||
|
'/portfolio': {
|
||||||
|
title: 'Portfolio | Leon Tonhäuser — Sportfotograf',
|
||||||
|
desc: 'Portfolio von Leon Tonhäuser: Sportfotografie von Rhine-Ruhr 2025, Frauen-Bundesliga, Hamburg und regionalen Events. Eindrücke, Momente und Emotionen.',
|
||||||
|
jsonld: ['breadcrumb']
|
||||||
|
},
|
||||||
|
'/portfolio-aufstiegsfeier': {
|
||||||
|
title: 'Aufstiegsfeier | Leon Tonhäuser — Eventfotografie',
|
||||||
|
desc: 'Aufstiegsfeier fotografiert von Leon Tonhäuser. Emotionen, Jubel und der Moment des Erfolgs — Eventfotografie für Vereine und Veranstalter.',
|
||||||
|
jsonld: ['breadcrumb', 'imageobject']
|
||||||
|
},
|
||||||
|
'/portfolio-frauen-bundesliga': {
|
||||||
|
title: 'Frauen-Bundesliga | Leon Tonhäuser — Sportfotografie',
|
||||||
|
desc: 'Spielberichte und Momente aus der Frauen-Bundesliga. Sportfotografie von Leon Tonhäuser — authentisch, dynamisch, nah am Geschehen.',
|
||||||
|
jsonld: ['breadcrumb', 'imageobject']
|
||||||
|
},
|
||||||
|
'/portfolio-hamburger-sv': {
|
||||||
|
title: 'Hamburger SV | Leon Tonhäuser — Sportfotografie',
|
||||||
|
desc: 'Spielberichte und Emotionen rund um den Hamburger SV. Sportfotografie von Leon Tonhäuser aus Uelzen — für Vereine und Sponsoren.',
|
||||||
|
jsonld: ['breadcrumb', 'imageobject']
|
||||||
|
},
|
||||||
|
'/portfolio-rhine-ruhr-3x3': {
|
||||||
|
title: 'Rhine-Ruhr 2025 – 3×3 Basketball | Leon Tonhäuser',
|
||||||
|
desc: '3×3 Basketball vom Rhine-Ruhr 2025 Sports Event. Streetball, Dynamik, Teamgeist — fotografiert von Leon Tonhäuser.',
|
||||||
|
jsonld: ['breadcrumb', 'imageobject']
|
||||||
|
},
|
||||||
|
'/portfolio-rhine-ruhr-basketball': {
|
||||||
|
title: 'Rhine-Ruhr 2025 – Basketball | Leon Tonhäuser',
|
||||||
|
desc: 'Basketball-Shootings vom Rhine-Ruhr 2025 Sports Event. Professionelle Eventfotografie von Leon Tonhäuser.',
|
||||||
|
jsonld: ['breadcrumb', 'imageobject']
|
||||||
|
},
|
||||||
|
'/portfolio-rhine-ruhr-beachvolleyball': {
|
||||||
|
title: 'Rhine-Ruhr 2025 – Beachvolleyball | Leon Tonhäuser',
|
||||||
|
desc: 'Beachvolleyball vom Rhine-Ruhr 2025 Sports Event. Sand, Sonne, Dynamik — Sportfotografie von Leon Tonhäuser.',
|
||||||
|
jsonld: ['breadcrumb', 'imageobject']
|
||||||
|
},
|
||||||
|
'/portfolio-rhine-ruhr-sport': {
|
||||||
|
title: 'Rhine-Ruhr 2025 – Sportarten | Leon Tonhäuser',
|
||||||
|
desc: 'Impressionen vom Rhine-Ruhr 2025 Sports Event. Verschiedene Sportarten in einer Bildserie — fotografiert von Leon Tonhäuser.',
|
||||||
|
jsonld: ['breadcrumb', 'imageobject']
|
||||||
|
},
|
||||||
|
'/portfolio-svg-lueneburg': {
|
||||||
|
title: 'SVG Lüneburg | Leon Tonhäuser — Sportfotografie',
|
||||||
|
desc: 'Spielberichte und Momente der SVG Lüneburg. Sportfotografie von Leon Tonhäuser — regional, authentisch, leidenschaftlich.',
|
||||||
|
jsonld: ['breadcrumb', 'imageobject']
|
||||||
|
},
|
||||||
|
'/leistungen': {
|
||||||
|
title: 'Leistungen | Leon Tonhäuser — Sport- & Eventfotografie',
|
||||||
|
desc: 'Eventfotografie, Sportfotografie und Reportagefotografie — Leistungen für Vereine, Veranstalter und Unternehmen in Uelzen, Lüneburg und Hamburg.',
|
||||||
|
jsonld: ['person-business', 'service']
|
||||||
|
},
|
||||||
|
'/über-mich': {
|
||||||
|
title: 'Über mich | Leon Tonhäuser — Sportfotograf',
|
||||||
|
desc: 'Über Leon Tonhäuser: Sportfotograf aus Uelzen, tätig in Lüneburg, Hamburg und Niedersachsen. Leidenschaft für Sport, Events und Reportage.',
|
||||||
|
jsonld: ['person-business']
|
||||||
|
},
|
||||||
|
'/kontakt': {
|
||||||
|
title: 'Kontakt | Leon Tonhäuser — Sportfotograf',
|
||||||
|
desc: 'Kontakt zu Leon Tonhäuser — Sportfotograf für Uelzen, Lüneburg, Hamburg. Telefon 0162-5434418, E-Mail mail@leon-tonhaeuser.de, Anfrageformular.',
|
||||||
|
jsonld: ['person-business']
|
||||||
|
},
|
||||||
|
'/datenschutz': {
|
||||||
|
title: 'Datenschutzerklärung | Leon Tonhäuser',
|
||||||
|
desc: 'Datenschutzerklärung der Website von Leon Tonhäuser, Sportfotograf aus Uelzen.'
|
||||||
|
},
|
||||||
|
'/impressum': {
|
||||||
|
title: 'Impressum | Leon Tonhäuser',
|
||||||
|
desc: 'Impressum und Kontaktdaten von Leon Tonhäuser, Sportfotograf aus Uelzen.'
|
||||||
|
},
|
||||||
|
'/blog': {
|
||||||
|
title: 'Blog | Leon Tonhäuser',
|
||||||
|
desc: 'Blog von Leon Tonhäuser — bald mit Beiträgen über Shootings, Hintergründe und alles, was neben der Kamera passiert.'
|
||||||
|
},
|
||||||
|
'/404': {
|
||||||
|
title: '404 – Leider nichts gefunden | Leon Tonhäuser',
|
||||||
|
desc: 'Diese Seite existiert nicht (mehr). Zurück zur Startseite von Leon Tonhäuser, Sportfotograf aus Uelzen.'
|
||||||
|
},
|
||||||
|
'/archiv/frauen-bundesliga': {
|
||||||
|
title: 'Archiv: Frauen-Bundesliga | Leon Tonhäuser',
|
||||||
|
desc: 'Ältere Aufnahmen aus der Frauen-Bundesliga im Archiv von Leon Tonhäuser.'
|
||||||
|
},
|
||||||
|
'/archiv/hamburger-sv': {
|
||||||
|
title: 'Archiv: Hamburger SV | Leon Tonhäuser',
|
||||||
|
desc: 'Ältere Aufnahmen vom Hamburger SV im Archiv von Leon Tonhäuser.'
|
||||||
|
},
|
||||||
|
'/archiv/hsv-bundesliga': {
|
||||||
|
title: 'Archiv: HSV Bundesliga | Leon Tonhäuser',
|
||||||
|
desc: 'Ältere Aufnahmen aus der HSV-Bundesliga-Zeit im Archiv von Leon Tonhäuser.'
|
||||||
|
},
|
||||||
|
'/archiv/svg-luenburg': {
|
||||||
|
title: 'Archiv: SVG Lüneburg | Leon Tonhäuser',
|
||||||
|
desc: 'Ältere Aufnahmen der SVG Lüneburg im Archiv von Leon Tonhäuser.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Datei gegen Pflicht-Inhalt validieren**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
```bash
|
||||||
|
node -e "global.window={}; require('./public/custom/seo-config.js'); const c=global.window.SEO_CONFIG; ['SITE_URL','SITE_NAME','DEFAULT_DESCRIPTION','DEFAULT_OG_IMAGE','BUSINESS','PAGES'].forEach(k=>{if(!(k in c))throw new Error('missing '+k)}); if(Object.keys(c.PAGES).length!==21)throw new Error('PAGES: '+Object.keys(c.PAGES).length+' entries, expected 21'); console.log('OK')"
|
||||||
|
```
|
||||||
|
Expected: `OK`
|
||||||
|
|
||||||
|
- [ ] **Step 3: Committen**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add public/custom/seo-config.js
|
||||||
|
git commit -m "feat: SEO-Config-Modul mit Domain-Platzhalter und Page-Map"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task 2: SEO-Injektor-Modul anlegen
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `public/custom/seo.js`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `window.SEO_CONFIG` (aus Task 1)
|
||||||
|
- DOM-Targets: `<head>`, `<title>`, alle `<meta>`-Tags, fügt neue `<meta>`/`<link>`/`<script>` ein
|
||||||
|
- Marker-Attribut: `data-seo-injected="true"` zur Idempotenz
|
||||||
|
|
||||||
|
- [ ] **Step 1: Datei erstellen**
|
||||||
|
|
||||||
|
Inhalt der Datei `public/custom/seo.js`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// SEO-Injektor: setzt Title, Meta-Tags, Open Graph und JSON-LD.
|
||||||
|
// Läuft auf DOMContentLoaded, idempotent via data-seo-injected="true".
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
try {
|
||||||
|
if (document.documentElement.dataset.seoInjected === 'true') return;
|
||||||
|
var cfg = window.SEO_CONFIG;
|
||||||
|
if (!cfg) return;
|
||||||
|
|
||||||
|
function setMeta(name, content, attr) {
|
||||||
|
attr = attr || 'name';
|
||||||
|
if (!content) return;
|
||||||
|
var sel = 'meta[' + attr + '="' + name + '"]';
|
||||||
|
var el = document.head.querySelector(sel);
|
||||||
|
if (!el) {
|
||||||
|
el = document.createElement('meta');
|
||||||
|
el.setAttribute(attr, name);
|
||||||
|
document.head.appendChild(el);
|
||||||
|
}
|
||||||
|
el.setAttribute('content', content);
|
||||||
|
el.dataset.seoManaged = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLink(rel, href) {
|
||||||
|
if (!href) return;
|
||||||
|
var el = document.head.querySelector('link[rel="' + rel + '"]');
|
||||||
|
if (!el) {
|
||||||
|
el = document.createElement('link');
|
||||||
|
el.setAttribute('rel', rel);
|
||||||
|
document.head.appendChild(el);
|
||||||
|
}
|
||||||
|
el.setAttribute('href', href);
|
||||||
|
el.dataset.seoManaged = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
|
function injectJsonLd(id, data) {
|
||||||
|
if (document.getElementById(id)) return;
|
||||||
|
var s = document.createElement('script');
|
||||||
|
s.type = 'application/ld+json';
|
||||||
|
s.id = id;
|
||||||
|
s.textContent = JSON.stringify(data);
|
||||||
|
document.head.appendChild(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pfad normalisieren: trailing slash, .html, /index entfernen
|
||||||
|
var path = location.pathname.replace(/\/index\.html$/, '').replace(/\.html$/, '').replace(/\/$/, '') || '/';
|
||||||
|
var page = cfg.PAGES[path] || {};
|
||||||
|
var title = page.title || cfg.SITE_NAME;
|
||||||
|
var desc = page.desc || cfg.DEFAULT_DESCRIPTION;
|
||||||
|
var ogImage = cfg.DEFAULT_OG_IMAGE ? cfg.SITE_URL + cfg.DEFAULT_OG_IMAGE : '';
|
||||||
|
var canonical = cfg.SITE_URL + (path === '/' ? '/' : path);
|
||||||
|
|
||||||
|
document.title = title;
|
||||||
|
setMeta('description', desc);
|
||||||
|
setLink('canonical', canonical);
|
||||||
|
|
||||||
|
setMeta('og:title', title, 'property');
|
||||||
|
setMeta('og:description', desc, 'property');
|
||||||
|
setMeta('og:url', canonical, 'property');
|
||||||
|
setMeta('og:type', path === '/' ? 'website' : 'article', 'property');
|
||||||
|
setMeta('og:site_name', cfg.SITE_NAME, 'property');
|
||||||
|
if (ogImage) setMeta('og:image', ogImage, 'property');
|
||||||
|
|
||||||
|
setMeta('twitter:card', 'summary_large_image');
|
||||||
|
setMeta('twitter:title', title);
|
||||||
|
setMeta('twitter:description', desc);
|
||||||
|
if (ogImage) setMeta('twitter:image', ogImage);
|
||||||
|
|
||||||
|
// JSON-LD je nach Seite
|
||||||
|
var biz = cfg.BUSINESS;
|
||||||
|
var b = biz.addressLocality;
|
||||||
|
var r = biz.addressRegion;
|
||||||
|
var co = biz.addressCountry;
|
||||||
|
var phone = biz.telephone;
|
||||||
|
var mail = biz.email;
|
||||||
|
var siteUrl = cfg.SITE_URL;
|
||||||
|
|
||||||
|
function personBusinessGraph() {
|
||||||
|
return {
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@graph': [
|
||||||
|
{
|
||||||
|
'@type': 'Person',
|
||||||
|
name: 'Leon Tonhäuser',
|
||||||
|
jobTitle: 'Sportfotograf',
|
||||||
|
url: siteUrl,
|
||||||
|
email: mail,
|
||||||
|
telephone: phone
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'@type': 'ProfessionalService',
|
||||||
|
name: biz.name,
|
||||||
|
url: siteUrl,
|
||||||
|
telephone: phone,
|
||||||
|
email: mail,
|
||||||
|
address: { '@type': 'PostalAddress', addressLocality: b, addressRegion: r, addressCountry: co },
|
||||||
|
areaServed: biz.areaServed.map(function (n) { return { '@type': 'City', name: n }; }),
|
||||||
|
priceRange: biz.priceRange
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function breadcrumbListGraph() {
|
||||||
|
var segs = path.split('/').filter(Boolean);
|
||||||
|
var items = [{ '@type': 'ListItem', position: 1, name: 'Startseite', item: siteUrl + '/' }];
|
||||||
|
var acc = '';
|
||||||
|
var labels = { portfolio: 'Portfolio', leistungen: 'Leistungen', 'über-mich': 'Über mich', kontakt: 'Kontakt', blog: 'Blog', archiv: 'Archiv' };
|
||||||
|
for (var i = 0; i < segs.length; i++) {
|
||||||
|
acc += '/' + segs[i];
|
||||||
|
var label = labels[segs[i]] || segs[i].replace(/^portfolio-/, '').replace(/-/g, ' ').replace(/\b\w/g, function (c) { return c.toUpperCase(); });
|
||||||
|
items.push({ '@type': 'ListItem', position: i + 2, name: label, item: siteUrl + acc });
|
||||||
|
}
|
||||||
|
return { '@context': 'https://schema.org', '@type': 'BreadcrumbList', itemListElement: items };
|
||||||
|
}
|
||||||
|
|
||||||
|
function imageObjectGraph() {
|
||||||
|
var img = document.querySelector('img[src*="framerusercontent.com"]');
|
||||||
|
if (!img) return null;
|
||||||
|
var contentUrl = img.src;
|
||||||
|
var loc = path.replace(/^.*?(?:portfolio|archiv)-/, '').replace(/-/g, ' ');
|
||||||
|
return {
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'ImageObject',
|
||||||
|
contentUrl: contentUrl,
|
||||||
|
creator: { '@type': 'Person', name: 'Leon Tonhäuser' },
|
||||||
|
copyrightHolder: { '@type': 'Person', name: 'Leon Tonhäuser' },
|
||||||
|
contentLocation: { '@type': 'Place', name: loc ? loc.charAt(0).toUpperCase() + loc.slice(1) : 'Niedersachsen' }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function serviceGraph() {
|
||||||
|
return {
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'Service',
|
||||||
|
serviceType: 'Fotografie',
|
||||||
|
provider: { '@type': 'ProfessionalService', name: biz.name, url: siteUrl },
|
||||||
|
areaServed: biz.areaServed.map(function (n) { return { '@type': 'City', name: n }; }),
|
||||||
|
hasOfferCatalog: {
|
||||||
|
'@type': 'OfferCatalog',
|
||||||
|
name: 'Fotografie-Leistungen',
|
||||||
|
itemListElement: [
|
||||||
|
{ '@type': 'Offer', itemOffered: { '@type': 'Service', name: 'Eventfotografie' } },
|
||||||
|
{ '@type': 'Offer', itemOffered: { '@type': 'Service', name: 'Sportfotografie' } },
|
||||||
|
{ '@type': 'Offer', itemOffered: { '@type': 'Service', name: 'Reportagefotografie' } }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var schemata = page.jsonld || [];
|
||||||
|
if (schemata.indexOf('person-business') !== -1) injectJsonLd('seo-person-business', personBusinessGraph());
|
||||||
|
if (schemata.indexOf('breadcrumb') !== -1) injectJsonLd('seo-breadcrumb', breadcrumbListGraph());
|
||||||
|
var img = imageObjectGraph();
|
||||||
|
if (schemata.indexOf('imageobject') !== -1 && img) injectJsonLd('seo-image', img);
|
||||||
|
if (schemata.indexOf('service') !== -1) injectJsonLd('seo-service', serviceGraph());
|
||||||
|
|
||||||
|
document.documentElement.dataset.seoInjected = 'true';
|
||||||
|
} catch (e) {
|
||||||
|
/* ponytail: still-inject schlägt fehl → kein DOM-Crash, andere Skripte laufen weiter */
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Syntax-Check**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
```bash
|
||||||
|
node --check public/custom/seo.js && echo OK
|
||||||
|
```
|
||||||
|
Expected: `OK`
|
||||||
|
|
||||||
|
- [ ] **Step 3: Committen**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add public/custom/seo.js
|
||||||
|
git commit -m "feat: SEO-Injektor für Meta-Tags, Open Graph und JSON-LD"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task 3: robots.txt anlegen
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `public/robots.txt`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Datei erstellen**
|
||||||
|
|
||||||
|
Inhalt der Datei `public/robots.txt`:
|
||||||
|
|
||||||
|
```
|
||||||
|
User-agent: *
|
||||||
|
Allow: /
|
||||||
|
Disallow: /archiv/
|
||||||
|
|
||||||
|
Sitemap: https://www.leon-tonhaeuser.de/sitemap.xml
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Committen**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add public/robots.txt
|
||||||
|
git commit -m "feat: robots.txt mit Sitemap-Verweis und Archiv-Ausklammerung"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task 4: sitemap.xml anlegen
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `public/sitemap.xml`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Aktuelles Datum ermitteln**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
```bash
|
||||||
|
TODAY=$(date -u +%Y-%m-%d)
|
||||||
|
echo "$TODAY" > /tmp/seo_lastmod.txt
|
||||||
|
echo "Today: $TODAY"
|
||||||
|
```
|
||||||
|
Expected: Ausgabe enthält ein `YYYY-MM-DD`-Datum.
|
||||||
|
|
||||||
|
- [ ] **Step 2: sitemap.xml mit allen 21 URLs erstellen**
|
||||||
|
|
||||||
|
Inhalt der Datei `public/sitemap.xml`:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/</loc><lastmod>__TODAY__</lastmod><priority>1.0</priority><changefreq>weekly</changefreq></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio</loc><lastmod>__TODAY__</lastmod><priority>0.8</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio-aufstiegsfeier</loc><lastmod>__TODAY__</lastmod><priority>0.7</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio-frauen-bundesliga</loc><lastmod>__TODAY__</lastmod><priority>0.7</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio-hamburger-sv</loc><lastmod>__TODAY__</lastmod><priority>0.7</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio-rhine-ruhr-3x3</loc><lastmod>__TODAY__</lastmod><priority>0.7</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio-rhine-ruhr-basketball</loc><lastmod>__TODAY__</lastmod><priority>0.7</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio-rhine-ruhr-beachvolleyball</loc><lastmod>__TODAY__</lastmod><priority>0.7</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio-rhine-ruhr-sport</loc><lastmod>__TODAY__</lastmod><priority>0.7</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/portfolio-svg-lueneburg</loc><lastmod>__TODAY__</lastmod><priority>0.7</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/leistungen</loc><lastmod>__TODAY__</lastmod><priority>0.8</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/über-mich</loc><lastmod>__TODAY__</lastmod><priority>0.8</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/kontakt</loc><lastmod>__TODAY__</lastmod><priority>0.8</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/datenschutz</loc><lastmod>__TODAY__</lastmod><priority>0.2</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/impressum</loc><lastmod>__TODAY__</lastmod><priority>0.2</priority></url>
|
||||||
|
<url><loc>https://www.leon-tonhaeuser.de/blog</loc><lastmod>__TODAY__</lastmod><priority>0.5</priority></url>
|
||||||
|
</urlset>
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 3: Platzhalter `__TODAY__` durch tatsächliches Datum ersetzen**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
```bash
|
||||||
|
TODAY=$(cat /tmp/seo_lastmod.txt)
|
||||||
|
sed -i '' "s|__TODAY__|$TODAY|g" public/sitemap.xml
|
||||||
|
grep -c "<lastmod>$TODAY</lastmod>" public/sitemap.xml
|
||||||
|
```
|
||||||
|
Expected: `16` (16 Einträge mit dem heutigen Datum).
|
||||||
|
|
||||||
|
- [ ] **Step 4: XML validieren**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
```bash
|
||||||
|
python3 -c "import xml.etree.ElementTree as ET; t=ET.parse('public/sitemap.xml'); print('OK', len(t.getroot()))"
|
||||||
|
```
|
||||||
|
Expected: `OK 16`.
|
||||||
|
|
||||||
|
- [ ] **Step 5: Committen**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add public/sitemap.xml
|
||||||
|
git commit -m "feat: sitemap.xml mit allen 16 indexierbaren URLs"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task 5: SEO-Script-Includes auf Hauptseite einbauen
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `public/index.html` (Include nach `custom/transitions.js` einfügen)
|
||||||
|
|
||||||
|
- [ ] **Step 1: Aktuellen Include-Block lokalisieren**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
```bash
|
||||||
|
grep -n 'custom/transitions.js' public/index.html
|
||||||
|
```
|
||||||
|
Expected: Eine Zeile mit der Skript-URL.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Include-Block ergänzen**
|
||||||
|
|
||||||
|
Füge direkt nach der Zeile `<script src="custom/transitions.js"></script>` ein:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="custom/seo-config.js"></script>
|
||||||
|
<script src="custom/seo.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
(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?)(<script src=\"custom/transitions\.js\"></script>)',
|
||||||
|
r'\1\2\n\1<script src=\"custom/seo-config\.js\"></script>\n\1<script src=\"custom/seo\.js\"></script>',
|
||||||
|
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 <datei>`.
|
||||||
|
|
||||||
|
- [ ] **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 <datei>`.
|
||||||
|
|
||||||
|
- [ ] **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?)(<script src=\"custom/transitions\.js\"></script>)',
|
||||||
|
r'\1\2\n\1<script src=\"custom/seo-config\.js\"></script>\n\1<script src=\"custom/seo\.js\"></script>',
|
||||||
|
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?)(<script src=\"\.\./custom/transitions\.js\"></script>)',
|
||||||
|
r'\1\2\n\1<script src=\"\.\./custom/seo-config\.js\"></script>\n\1<script src=\"\.\./custom/seo\.js\"></script>',
|
||||||
|
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 <datei>`.
|
||||||
|
|
||||||
|
- [ ] **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 <datei>`.
|
||||||
|
|
||||||
|
- [ ] **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 <pfad>:` 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.
|
||||||
Reference in new issue
Block a user