fix: sichtbaren Eventinhalt prüfen

This commit is contained in:
Leon Tonhäuser committed 2026-07-30 12:23:24 +02:00
1 parent 878f9778b6
commit 19dce0665f
2 files changed
+20 -4

No files matched your search

+19 -3
View File
@@ -15,14 +15,20 @@ function read(relativePath) {
return readFileSync(path.join(ROOT, relativePath), 'utf8');
}
function visibleWordCount(html) {
const text = html
function visibleText(html) {
return html
.replace(/<head\b[\s\S]*?<\/head>/gi, ' ')
.replace(/<script[\s\S]*?<\/script>/gi, ' ')
.replace(/<style[\s\S]*?<\/style>/gi, ' ')
.replace(/<noscript[\s\S]*?<\/noscript>/gi, ' ')
.replace(/<[^>]+>/g, ' ')
.replace(/&[a-z0-9#]+;/gi, ' ')
.replace(/\s+/g, ' ')
.trim();
}
function visibleWordCount(html) {
const text = visibleText(html);
return text ? text.split(' ').length : 0;
}
@@ -181,6 +187,15 @@ if (wants('sport')) {
}
if (wants('event')) {
check('Event-Nutzen und Referenzen können nicht nur in Metadaten stehen', () => {
const metadataOnly = pageHtml('eventfotografie.html')
.replace(/<main\b[\s\S]*?<\/main>/i, '<main>Ohne die geforderten Begriffe.</main>');
const visible = visibleText(metadataOnly);
for (const term of ['Hamburg', 'deutschlandweit', 'PR', 'Social Media', 'YES!CON 2026', 'OMR x yes!wecancer']) {
assert.ok(!visible.includes(term), `${term} darf nicht aus Metadaten als sichtbarer Inhalt gelten`);
}
});
check('Eventseite hat eindeutigen H1 und substanziellen Inhalt', () => {
const html = pageHtml('eventfotografie.html');
assert.equal(count(html, /<h1\b/g), 1);
@@ -191,8 +206,9 @@ if (wants('event')) {
check('Eventseite nennt Nutzen, Referenzen und Deutschland', () => {
const html = pageHtml('eventfotografie.html');
const visible = visibleText(html);
for (const term of ['Hamburg', 'deutschlandweit', 'PR', 'Social Media', 'YES!CON 2026', 'OMR x yes!wecancer']) {
assert.ok(html.includes(term), `${term} fehlt`);
assert.ok(visible.includes(term), `${term} fehlt im sichtbaren Inhalt`);
}
assert.ok(html.includes('"serviceType":"Eventfotografie"'));
assert.ok(html.includes('"@type":"Country","name":"Deutschland"'));