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:
+51
-3
@@ -1,6 +1,7 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import aboutContent from './content/aboutContent';
|
||||
import portfolioContent from './content/portfolioContent';
|
||||
import shootTypes from './content/shootTypes';
|
||||
import siteContent from './content/siteContent';
|
||||
import { emailAddress } from './lib/emailAddress';
|
||||
@@ -14,6 +15,7 @@ import {
|
||||
canonicalUrl,
|
||||
contactPage,
|
||||
defaultOgImage,
|
||||
galleryImages,
|
||||
jsonLdScript,
|
||||
pageHead,
|
||||
person,
|
||||
@@ -30,6 +32,7 @@ import sitePages from './sitePages';
|
||||
import {
|
||||
anySiteContent,
|
||||
knowsAboutEntries,
|
||||
portfolioPhotos,
|
||||
routePath,
|
||||
uniqueShootTypes,
|
||||
} from './test/arbitraries';
|
||||
@@ -93,9 +96,9 @@ describe('pageHead', () => {
|
||||
});
|
||||
|
||||
it('zet noindex op een placeholder', () => {
|
||||
const head = pageHead('/portfolio');
|
||||
const head = pageHead('/privacyverklaring');
|
||||
expect(meta(head, 'robots')).toMatchObject({ content: 'noindex' });
|
||||
expect(head.links[0].href).toBe(`${siteUrl}/portfolio`);
|
||||
expect(head.links[0].href).toBe(`${siteUrl}/privacyverklaring`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -312,7 +315,11 @@ describe('structured data about Andrea', () => {
|
||||
});
|
||||
|
||||
it('falls back to the site preview image for a page without its own', () => {
|
||||
const page = aboutPage('/portfolio', aboutContent.person, siteContent);
|
||||
const page = aboutPage(
|
||||
'/privacyverklaring',
|
||||
aboutContent.person,
|
||||
siteContent,
|
||||
);
|
||||
expect(page.mainEntity.image).toBe(`${siteUrl}/og-image.jpg`);
|
||||
});
|
||||
|
||||
@@ -622,3 +629,44 @@ describe('the contact page', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('galleryImages', () => {
|
||||
it('describes each portfolio photo as an image by Andrea, owned by the business', () => {
|
||||
const images = galleryImages(portfolioContent.photos);
|
||||
expect(images).toHaveLength(10);
|
||||
const first = portfolioContent.photos[0];
|
||||
expect(images[0]).toEqual({
|
||||
'@type': 'ImageObject',
|
||||
contentUrl: absoluteUrl(first.full.src),
|
||||
thumbnailUrl: absoluteUrl(first.thumb.src),
|
||||
description: first.thumb.alt,
|
||||
width: 1067,
|
||||
height: 1600,
|
||||
creator: { '@id': personId },
|
||||
copyrightHolder: { '@id': businessId },
|
||||
});
|
||||
});
|
||||
|
||||
it('gives one image per photo in order, with absolute URLs and the alt text (invariant, oracle)', () => {
|
||||
fc.assert(
|
||||
fc.property(portfolioPhotos, (photos) => {
|
||||
const images = galleryImages(photos);
|
||||
expect(images).toHaveLength(photos.length);
|
||||
images.forEach((image, i) => {
|
||||
expect(image.contentUrl).toMatch(/^https:\/\//);
|
||||
expect(image.thumbnailUrl).toMatch(/^https:\/\//);
|
||||
expect(image.description).toBe(photos[i].thumb.alt);
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('never puts an e-mail address in the gallery script (invariant)', () => {
|
||||
const script = jsonLdScript(
|
||||
webPage('ImageGallery', '/portfolio', {
|
||||
associatedMedia: galleryImages(portfolioContent.photos),
|
||||
}),
|
||||
);
|
||||
expect(script).not.toMatch(/@[a-z0-9-]+\.[a-z]/i);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user