Shares the service area in the structured data

The business's areaServed now comes from a serviceArea list in the site
content: Huizen and Gooi en Vechtstreek, as the pages describe it,
instead of a fixed Place Huizen. Services on other pages can use the
same list through areaServed().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 23:40:24 +02:00
co-authored by Claude Opus 5.5
parent eb235368bf
commit befe97af1e
5 changed files with 87 additions and 2 deletions
+36
View File
@@ -6,6 +6,7 @@ import { emailAddress } from './lib/emailAddress';
import { visibleSocials } from './lib/visibleSocials';
import {
aboutPage,
areaServed,
businessId,
canonicalUrl,
jsonLdScript,
@@ -119,6 +120,13 @@ describe('professionalService en siteHead', () => {
expect(JSON.stringify(data)).not.toContain('@andreaslop');
});
it('serves Huizen and Gooi en Vechtstreek', () => {
expect(professionalService(siteContent).areaServed).toEqual([
{ '@type': 'City', name: 'Huizen' },
{ '@type': 'AdministrativeArea', name: 'Gooi en Vechtstreek' },
]);
});
it('laat ongeldige socials weg uit sameAs', () => {
const data = professionalService({
...siteContent,
@@ -136,6 +144,34 @@ describe('professionalService en siteHead', () => {
});
});
describe('areaServed', () => {
it('keeps every named area, trimmed and in order (invariant)', () => {
fc.assert(
fc.property(anySiteContent, (site) => {
const named = site.serviceArea.filter(
(area) => area.name.trim() !== '',
);
expect(areaServed(site.serviceArea)).toEqual(
named.map((area) => ({
'@type': area.type,
name: area.name.trim(),
})),
);
}),
);
});
it('only produces towns and regions (invariant)', () => {
fc.assert(
fc.property(anySiteContent, (site) =>
areaServed(site.serviceArea).every((place) =>
['City', 'AdministrativeArea'].includes(place['@type']),
),
),
);
});
});
describe('pageHead for the about page', () => {
it('is indexed, with its own title, description and preview image', () => {
const head = pageHead('/over-mij');