Behind the site

How this site is built

I built this portfolio with Astro, TypeScript, HTML and CSS, with browser JavaScript for the menu and image viewer.

The build produces static pages. Project content lives in Markdown, and the page layouts and navigation are shared components.

Project content

Each project has a Markdown file with its title, summary, my role, dates, tools and images. The content collection checks the required fields during the build and reports anything missing.

The pages use shared layouts. I can change a layout or add a project example in one place, then rebuild the site.

Read the actual project collection schema
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';

const work = defineCollection({
  loader: glob({ pattern: '**/*.md', base: './src/content/work' }),
  schema: ({ image }) =>
    z.object({
      title: z.string(),
      headline: z.string(),
      summary: z.string(),
      // 'experience': an employment role; other kinds describe individual projects
      kind: z.enum(['case-study', 'freelance', 'design', 'experience']),
      order: z.number(),
      client: z.string(),
      role: z.string(),
      stack: z.array(z.string()),
      timeline: z.string(),
      status: z.string(),
      url: z.string().url().optional(),
      highlights: z.array(z.string()).default([]),
      cover: image(),
      coverAlt: z.string(),
      // Cards use an individually cropped screenshot; project pages retain the original cover.
      cardCover: z.object({ image: image(), alt: z.string().min(1) }).optional(),
      // screenshots get a browser frame; Luke's device mockups are shown as-is
      coverFrame: z.enum(['browser', 'none']).default('browser'),
      related: z.array(z.string()).default([]),
      credit: z.string().optional(),
      disclaimer: z.string().optional(),
      example: z.object({
        title: z.string(), intro: z.string(), thumb: z.string(), full: z.string(), alt: z.string(),
        points: z.array(z.object({ label: z.string(), text: z.string() })),
      }).optional(),
    }),
});

export const collections = { work };

Images

Astro generates responsive sizes for the project covers and photography. Screenshot galleries use small thumbnails in the grid and load the full capture when it is opened.

Navigation and galleries

Project screenshots and photos are ordinary image links first. JavaScript adds a shared dialog with previous and next controls, actual-size viewing, Escape to close, and focus returned to the image that opened it. Navigation has a skip link and visible keyboard focus.

Keyboard focus in the viewer

The code below opens the viewer and returns keyboard focus when it closes. Focus moves to the scrollable image area when it opens, then back to the original link when it closes. Ctrl- or Command-click keeps the normal image link behavior.

The full image downloads when someone opens it. A message stays visible while it loads and decodes. If the download fails, there’s a retry button and a link to open the original file.

Read the viewer’s opening and focus-return handlers
const openFrom = (a: HTMLAnchorElement, i: number, e: MouseEvent) => {
  if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
  e.preventDefault();
  opener = a;
  show(i);
  document.documentElement.classList.add('viewer-open');
  dialog.showModal();
  scroller.focus({ preventScroll: true });
};
dialog.addEventListener('close', () => {
  imageRequest++;
  document.documentElement.classList.remove('viewer-open');
  opener?.focus();
});

Résumé and PDF

The résumé page and downloadable PDF use the same experience, education, skills, and project data. The PDF is generated separately and stored with the site, so downloading it does not depend on a browser print dialog.