fix: Standortangaben konsistent halten

This commit is contained in:
Leon Tonhäuser committed 2026-07-30 13:22:27 +02:00
1 parent 5951134fbe
commit 9d88159186
5 files changed
+39 -14

No files matched your search

+27 -2
View File
@@ -27,8 +27,13 @@ function visibleText(html) {
.trim();
}
function visibleMainText(html) {
const main = html.match(/<main\b[\s\S]*?<\/main>/i);
return main ? visibleText(main[0]) : '';
}
function visibleWordCount(html) {
const text = visibleText(html);
const text = visibleMainText(html);
return text ? text.split(' ').length : 0;
}
@@ -92,6 +97,24 @@ if (wants('core')) {
assert.deepEqual(Array.from(config.BUSINESS.areaServed), cities);
});
check('sichtbare Wortzahl berücksichtigt nur main', () => {
const html = '<main>Eins zwei drei</main><footer>Vier fünf</footer>';
assert.equal(visibleWordCount(html), 3);
});
check('crawlbare Seiten behaupten keinen Standort Uelzen', () => {
for (const urlPath of Object.keys(config.PAGES)) {
const file = urlPath === '/' ? 'index.html' : `${urlPath.slice(1)}.html`;
const html = pageHtml(file);
if (/<meta\s+name=["']robots["'][^>]*\bnoindex\b/i.test(html)) continue;
assert.doesNotMatch(
html,
/(?:Leon Tonhäuser|Sportfotograf(?:ie)?(?: von Leon Tonhäuser)?) aus Uelzen/i,
file
);
}
});
check('Sportseite hat seitenspezifische Service-Daten', () => {
const page = config.PAGES['/sportfotografie'];
assert.equal(page.service.serviceType, 'Sportfotografie');
@@ -165,6 +188,8 @@ if (wants('sport')) {
check('Sportseite belegt Regionen mit vorhandenen Referenzen', () => {
const html = pageHtml('sportfotografie.html');
const visible = visibleMainText(html);
assert.ok(visible, 'sichtbarer <main>-Inhalt fehlt');
for (const href of [
'./portfolio-hamburger-sv',
'./portfolio-fc-st-pauli',
@@ -175,7 +200,7 @@ if (wants('sport')) {
assert.ok(html.includes(`href="${href}"`), `${href} fehlt`);
}
for (const city of ['Hamburg', 'Hannover', 'Wolfsburg', 'Uelzen', 'Celle', 'Lüneburg']) {
assert.ok(html.includes(city), `${city} fehlt`);
assert.ok(visible.includes(city), `${city} fehlt im sichtbaren main-Inhalt`);
}
});