diff --git a/web/lighthouserc.cjs b/web/lighthouserc.cjs index 8289d2b..f301d5c 100644 --- a/web/lighthouserc.cjs +++ b/web/lighthouserc.cjs @@ -6,8 +6,8 @@ const origin = 'http://localhost:4173'; // Moet gelijk lopen met src/sitePages.ts (een test bewaakt dat) -const indexedPaths = ['/', '/over-mij', '/soorten-fotoshoots']; -const noindexPaths = ['/portfolio', '/contact', '/privacyverklaring']; +const indexedPaths = ['/', '/over-mij', '/soorten-fotoshoots', '/contact']; +const noindexPaths = ['/portfolio', '/privacyverklaring']; const notFoundPath = '/bestaat-niet'; // Homepage mobiel voorlopig 0,8: de foto's zijn nog niet responsive en de diff --git a/web/public/og-contact.jpg b/web/public/og-contact.jpg new file mode 100644 index 0000000..17733d5 Binary files /dev/null and b/web/public/og-contact.jpg differ diff --git a/web/src/app.test.tsx b/web/src/app.test.tsx index 6103fa3..240872d 100644 --- a/web/src/app.test.tsx +++ b/web/src/app.test.tsx @@ -144,10 +144,10 @@ describe('app', () => { ).toHaveAttribute('href', '/portfolio'); expect( screen.getByRole('link', { name: 'neem contact op' }), - ).toHaveAttribute('href', '/#contact'); + ).toHaveAttribute('href', '/contact'); expect( screen.getByRole('link', { name: 'Boek je shoot' }), - ).toHaveAttribute('href', '/#contact'); + ).toHaveAttribute('href', '/contact'); expect( screen.getByRole('list', { name: "Foto's" }), ).toBeInTheDocument(); @@ -163,6 +163,71 @@ describe('app', () => { expect(await axeResults(container)).toHaveNoViolations(); }); + it('shows the contact page with its outline, cards and structured data', async () => { + const { container } = await renderApp('/contact'); + await screen.findByRole('heading', { level: 1, name: 'Contact' }); + const main = within(screen.getByRole('main')); + // Both cards are in the page; jsdom has no screen width, so the + // headings are listed regardless of which layout is visible + expect( + main + .getAllByRole('heading', { hidden: true }) + .map((h) => `${h.tagName} ${h.textContent}`), + ).toEqual([ + 'H1 Contact', + 'H2 Direct contact', + 'H2 Stuur me een bericht', + 'H2 Direct contact', + ]); + expect( + screen.getByText(/ik reageer binnen 1-2 werkdagen\./), + ).toBeInTheDocument(); + expect( + screen.getByRole('region', { name: 'Stuur me een bericht' }), + ).toBeInTheDocument(); + expect( + screen.getByTestId('contact-details-narrow'), + ).toBeInTheDocument(); + expect(screen.getByTestId('contact-details-wide')).toBeInTheDocument(); + expect( + await screen.findByTestId('contact-form-shoot', undefined, { + timeout: 10_000, + }), + ).toBeInTheDocument(); + + expect(document.title).toBe( + 'Contact – fotoshoot boeken in Huizen | Andrea Slop Fotografie', + ); + expect(document.head.querySelector('meta[name="robots"]')).toBeNull(); + const types = [ + ...document.querySelectorAll('script[type="application/ld+json"]'), + ].map((script) => JSON.parse(script.textContent!)['@type']); + expect(types.sort()).toEqual(['ContactPage', 'ProfessionalService']); + expect(await axeResults(container)).toHaveNoViolations(); + }); + + it('takes over ?pakket= on the contact page and tidies the URL without moving focus', async () => { + const { router } = await renderApp('/contact?pakket=newborn'); + expect( + await screen.findByTestId('contact-form-shoot', undefined, { + timeout: 10_000, + }), + ).toHaveValue('newborn'); + await waitFor(() => expect(router.state.location.searchStr).toBe('')); + expect(router.state.location.pathname).toBe('/contact'); + expect(document.activeElement).toBe(document.body); + }); + + it('drops an unknown ?pakket= on the contact page', async () => { + const { router } = await renderApp('/contact?pakket=bruiloft'); + expect( + await screen.findByTestId('contact-form-shoot', undefined, { + timeout: 10_000, + }), + ).toHaveValue(''); + await waitFor(() => expect(router.state.location.searchStr).toBe('')); + }); + it('shows the shoot types page with its outline, links and structured data', async () => { const { container } = await renderApp('/soorten-fotoshoots'); await screen.findByRole('heading', { @@ -193,11 +258,11 @@ describe('app', () => { .getAllByRole('link', { name: /^Stuur een berichtje/ }) .map((link) => link.getAttribute('href')), ).toEqual([ - '/?pakket=newborn#contact', - '/?pakket=zwangerschap#contact', - '/?pakket=gezin#contact', - '/#contact', - '/#contact', + '/contact?pakket=newborn', + '/contact?pakket=zwangerschap', + '/contact?pakket=gezin', + '/contact', + '/contact', ]); // Links to the filtered portfolio only once that page is live // (indexed); they switch on by themselves when it is @@ -221,7 +286,7 @@ describe('app', () => { ).toHaveAttribute('href', '/#prijzen'); expect( screen.getByRole('link', { name: 'Boek je shoot' }), - ).toHaveAttribute('href', '/#contact'); + ).toHaveAttribute('href', '/contact'); expect(document.title).toBe( 'Soorten fotoshoots | Andrea Slop Fotografie', diff --git a/web/src/assets/contact/contact-portret.jpg b/web/src/assets/contact/contact-portret.jpg new file mode 100644 index 0000000..dfa0595 Binary files /dev/null and b/web/src/assets/contact/contact-portret.jpg differ diff --git a/web/src/assets/contact/contact.jpg b/web/src/assets/contact/contact.jpg new file mode 100644 index 0000000..0568965 Binary files /dev/null and b/web/src/assets/contact/contact.jpg differ diff --git a/web/src/components/ContactDetails/ContactDetails.tsx b/web/src/components/ContactDetails/ContactDetails.tsx index 3a05617..b551bee 100644 --- a/web/src/components/ContactDetails/ContactDetails.tsx +++ b/web/src/components/ContactDetails/ContactDetails.tsx @@ -6,7 +6,7 @@ import { Link, VisuallyHidden, } from '@chakra-ui/react'; -import mailOutlined from '@iconify-icons/ant-design/mail-outlined'; +import mailFilled from '@iconify-icons/ant-design/mail-filled'; import { Icon } from '@iconify/react/offline'; import Eyebrow from '@/components/Eyebrow/Eyebrow'; import socialPlatforms from '@/content/socialPlatforms'; @@ -27,7 +27,7 @@ type ContactDetailsProps = { const iconOf = (channel: ContactChannel) => channel.kind === 'email' - ? mailOutlined + ? mailFilled : socialPlatforms[channel.platform].icon; // "Direct contact": a card with the ways to reach Andrea, each an icon and a diff --git a/web/src/components/about/AboutIntro/AboutIntro.test.tsx b/web/src/components/about/AboutIntro/AboutIntro.test.tsx index 822ce5b..7448d82 100644 --- a/web/src/components/about/AboutIntro/AboutIntro.test.tsx +++ b/web/src/components/about/AboutIntro/AboutIntro.test.tsx @@ -28,7 +28,7 @@ describe('AboutIntro', () => { ).toHaveAttribute('href', '/portfolio'); expect( within(section).getByRole('link', { name: 'neem contact op' }), - ).toHaveAttribute('href', '/#contact'); + ).toHaveAttribute('href', '/contact'); expect(await axeResults(container)).toHaveNoViolations(); }); }); diff --git a/web/src/components/contact/ContactAside/ContactAside.test.tsx b/web/src/components/contact/ContactAside/ContactAside.test.tsx new file mode 100644 index 0000000..49622fa --- /dev/null +++ b/web/src/components/contact/ContactAside/ContactAside.test.tsx @@ -0,0 +1,48 @@ +import { screen } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import { axeResults } from '@/test/axe'; +import { renderWithProviders } from '@/test/renderWithProviders'; +import ContactAside, { ASIDE_MEDIA } from './ContactAside'; + +const image = { + src: '/contact.jpg', + alt: 'Andrea met haar camera', + width: 840, + height: 1050, +}; + +describe('ContactAside', () => { + it('offers the photo only to wide screens, with priority', async () => { + const { container } = await renderWithProviders( + +

