Adds the shoot-type pages content and SEO foundation

Five pages under /soorten-fotoshoots/<id> with draft copy awaiting
Andrea's approval (DRAFT markers), structured data (Service,
BreadcrumbList, FAQPage), sitemap and Lighthouse entries. The overview
route moves to soorten-fotoshoots/index.tsx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 13:31:46 +01:00
co-authored by Claude Opus 5.5
parent 14164971f3
commit e5f4348178
78 changed files with 8729 additions and 110 deletions
+313 -12
View File
@@ -1,26 +1,38 @@
import fc from 'fast-check';
import { describe, expect, it } from 'vitest';
import aboutContent from './content/aboutContent';
import packages from './content/packages';
import portfolioContent from './content/portfolioContent';
import shootPageShared from './content/shootPageShared';
import loveshootPage from './content/shootPages/loveshoot';
import newbornPage from './content/shootPages/newborn';
import shootTypes from './content/shootTypes';
import siteContent from './content/siteContent';
import { emailAddress } from './lib/emailAddress';
import { richTextToPlain } from './lib/richTextToPlain';
import { shootPagePath } from './lib/shootPages';
import { shootPageView, type ShootPageView } from './lib/shootPageView';
import { visibleSocials } from './lib/visibleSocials';
import type { RoutePath } from './navigation';
import {
aboutPage,
absoluteUrl,
areaServed,
breadcrumbList,
businessId,
canonicalUrl,
contactPage,
defaultOgImage,
faqPage,
galleryImages,
jsonLdScript,
pageHead,
person,
personId,
professionalService,
shootPageGraph,
shootService,
shootServiceId,
shootServices,
siteHead,
siteUrl,
@@ -31,9 +43,17 @@ import {
import sitePages from './sitePages';
import {
anySiteContent,
faqItems,
knownRoutePath,
knowsAboutEntries,
plainText,
portfolioPhotos,
pricingPackage,
routePath,
shootPageContent,
shootPageShared as anyShared,
shootType,
shootTypeId,
uniqueShootTypes,
} from './test/arbitraries';
@@ -487,11 +507,18 @@ describe('shootServices', () => {
expect(list.numberOfItems).toBe(5);
const services = list.itemListElement.map((element) => element.item);
expect(services.map((service) => service['@id'])).toEqual([
`${page}#newborn`,
`${page}#zwangerschap`,
`${page}#gezin`,
`${page}#loveshoot`,
`${page}#portret`,
`${page}/newborn#service`,
`${page}/zwangerschap#service`,
`${page}/gezin#service`,
`${page}/loveshoot#service`,
`${page}/portret#service`,
]);
expect(services.map((service) => service.url)).toEqual([
`${page}/newborn`,
`${page}/zwangerschap`,
`${page}/gezin`,
`${page}/loveshoot`,
`${page}/portret`,
]);
expect(services[0]).toMatchObject({
'@type': 'Service',
@@ -532,16 +559,21 @@ describe('shootServices', () => {
);
});
it('gives every service its own anchor as @id (invariant)', () => {
it('gives every service the id and URL of its own shoot page (invariant)', () => {
fc.assert(
fc.property(uniqueShootTypes, anySiteContent, (shoots, site) => {
const ids = shootServices(shoots, site).itemListElement.map(
(element) => element.item['@id'],
);
const services = shootServices(
shoots,
site,
).itemListElement.map((element) => element.item);
const ids = services.map((service) => service['@id']);
expect(new Set(ids).size).toBe(ids.length);
ids.forEach((id, index) =>
expect(id).toBe(`${page}#${shoots[index].id}`),
);
services.forEach((service, index) => {
expect(service['@id']).toBe(
`${page}/${shoots[index].id}#service`,
);
expect(service.url).toBe(`${page}/${shoots[index].id}`);
});
}),
);
});
@@ -578,6 +610,275 @@ describe('shootServices', () => {
});
});
// A shoot type with hostile text where the structured data shows it
const hostileShoot = fc
.tuple(shootType, plainText, plainText)
.map(([shoot, label, description]) => ({
...shoot,
shootLabel: label,
paragraphs: [description, ...shoot.paragraphs],
}));
// Breadcrumb items as a page could have them: known routes, hostile labels
const breadcrumbItems = fc.array(
fc.record({ label: plainText, to: knownRoutePath }),
{ maxLength: 5 },
);
// The view of a shoot page from the real shoot types and packages, with
// any shared texts, site content and page content
const anyView = fc
.tuple(shootTypeId, anyShared, anySiteContent)
.chain(([id, shared, site]) =>
shootPageContent(id).map(
(page) =>
shootPageView(id, page, {
shootTypes,
packages,
shared,
site,
portfolioShoots: [],
}) as ShootPageView,
),
);
const realView = (id: 'newborn' | 'loveshoot') =>
shootPageView(id, id === 'newborn' ? newbornPage : loveshootPage, {
shootTypes,
packages,
shared: shootPageShared,
site: siteContent,
portfolioShoots: [],
})!;
// Survives the script tag unchanged, and never writes a markup character
// or the e-mail address
const expectSafeScript = (data: unknown, site: typeof siteContent) => {
const script = jsonLdScript(data);
expect(JSON.parse(script)).toEqual(data);
expect(/[<>&]/.test(script)).toBe(false);
const address = emailAddress(site.email);
if (address !== null) expect(script).not.toContain(address);
};
describe('shootService', () => {
it('describes the newborn shoot with the offer of its package', () => {
const newbornPackage = packages.find((pkg) => pkg.id === 'newborn');
expect(
shootService(shootTypes[0], siteContent, newbornPackage),
).toMatchObject({
'@type': 'Service',
'@id': `${siteUrl}/soorten-fotoshoots/newborn#service`,
url: `${siteUrl}/soorten-fotoshoots/newborn`,
name: 'Newbornshoot',
offers: { '@type': 'Offer', price: 185, priceCurrency: 'EUR' },
});
expect(shootServiceId('portret')).toBe(
`${siteUrl}/soorten-fotoshoots/portret#service`,
);
});
it('is the same service on the overview and on the shoot page, with an offer only for a package (invariant)', () => {
fc.assert(
fc.property(
uniqueShootTypes,
anySiteContent,
fc.option(pricingPackage, { nil: undefined }),
(shoots, site, pkg) => {
const overview = shootServices(
shoots,
site,
).itemListElement;
shoots.forEach((shoot, index) => {
const service = shootService(shoot, site, pkg);
expect(overview[index].item['@id']).toBe(
service['@id'],
);
expect(service['@id']).toBe(shootServiceId(shoot.id));
expect(service.url).toBe(
canonicalUrl(shootPagePath(shoot.id)),
);
expect('offers' in service).toBe(pkg !== undefined);
if (pkg !== undefined) {
expect(service.offers).toEqual({
'@type': 'Offer',
price: pkg.price,
priceCurrency: 'EUR',
});
}
});
},
),
);
});
it('survives the script tag, without markup characters or e-mail address (round trip, invariant)', () => {
fc.assert(
fc.property(
hostileShoot,
anySiteContent,
fc.option(pricingPackage, { nil: undefined }),
(shoot, site, pkg) => {
expectSafeScript(shootService(shoot, site, pkg), site);
expectSafeScript(shootServices([shoot], site), site);
},
),
);
});
});
describe('breadcrumbList', () => {
it('numbers the items from 1, with absolute URLs and the labels in order (invariant)', () => {
fc.assert(
fc.property(breadcrumbItems, (items) => {
const list = breadcrumbList(items);
expect(list['@type']).toBe('BreadcrumbList');
expect(
list.itemListElement.map((element) => element.position),
).toEqual(items.map((_, index) => index + 1));
expect(
list.itemListElement.map((element) => element.name),
).toEqual(items.map((item) => item.label));
list.itemListElement.forEach((element, index) => {
expect(element.item.startsWith(`${siteUrl}/`)).toBe(true);
expect(element.item).toBe(canonicalUrl(items[index].to));
});
}),
);
});
it('survives the script tag, without markup characters (round trip, invariant)', () => {
fc.assert(
fc.property(breadcrumbItems, (items) => {
expectSafeScript(breadcrumbList(items), siteContent);
}),
);
});
});
describe('faqPage', () => {
it('is left out without questions', () => {
expect(faqPage('/contact', [])).toBeUndefined();
});
it('has one question per item in order, answered by its visible text (invariant)', () => {
fc.assert(
fc.property(knownRoutePath, faqItems, (path, items) => {
const data = faqPage(path, items);
if (data === undefined) {
expect(items).toHaveLength(0);
return;
}
expect(data.isPartOf).toEqual({ '@id': canonicalUrl(path) });
expect(data.mainEntity).toEqual(
items.map((item) => ({
'@type': 'Question',
name: item.question,
acceptedAnswer: {
'@type': 'Answer',
text: richTextToPlain(item.answer),
},
})),
);
}),
);
});
it('survives the script tag, without markup characters (round trip, invariant)', () => {
fc.assert(
fc.property(knownRoutePath, faqItems, (path, items) => {
expectSafeScript(faqPage(path, items) ?? null, siteContent);
}),
);
});
});
describe('shootPageGraph', () => {
it('describes the newborn page: its service with the package price, the breadcrumb and the FAQ', () => {
const [page, faq] = shootPageGraph(realView('newborn'), siteContent);
expect(page).toMatchObject({
'@type': 'WebPage',
'@id': `${siteUrl}/soorten-fotoshoots/newborn`,
mainEntity: {
'@type': 'Service',
'@id': `${siteUrl}/soorten-fotoshoots/newborn#service`,
url: `${siteUrl}/soorten-fotoshoots/newborn`,
offers: { '@type': 'Offer', price: 185, priceCurrency: 'EUR' },
},
breadcrumb: {
'@type': 'BreadcrumbList',
itemListElement: [
{ position: 1, name: 'Home', item: `${siteUrl}/` },
{
position: 2,
name: 'Soorten fotoshoots',
item: `${siteUrl}/soorten-fotoshoots`,
},
{
position: 3,
name: 'Newborn',
item: `${siteUrl}/soorten-fotoshoots/newborn`,
},
],
},
});
expect(faq).toMatchObject({
'@type': 'FAQPage',
isPartOf: { '@id': `${siteUrl}/soorten-fotoshoots/newborn` },
});
expect(faq).toHaveProperty(
'mainEntity.length',
newbornPage.faq.items.length,
);
});
it('describes the loveshoot page without an offer', () => {
const graph = shootPageGraph(realView('loveshoot'), siteContent);
expect(graph.map((data) => data['@type'])).toEqual([
'WebPage',
'FAQPage',
]);
expect(graph[0]).not.toHaveProperty('mainEntity.offers');
expect(JSON.stringify(graph)).not.toMatch(/"(offers|price)"/);
});
it('has the page, and the FAQPage exactly when the page has questions (invariant)', () => {
fc.assert(
fc.property(anyView, anySiteContent, (view, site) => {
const [page, ...rest] = shootPageGraph(view, site);
expect(rest).toHaveLength(view.faq === undefined ? 0 : 1);
expect(page).toHaveProperty(['@id'], canonicalUrl(view.path));
expect(page).toHaveProperty(
['mainEntity', '@id'],
shootServiceId(view.id),
);
expect(page).toHaveProperty(
'breadcrumb',
breadcrumbList(view.breadcrumb.items),
);
if (view.offer.pkg === undefined) {
expect(page).not.toHaveProperty('mainEntity.offers');
} else {
expect(page).toHaveProperty(
'mainEntity.offers.price',
view.offer.pkg.price,
);
}
}),
);
});
it('survives the script tag, without markup characters or e-mail address (round trip, invariant)', () => {
fc.assert(
fc.property(anyView, anySiteContent, (view, site) => {
for (const data of shootPageGraph(view, site)) {
expectSafeScript(data, site);
}
}),
);
});
});
describe('the contact page', () => {
it('is indexed, with its own title, description and preview image', () => {
const head = pageHead('/contact');