Search values, the 404 buttons and the footer year now apply after hydration. The e-mail address stays out of the HTML behind a placeholder, and all review texts are in the page, so crawlers can read them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
750 B
TypeScript
16 lines
750 B
TypeScript
import type { EmailAddress } from '../content/types';
|
|
|
|
const invalidPart = (part: string) => part === '' || /[\s@]/.test(part);
|
|
|
|
// Zegt of de delen een geldig adres geven, zonder het samen te voegen. Zo
|
|
// weten de pagina's al voor de hydratatie of er een adres is (BR-MAIL-08).
|
|
export function isEmailAddressValid({ user, domain }: EmailAddress): boolean {
|
|
return !invalidPart(user) && !invalidPart(domain) && domain.includes('.');
|
|
}
|
|
|
|
// Voegt het e-mailadres pas in de browser samen (BR-EMAIL-01). Geeft null bij
|
|
// ongeldige delen, zodat de footer de Contact-kolom kan weglaten (BR-EMAIL-02).
|
|
export function emailAddress(parts: EmailAddress): string | null {
|
|
return isEmailAddressValid(parts) ? `${parts.user}@${parts.domain}` : null;
|
|
}
|