Kaart

+
, + ); + const source = container.querySelector('picture source'); + expect(source).toHaveAttribute('media', ASIDE_MEDIA); + expect(source).toHaveAttribute('srcset', '/contact.jpg'); + + // Hidden in jsdom: it has no screen width, so the base display wins + const photo = screen.getByRole('img', { + name: image.alt, + hidden: true, + }); + // Phones get a tiny inline image, never the photo itself + expect(photo.getAttribute('src')).toMatch(/^data:image\/gif/); + expect(photo).toHaveAttribute('fetchpriority', 'high'); + expect(photo).toHaveAttribute('width', '840'); + expect(photo).toHaveAttribute('height', '1050'); + expect(await axeResults(container)).toHaveNoViolations(); + }); + + it('lays the card over the photo', async () => { + await renderWithProviders( + +

Kaart

+
, + ); + expect(screen.getByTestId('contact-aside')).toContainElement( + screen.getByText('Kaart'), + ); + }); +}); diff --git a/web/src/components/contact/ContactAside/ContactAside.tsx b/web/src/components/contact/ContactAside/ContactAside.tsx new file mode 100644 index 0000000..6bc10ff --- /dev/null +++ b/web/src/components/contact/ContactAside/ContactAside.tsx @@ -0,0 +1,56 @@ +import type { ReactNode } from 'react'; +import { Box, chakra, Image } from '@chakra-ui/react'; +import type { ContentImage } from '@/content/types'; + +// The media query from where the aside shows (theme breakpoint lg) +export const ASIDE_MEDIA = '(min-width: 64em)'; + +// A transparent 1×1 GIF: what phones get instead of the photo +const NO_PHOTO = + 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; + +type ContactAsideProps = { + image: ContentImage; + // The contact card, laid over the bottom of the photo + children: ReactNode; +}; + +// The right column of the contact page on wide screens: the photo with the +// contact card overlapping its bottom edge (mockup 1a, BR-CP-06..09). +// Hidden below lg; there the picture's source does not apply, so phones +// never download the photo. On wide screens it is the largest paint, so it +// loads straight away with high priority. +export default function ContactAside({ image, children }: ContactAsideProps) { + return ( + + + + {image.alt} + + + {children} + + + ); +} diff --git a/web/src/components/shoots/ShootBlock/ShootBlock.test.tsx b/web/src/components/shoots/ShootBlock/ShootBlock.test.tsx index 23fd41d..bcadc4b 100644 --- a/web/src/components/shoots/ShootBlock/ShootBlock.test.tsx +++ b/web/src/components/shoots/ShootBlock/ShootBlock.test.tsx @@ -49,7 +49,7 @@ describe('ShootBlock', () => { const link = screen.getByRole('link', { name: 'Stuur een berichtje over een zwangerschapsshoot', }); - expect(link).toHaveAttribute('href', '/?pakket=zwangerschap#contact'); + expect(link).toHaveAttribute('href', '/contact?pakket=zwangerschap'); }); it('links to the contact form without a package when the shoot has none', async () => { @@ -58,7 +58,7 @@ describe('ShootBlock', () => { screen.getByRole('link', { name: 'Stuur een berichtje over een loveshoot', }), - ).toHaveAttribute('href', '/#contact'); + ).toHaveAttribute('href', '/contact'); }); it('only links to the portfolio once it is live', async () => { diff --git a/web/src/content/aboutContent.ts b/web/src/content/aboutContent.ts index 6db9a0a..1541f16 100644 --- a/web/src/content/aboutContent.ts +++ b/web/src/content/aboutContent.ts @@ -26,8 +26,7 @@ const aboutContent: AboutPageContent = { 'Nieuwsgierig naar mijn werk? Bekijk ', { text: 'mijn portfolio', to: '/portfolio' }, ' of ', - // The homepage contact section until /contact exists - { text: 'neem contact op', to: '/', hash: 'contact' }, + { text: 'neem contact op', to: '/contact' }, ' voor een fotoshoot!', ], ], @@ -65,7 +64,7 @@ const aboutContent: AboutPageContent = { 'Wanneer ik niet achter de camera sta ben ik bezig met tekenen, schilderen of lezen.', ], }, - booking: { label: 'Boek je shoot', to: '/', hash: 'contact' }, + booking: { label: 'Boek je shoot', to: '/contact' }, person: { name: 'Andrea Slop', jobTitle: 'Lifestyle fotograaf', diff --git a/web/src/content/contactContent.ts b/web/src/content/contactContent.ts new file mode 100644 index 0000000..ee1c5d0 --- /dev/null +++ b/web/src/content/contactContent.ts @@ -0,0 +1,32 @@ +import type { ContactPageContent } from './types'; + +// Images +import photo from '../assets/contact/contact.jpg'; +import portrait from '../assets/contact/contact-portret.jpg'; + +// Static content of the contact page until the CMS API exists (FR-CP-01, +// FR-CP-04, FR-CP-05) +const contactContent: ContactPageContent = { + head: { + eyebrow: 'Neem contact op', + title: 'Contact', + intro: 'Wil je een fotoshoot boeken of meer informatie ontvangen? Stuur me een berichtje, ik reageer binnen {reactietermijn}.', + }, + formTitle: 'Stuur me een bericht', + detailsTitle: 'Direct contact', + image: { + src: photo, + alt: 'Andrea Slop kijkt lachend over haar schouder, met haar camera in de hand, op een bospad', + width: 840, + height: 1050, + }, + portrait: { + src: portrait, + // Decorative next to the heading; the card does not use this text + alt: 'Andrea Slop', + width: 144, + height: 144, + }, +}; + +export default contactContent; diff --git a/web/src/content/shootTypesPageContent.ts b/web/src/content/shootTypesPageContent.ts index e3848d1..89cc2b9 100644 --- a/web/src/content/shootTypesPageContent.ts +++ b/web/src/content/shootTypesPageContent.ts @@ -16,7 +16,7 @@ const shootTypesPageContent: ShootTypesPageContent = { ' op de homepage of stel je vraag via het contactformulier.', ], // The homepage contact section until /contact exists - booking: { label: 'Boek je shoot', to: '/', hash: 'contact' }, + booking: { label: 'Boek je shoot', to: '/contact' }, }, }; diff --git a/web/src/content/types.ts b/web/src/content/types.ts index 613b29e..67be125 100644 --- a/web/src/content/types.ts +++ b/web/src/content/types.ts @@ -166,6 +166,20 @@ export interface AboutPageContent { person: { name: string; jobTitle: string; knowsAbout: string[] }; } +// Content of the contact page (/contact). The intro has one placeholder, +// {reactietermijn}, filled in with siteContent.contactForm.replyTime. +export interface ContactPageContent { + head: { eyebrow: string; title: string; intro: string }; + // Heading of the form, only for assistive technology + formTitle: string; + // Heading of the contact card + detailsTitle: string; + // 4:5 photo next to the form on wide screens + image: ContentImage; + // Small square crop for the round photo in the card on narrow screens + portrait: ContentImage; +} + // Content of the shoot types page (/soorten-fotoshoots); the shoots // themselves come from shootTypes export interface ShootTypesPageContent { diff --git a/web/src/lib/shootLinks.test.ts b/web/src/lib/shootLinks.test.ts index 5ed8c0b..9f965f3 100644 --- a/web/src/lib/shootLinks.test.ts +++ b/web/src/lib/shootLinks.test.ts @@ -16,16 +16,14 @@ const shoot = (id: string) => shootTypes.find((item) => item.id === id)!; describe('shootContactLink', () => { it('preselects the package of a shoot that has one', () => { expect(shootContactLink(shoot('newborn'), packages)).toEqual({ - to: '/', + to: '/contact', search: { pakket: 'newborn' }, - hash: 'contact', }); }); it('links without a package for a shoot that has none', () => { expect(shootContactLink(shoot('loveshoot'), packages)).toEqual({ - to: '/', - hash: 'contact', + to: '/contact', }); }); @@ -35,14 +33,13 @@ describe('shootContactLink', () => { shoot('gezin'), packages.filter((pkg) => pkg.id !== 'gezin'), ), - ).toEqual({ to: '/', hash: 'contact' }); + ).toEqual({ to: '/contact' }); }); - it('always goes to the contact section (invariant)', () => { + it('always goes to the contact page (invariant)', () => { fc.assert( fc.property(shootType, fc.array(anyPackage), (item, list) => { - const link = shootContactLink(item, list); - return link.to === '/' && link.hash === 'contact'; + return shootContactLink(item, list).to === '/contact'; }), ); }); diff --git a/web/src/lib/shootLinks.ts b/web/src/lib/shootLinks.ts index 457f906..9611997 100644 --- a/web/src/lib/shootLinks.ts +++ b/web/src/lib/shootLinks.ts @@ -3,9 +3,8 @@ import type { RoutePath } from '../navigation.ts'; import type { PageMeta } from '../sitePages.ts'; import { visiblePackages } from './visiblePackages.ts'; -// Where "Stuur een berichtje" goes: the homepage contact section, with the -// shoot's package preselected when that package is shown (BR-SF-01..03). -// Once /contact exists, only this function changes. +// Where "Stuur een berichtje" goes: the contact page, with the shoot's +// package preselected when that package is shown (BR-SF-01..03, FR-CP-09) export function shootContactLink( shoot: ShootType, packages: readonly PricingPackage[], @@ -14,12 +13,8 @@ export function shootContactLink( (pkg) => pkg.id === shoot.packageId, ); return shown && shoot.packageId !== undefined - ? { - to: '/' as const, - search: { pakket: shoot.packageId }, - hash: 'contact', - } - : { to: '/' as const, hash: 'contact' }; + ? { to: '/contact' as const, search: { pakket: shoot.packageId } } + : { to: '/contact' as const }; } // "Bekijk meer …foto's": the portfolio filtered on this shoot type diff --git a/web/src/lib/withReplyTime.test.ts b/web/src/lib/withReplyTime.test.ts new file mode 100644 index 0000000..35d14cb --- /dev/null +++ b/web/src/lib/withReplyTime.test.ts @@ -0,0 +1,60 @@ +import fc from 'fast-check'; +import { describe, expect, it } from 'vitest'; +import contactContent from '../content/contactContent'; +import siteContent from '../content/siteContent'; +import { REPLY_TIME_PLACEHOLDER, withReplyTime } from './withReplyTime'; + +// Text with some placeholders in it, as an editor might write it. Plain +// pieces have no braces: half a placeholder around a real one could +// otherwise form a new one, which content never contains. +const plain = fc.string().filter((text) => !/[{}]/.test(text)); +const template = fc + .array(fc.oneof(plain, fc.constant(REPLY_TIME_PLACEHOLDER))) + .map((pieces) => pieces.join('')); +const replyTime = fc + .string() + .filter((value) => !value.includes(REPLY_TIME_PLACEHOLDER)); + +describe('withReplyTime', () => { + it('fills in the reply time of the site in the contact intro', () => { + expect( + withReplyTime( + contactContent.head.intro, + siteContent.contactForm.replyTime, + ), + ).toBe( + 'Wil je een fotoshoot boeken of meer informatie ontvangen? Stuur me een berichtje, ik reageer binnen 1-2 werkdagen.', + ); + }); + + it('leaves no placeholder behind (invariant)', () => { + fc.assert( + fc.property(template, replyTime, (text, time) => { + expect(withReplyTime(text, time)).not.toContain( + REPLY_TIME_PLACEHOLDER, + ); + }), + ); + }); + + it('returns text without the placeholder as it is (invariant)', () => { + fc.assert( + fc.property( + fc.string().filter((t) => !t.includes(REPLY_TIME_PLACEHOLDER)), + fc.string(), + (text, time) => { + expect(withReplyTime(text, time)).toBe(text); + }, + ), + ); + }); + + it('puts the reply time exactly where the placeholders were (oracle)', () => { + fc.assert( + fc.property(fc.array(plain), replyTime, (pieces, time) => { + const text = pieces.join(REPLY_TIME_PLACEHOLDER); + expect(withReplyTime(text, time)).toBe(pieces.join(time)); + }), + ); + }); +}); diff --git a/web/src/lib/withReplyTime.ts b/web/src/lib/withReplyTime.ts new file mode 100644 index 0000000..78b18bc --- /dev/null +++ b/web/src/lib/withReplyTime.ts @@ -0,0 +1,8 @@ +// The placeholder for the reply time in content texts (BR-CP-05) +export const REPLY_TIME_PLACEHOLDER = '{reactietermijn}'; + +// Fills in the reply time, so a text and the form's thank-you always name +// the same one. Text without the placeholder comes back as it is. +export function withReplyTime(text: string, replyTime: string): string { + return text.split(REPLY_TIME_PLACEHOLDER).join(replyTime); +} diff --git a/web/src/recipes/linkButton.ts b/web/src/recipes/linkButton.ts index cdc247a..3e96d73 100644 --- a/web/src/recipes/linkButton.ts +++ b/web/src/recipes/linkButton.ts @@ -28,15 +28,16 @@ const linkButtonRecipe = defineRecipe({ _hover: { bg: 'ink', color: 'paper' }, _focusVisible: { bg: 'ink', color: 'paper' }, }, - // Gevuld met het heidegroen + // Filled with the deep heidegroen: white on the design's lighter + // accent is only 3.58:1, on accent.deep about 5.7:1 (WCAG AA) accent: { - borderColor: 'accent', - bg: 'accent', + borderColor: 'accent.deep', + bg: 'accent.deep', color: 'white', - _hover: { bg: 'accent.deep', borderColor: 'accent.deep' }, + _hover: { bg: 'accent.deeper', borderColor: 'accent.deeper' }, _focusVisible: { - bg: 'accent.deep', - borderColor: 'accent.deep', + bg: 'accent.deeper', + borderColor: 'accent.deeper', }, }, // Wit, voor over foto's diff --git a/web/src/routes/contact.tsx b/web/src/routes/contact.tsx index 4b94308..9597755 100644 --- a/web/src/routes/contact.tsx +++ b/web/src/routes/contact.tsx @@ -1,17 +1,105 @@ -import { createFileRoute } from '@tanstack/react-router'; +import { useEffect } from 'react'; +import { Box, Grid, Heading, VisuallyHidden } from '@chakra-ui/react'; +import { createFileRoute, useNavigate } from '@tanstack/react-router'; +import ContactAside from '../components/contact/ContactAside/ContactAside'; +import ContactDetails from '../components/ContactDetails/ContactDetails'; +import ContactPanel from '../components/ContactPanel/ContactPanel'; import PageIntro from '../components/PageIntro/PageIntro'; -import { pageHead } from '../seo'; +import PageSection from '../components/PageSection/PageSection'; +import Reveal from '../components/Reveal/Reveal'; +import contactContent from '../content/contactContent'; +import packages from '../content/packages'; +import siteContent from '../content/siteContent'; +import { withReplyTime } from '../lib/withReplyTime'; +import { contactPage, pageHead, structuredDataScript } from '../seo'; + +// ?pakket= from a link elsewhere on the site. Only text is kept; the panel +// checks it against the shown packages (BR-CP-10). +type ContactSearch = { pakket?: string }; + +const FORM_TITLE_ID = 'contact-form-title'; export const Route = createFileRoute('/contact')({ - head: () => pageHead('/contact'), + validateSearch: (search: Record): ContactSearch => + typeof search.pakket === 'string' ? { pakket: search.pakket } : {}, + head: () => ({ + ...pageHead('/contact'), + scripts: [structuredDataScript(contactPage('/contact'))], + }), component: Contact, }); -// Placeholder tot de echte pagina er is (noindex via sitePages) +// The contact page (mockup 1a): the form next to the photo with the contact +// card on wide screens; below lg the card with a small portrait above the +// form (BR-CP-01..04). The card is in the page twice, one per layout, so the +// reading order always matches what is shown. function Contact() { + const { pakket } = Route.useSearch(); + const navigate = useNavigate(); + const { head, formTitle, detailsTitle, image, portrait } = contactContent; + const { email, socials, contactForm } = siteContent; + + // The panel has taken the package over; tidy the address bar without a + // history entry. It is a fresh page, so no scrolling or focus move + // (BR-CP-12). + useEffect(() => { + if (pakket === undefined) return; + void navigate({ + to: '/contact', + search: {}, + replace: true, + resetScroll: false, + }); + }, [pakket, navigate]); + + const details = (variant: 'narrow' | 'wide') => ( + + ); + return ( - - Deze pagina is nog in de maak. Kom snel terug! - + <> + + {withReplyTime(head.intro, contactForm.replyTime)} + + + + {details('narrow')} + + + + + + {formTitle} + + + + + {details('wide')} + + + ); } diff --git a/web/src/seo.test.ts b/web/src/seo.test.ts index 8c7b91d..ad35791 100644 --- a/web/src/seo.test.ts +++ b/web/src/seo.test.ts @@ -12,6 +12,7 @@ import { areaServed, businessId, canonicalUrl, + contactPage, defaultOgImage, jsonLdScript, pageHead, @@ -569,3 +570,55 @@ describe('shootServices', () => { ); }); }); + +describe('the contact page', () => { + it('is indexed, with its own title, description and preview image', () => { + const head = pageHead('/contact'); + expect(head.meta[0]).toEqual({ + title: 'Contact – fotoshoot boeken in Huizen | Andrea Slop Fotografie', + }); + expect(meta(head, 'robots')).toBeUndefined(); + expect(meta(head, 'og:image')).toMatchObject({ + content: `${siteUrl}/og-contact.jpg`, + }); + expect(head.links[0].href).toBe(`${siteUrl}/contact`); + }); + + it('keeps title and description within what search engines show', () => { + const page = sitePages['/contact']; + // 61: one over the guideline, accepted to keep "Contact" first + expect( + `${page.title} | Andrea Slop Fotografie`.length, + ).toBeLessThanOrEqual(61); + expect(page.description.length).toBeLessThanOrEqual(155); + }); + + it('describes the page as a ContactPage about the business', () => { + expect(contactPage('/contact')).toEqual({ + '@context': 'https://schema.org', + '@type': 'ContactPage', + '@id': `${siteUrl}/contact`, + url: `${siteUrl}/contact`, + name: sitePages['/contact'].title, + description: sitePages['/contact'].description, + inLanguage: 'nl-NL', + about: { '@id': businessId }, + }); + }); + + it('never contains an e-mail address and survives the script tag (invariant, round trip)', () => { + fc.assert( + fc.property( + fc.constantFrom(...(Object.keys(sitePages) as RoutePath[])), + (path) => { + const data = contactPage(path); + const script = jsonLdScript(data); + expect(script).not.toMatch(/@[a-z0-9-]+\.[a-z]/i); + expect(JSON.parse(script)).toEqual(data); + expect(data['@id']).toBe(canonicalUrl(path)); + expect(data.about).toEqual({ '@id': businessId }); + }, + ), + ); + }); +}); diff --git a/web/src/seo.ts b/web/src/seo.ts index 3ef4cfd..ea1a380 100644 --- a/web/src/seo.ts +++ b/web/src/seo.ts @@ -167,6 +167,12 @@ export function aboutPage( }); } +// The contact page, about the business (SEO-CP-03); no e-mail address, for +// the same reason as above +export function contactPage(path: RoutePath) { + return webPage('ContactPage', path, { about: { '@id': businessId } }); +} + // An image URL for structured data: bundled images have a path, which // becomes absolute on the site; an absolute URL stays as it is (BR-SF-13) export function absoluteUrl(src: string): string { diff --git a/web/src/sitePages.ts b/web/src/sitePages.ts index f4a8bf3..f9cf54c 100644 --- a/web/src/sitePages.ts +++ b/web/src/sitePages.ts @@ -56,10 +56,16 @@ const sitePages: Record = { }, }, '/contact': { - title: 'Contact', + title: 'Contact – fotoshoot boeken in Huizen', description: - 'Neem contact op met Andrea Slop Fotografie voor een fotoshoot in Huizen en omgeving. Ik denk graag met je mee over jullie wensen.', - indexed: false, + 'Neem contact op voor een newborn-, zwangerschaps- of gezinsshoot in Huizen, het Gooi en omgeving. Ik denk graag met je mee en reageer binnen 1-2 werkdagen.', + indexed: true, + ogImage: { + path: '/og-contact.jpg', + width: 1200, + height: 630, + alt: 'Andrea Slop met haar camera op een bospad', + }, }, '/privacyverklaring': { title: 'Privacyverklaring', diff --git a/web/src/sitemap.test.ts b/web/src/sitemap.test.ts index 465e2e1..e6c69e5 100644 --- a/web/src/sitemap.test.ts +++ b/web/src/sitemap.test.ts @@ -22,6 +22,7 @@ describe('sitemapXml', () => { `${base}/`, `${base}/over-mij`, `${base}/soorten-fotoshoots`, + `${base}/contact`, ]); }); diff --git a/web/src/theme.ts b/web/src/theme.ts index 94047bb..6fd81f0 100644 --- a/web/src/theme.ts +++ b/web/src/theme.ts @@ -53,7 +53,10 @@ const config = defineConfig({ line: { value: '#e2dad0' }, // hairlines accent: { DEFAULT: { value: '#7f8b76' }, // heidegroen - deep: { value: '#5f6a58' }, // accent hover + // Text and buttons in heidegroen: white on it meets 4.5:1 + deep: { value: '#5f6a58' }, + // Hover on a deep-green button (deep at 75%) + deeper: { value: '#475042' }, }, sand: { value: '#d9cdbc' }, // zachte vlakken en decoratie // Blocks behind the shoot photos, one per shoot type, taken