Adds the portfolio page

The ten live photos in a filterable masonry grid with an accessible
lightbox, filters per shoot type kept in the URL (?shoot=), the shared
Instagram block, and an indexed page with image gallery structured data
and its own preview image. Soorten fotoshoots now only links to the
portfolio for shoot types that have photos there.

The filter bar stays on one row, so the web font loading no longer
shifts the photos below it, and no photo loads before the page has: the
grid fades in, so loading its photos early only delayed the fonts and the
intro text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 19:05:13 +01:00
co-authored by Claude Opus 5.5
parent 18bf0311ef
commit 9efa7fc596
58 changed files with 1492 additions and 48 deletions
+86 -7
View File
@@ -101,12 +101,17 @@ describe('app', () => {
);
it('zet titel en noindex van een placeholder in de head', async () => {
await renderApp('/portfolio');
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
expect(document.title).toBe('Portfolio | Andrea Slop Fotografie');
await renderApp('/privacyverklaring');
await screen.findByRole('heading', {
level: 1,
name: 'Privacyverklaring',
});
expect(document.title).toBe(
'Privacyverklaring | Andrea Slop Fotografie',
);
expect(
document.head.querySelector('link[rel="canonical"]'),
).toHaveAttribute('href', 'https://andreaslop.nl/portfolio');
).toHaveAttribute('href', 'https://andreaslop.nl/privacyverklaring');
expect(
document.head.querySelector('meta[name="robots"]'),
).toHaveAttribute('content', 'noindex');
@@ -265,7 +270,7 @@ describe('app', () => {
'/contact',
]);
// Links to the filtered portfolio only once that page is live
// (indexed); they switch on by themselves when it is
// (indexed), and only for shoot types with portfolio photos
expect(
within(main)
.queryAllByRole('link', { name: /^Bekijk meer/ })
@@ -276,8 +281,6 @@ describe('app', () => {
'/portfolio?shoot=newborn',
'/portfolio?shoot=zwangerschap',
'/portfolio?shoot=gezin',
'/portfolio?shoot=loveshoot',
'/portfolio?shoot=portret',
]
: [],
);
@@ -304,6 +307,82 @@ describe('app', () => {
expect(await axeResults(container)).toHaveNoViolations();
});
it('shows the portfolio with its outline, filters, photos and structured data', async () => {
const { container } = await renderApp('/portfolio');
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
expectShell();
const main = screen.getByRole('main');
expect(
within(main)
.getAllByRole('heading', { level: 2 })
.map((heading) => heading.textContent),
).toEqual(["Foto's", 'Instagram']);
expect(
within(main).getByRole('button', { name: 'Alles', pressed: true }),
).toBeInTheDocument();
expect(
within(screen.getByTestId('portfolio-grid')).getAllByRole('link'),
).toHaveLength(10);
expect(document.title).toBe('Portfolio | Andrea Slop Fotografie');
expect(document.head.querySelector('meta[name="robots"]')).toBeNull();
expect(
document.head.querySelector('link[rel="canonical"]'),
).toHaveAttribute('href', 'https://andreaslop.nl/portfolio');
expect(
document.head.querySelector('meta[property="og:image"]'),
).toHaveAttribute('content', 'https://andreaslop.nl/og-portfolio.jpg');
const data = [
...document.querySelectorAll('script[type="application/ld+json"]'),
].map((script) => JSON.parse(script.textContent!));
const gallery = data.find((item) => item['@type'] === 'ImageGallery');
expect(gallery.associatedMedia).toHaveLength(10);
expect(await axeResults(container)).toHaveNoViolations();
});
it('starts the portfolio filtered on ?shoot= and keeps the canonical URL plain', async () => {
await renderApp('/portfolio?shoot=gezin');
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
expect(
screen.getByRole('button', { name: 'Gezin', pressed: true }),
).toBeInTheDocument();
expect(
within(screen.getByTestId('portfolio-grid')).getAllByRole('link'),
).toHaveLength(2);
expect(
document.head.querySelector('link[rel="canonical"]'),
).toHaveAttribute('href', 'https://andreaslop.nl/portfolio');
});
it.each(['onzin', 'loveshoot', '%3Cscript%3E'])(
'shows the whole portfolio for ?shoot=%s',
async (value) => {
await renderApp(`/portfolio?shoot=${value}`);
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
expect(
screen.getByRole('button', { name: 'Alles', pressed: true }),
).toBeInTheDocument();
expect(
within(screen.getByTestId('portfolio-grid')).getAllByRole(
'link',
),
).toHaveLength(10);
},
);
it('puts the chosen filter in the URL without a history entry', async () => {
const { router } = await renderApp('/portfolio');
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
const user = userEvent.setup();
await user.click(screen.getByRole('button', { name: 'Newborn' }));
await waitFor(() =>
expect(router.state.location.search).toEqual({ shoot: 'newborn' }),
);
expect(router.history.length).toBe(1);
await user.click(screen.getByRole('button', { name: 'Alles' }));
await waitFor(() => expect(router.state.location.search).toEqual({}));
});
it('toont een onbekende URL als 404 binnen de shell', async () => {
const { container } = await renderApp('/bestaat-niet');
expect(