fix: sichtbaren Eventinhalt prüfen
This commit is contained in:
1 parent
878f9778b6
commit
19dce0665f
2 files changed
+20
-4
No files matched your search
@@ -157,7 +157,7 @@
|
|||||||
<div class="foto-meta"><b>OMR x yes!wecancer</b></div>
|
<div class="foto-meta"><b>OMR x yes!wecancer</b></div>
|
||||||
</a>
|
</a>
|
||||||
<a class="foto-karte einblenden" href="./portfolio-abiball">
|
<a class="foto-karte einblenden" href="./portfolio-abiball">
|
||||||
<img src="assets/portfolio/events/abiball/galerie-01.jpg" alt="Abiball — Eventfotografie" loading="lazy">
|
<img src="assets/portfolio/events/abiball/galerie-01.jpg" alt="Abiball — Veranstaltungsreportage" loading="lazy">
|
||||||
<div class="foto-meta"><b>Abiball</b></div>
|
<div class="foto-meta"><b>Abiball</b></div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+19
-3
@@ -15,14 +15,20 @@ function read(relativePath) {
|
|||||||
return readFileSync(path.join(ROOT, relativePath), 'utf8');
|
return readFileSync(path.join(ROOT, relativePath), 'utf8');
|
||||||
}
|
}
|
||||||
|
|
||||||
function visibleWordCount(html) {
|
function visibleText(html) {
|
||||||
const text = html
|
return html
|
||||||
|
.replace(/<head\b[\s\S]*?<\/head>/gi, ' ')
|
||||||
.replace(/<script[\s\S]*?<\/script>/gi, ' ')
|
.replace(/<script[\s\S]*?<\/script>/gi, ' ')
|
||||||
.replace(/<style[\s\S]*?<\/style>/gi, ' ')
|
.replace(/<style[\s\S]*?<\/style>/gi, ' ')
|
||||||
|
.replace(/<noscript[\s\S]*?<\/noscript>/gi, ' ')
|
||||||
.replace(/<[^>]+>/g, ' ')
|
.replace(/<[^>]+>/g, ' ')
|
||||||
.replace(/&[a-z0-9#]+;/gi, ' ')
|
.replace(/&[a-z0-9#]+;/gi, ' ')
|
||||||
.replace(/\s+/g, ' ')
|
.replace(/\s+/g, ' ')
|
||||||
.trim();
|
.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
function visibleWordCount(html) {
|
||||||
|
const text = visibleText(html);
|
||||||
return text ? text.split(' ').length : 0;
|
return text ? text.split(' ').length : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,6 +187,15 @@ if (wants('sport')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wants('event')) {
|
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', () => {
|
check('Eventseite hat eindeutigen H1 und substanziellen Inhalt', () => {
|
||||||
const html = pageHtml('eventfotografie.html');
|
const html = pageHtml('eventfotografie.html');
|
||||||
assert.equal(count(html, /<h1\b/g), 1);
|
assert.equal(count(html, /<h1\b/g), 1);
|
||||||
@@ -191,8 +206,9 @@ if (wants('event')) {
|
|||||||
|
|
||||||
check('Eventseite nennt Nutzen, Referenzen und Deutschland', () => {
|
check('Eventseite nennt Nutzen, Referenzen und Deutschland', () => {
|
||||||
const html = pageHtml('eventfotografie.html');
|
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']) {
|
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('"serviceType":"Eventfotografie"'));
|
||||||
assert.ok(html.includes('"@type":"Country","name":"Deutschland"'));
|
assert.ok(html.includes('"@type":"Country","name":"Deutschland"'));
|
||||||
|
|||||||
Reference in new issue
Block a user