Makes the first render match the prerendered HTML
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>
This commit is contained in:
@@ -2,11 +2,14 @@ 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({ user, domain }: EmailAddress): string | null {
|
||||
if (invalidPart(user) || invalidPart(domain) || !domain.includes('.')) {
|
||||
return null;
|
||||
}
|
||||
return `${user}@${domain}`;
|
||||
export function emailAddress(parts: EmailAddress): string | null {
|
||||
return isEmailAddressValid(parts) ? `${parts.user}@${parts.domain}` : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user