To build an agency website with Astro, put case studies and services in content collections, give each case study its own statically generated page, add a project brief form that posts to a form backend, and deploy the static build to a CDN host. An agency website built with Astro loads fast because it ships zero JavaScript by default, which matters when the site itself is evidence of your craft.
This guide covers the page structure agencies need, the Astro 7 code for case studies and services, how to add motion without slowing the site, and how to launch.
Key Takeaways
- Case studies are the core of an agency site. Model them as a collection with client, services, year, results and cover image.
- Generate one page per case study with
getStaticPaths()and link related work by service.- Add motion with CSS and Astro’s view transitions before reaching for an animation library.
- Use a short project brief form, not a generic contact form, and post it to a form backend.
- Static output means no server to maintain, which suits agencies that hand sites to clients too.
The pages an agency site needs
Prospective clients scan an agency site for three things: work like theirs, proof it worked, and an easy way to start a conversation. Everything else supports those.
| Page | What it does |
|---|---|
| Home | Positioning line, three to six featured case studies, client logos, brief CTA |
| Work | Filterable grid of every case study |
| Case study | Problem, approach, result, credits, next project |
| Services | What you do, how you price or scope it, related work |
| About | Team, process, values, locations |
| Journal | Articles that show expertise and earn search traffic |
| Start a project | Brief form with budget and timeline fields |
Keep the navigation to these. Agencies often add pages for every service line; one Services page with anchored sections is easier to keep current.
Set up the project
# Terminal
npm create astro@latest agency-site
cd agency-site
npx astro add mdx
npm run dev
MDX is worth adding for case studies because you’ll want custom components inside the story: before-and-after sliders, video embeds or metric blocks. If you’d rather start from a finished design, the Astro portfolio and agency themes category is the largest on this site, with over 1,000 themes. Cast & Render is one example built for a studio, with Works, Journal and a Start a brief page already wired up. For a free starting point, AstroWind is a popular community template with a general business layout, and Astro’s official portfolio starter is a clean base if you want to design everything yourself. The best Astro agency templates roundup compares more options.
Model case studies as a content collection
// src/content.config.ts
import { defineCollection, reference } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const services = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/services' }),
schema: z.object({
title: z.string(),
summary: z.string(),
order: z.number(),
}),
});
const work = defineCollection({
loader: glob({ pattern: '**/*.mdx', base: './src/content/work' }),
schema: ({ image }) =>
z.object({
title: z.string(),
client: z.string(),
year: z.number(),
services: z.array(reference('services')),
summary: z.string().max(180),
cover: image(),
coverAlt: z.string(),
results: z.array(z.object({ value: z.string(), label: z.string() })).default([]),
featured: z.boolean().default(false),
}),
});
export const collections = { services, work };
reference('services') links each case study to service entries by ID, and the build fails if a case study names a service that doesn’t exist. That keeps the Services page and the work grid in sync as the agency’s offering changes.
A case study file:
---
# src/content/work/harbor-coffee-rebrand.mdx
title: "Rebranding a regional coffee roaster"
client: "Harbor Coffee"
year: 2026
services: ["brand-identity", "web-design"]
summary: "New identity, packaging system and a site that doubled online orders."
cover: "./harbor/cover.jpg"
coverAlt: "Harbor Coffee bags in the new navy and copper packaging"
results:
- value: "2x"
label: "online orders in the first quarter"
featured: true
---
## The problem
Harbor had grown from one café to nine, but the brand still looked like a single shop.
Only include results the client has approved for publication. Vague, unverifiable numbers on a case study hurt credibility more than having none.
Generate a page per case study
---
// src/pages/work/[id].astro
import { getCollection, getEntries, render } from 'astro:content';
import { Image } from 'astro:assets';
import BaseLayout from '../../layouts/BaseLayout.astro';
export async function getStaticPaths() {
const work = (await getCollection('work')).sort((a, b) => b.data.year - a.data.year);
return work.map((entry, i) => ({
params: { id: entry.id },
props: { entry, next: work[(i + 1) % work.length] },
}));
}
const { entry, next } = Astro.props;
const { Content } = await render(entry);
const services = await getEntries(entry.data.services);
---
<BaseLayout title={`${entry.data.title} | Case study`} description={entry.data.summary}>
<article>
<p>{entry.data.client}, {entry.data.year}</p>
<h1>{entry.data.title}</h1>
<ul class="tags">{services.map((s) => <li>{s.data.title}</li>)}</ul>
<Image src={entry.data.cover} alt={entry.data.coverAlt} widths={[640, 1280, 1920]} sizes="100vw" loading="eager" />
{entry.data.results.length > 0 && (
<dl class="results">
{entry.data.results.map((r) => (<div><dt>{r.label}</dt><dd>{r.value}</dd></div>))}
</dl>
)}
<Content />
</article>
<a href={`/work/${next.id}/`}>Next project: {next.data.title}</a>
</BaseLayout>
The “next project” link keeps visitors moving through your work, which is the behavior you want on an agency site. Setting loading="eager" on the cover helps Largest Contentful Paint, since the cover is usually the biggest element on the page. The Astro routing guide covers getStaticPaths() in more depth.
A filterable work grid without a framework
You don’t need React to filter a dozen case studies. Render every card, add the service IDs as a data attribute, and filter with a small script.
---
// src/pages/work/index.astro
import { getCollection } from 'astro:content';
import BaseLayout from '../../layouts/BaseLayout.astro';
const work = await getCollection('work');
const services = await getCollection('services');
---
<BaseLayout title="Work" description="Selected client projects.">
<h1>Work</h1>
<div role="group" aria-label="Filter by service">
<button type="button" data-filter="all" aria-pressed="true">All</button>
{services.map((s) => <button type="button" data-filter={s.id} aria-pressed="false">{s.data.title}</button>)}
</div>
<ul class="grid">
{work.map((w) => (
<li data-services={w.data.services.map((s) => s.id).join(' ')}>
<a href={`/work/${w.id}/`}>{w.data.title}</a>
</li>
))}
</ul>
</BaseLayout>
<script>
const buttons = document.querySelectorAll<HTMLButtonElement>('[data-filter]');
const cards = document.querySelectorAll<HTMLElement>('[data-services]');
buttons.forEach((btn) =>
btn.addEventListener('click', () => {
const f = btn.dataset.filter!;
buttons.forEach((b) => b.setAttribute('aria-pressed', String(b === btn)));
cards.forEach((c) => {
c.hidden = f !== 'all' && !c.dataset.services!.split(' ').includes(f);
});
}),
);
</script>
Astro bundles and minifies this script automatically. Without JavaScript, every case study is still listed, so nothing is lost.
Motion that doesn’t cost performance
Agency sites often lean on animation. Start with what the browser gives you:
- View transitions. Add
<ClientRouter />fromastro:transitionsto your layout’s head for animated page changes, and give the case study cover a matchingtransition:nameon the grid and detail page so it morphs between them. - CSS scroll-driven animations.
animation-timeline: view()fades sections in as they scroll into view, with no JavaScript. - Respect reduced motion. Wrap animations in
@media (prefers-reduced-motion: no-preference).
/* src/styles/motion.css */
@media (prefers-reduced-motion: no-preference) {
.reveal {
animation: reveal linear both;
animation-timeline: view();
animation-range: entry 0% cover 30%;
}
@keyframes reveal {
from { opacity: 0; transform: translateY(24px); }
to { opacity: 1; transform: none; }
}
}
If a design truly needs timeline animation or scroll pinning, load a library like GSAP only on the pages that use it, inside a <script> tag. The view transitions docs explain the transition:* directives.
The project brief form
A brief form qualifies leads better than “Name, Email, Message”. Ask for company, what they need, budget range and timeline. On a static site, post the form to a form backend or your host’s form feature:
---
// src/pages/start-a-project.astro
import BaseLayout from '../layouts/BaseLayout.astro';
---
<BaseLayout title="Start a project" description="Tell us about your project.">
<h1>Start a project</h1>
<form method="POST" action="https://formspree.io/f/your-form-id">
<label>Name <input name="name" required autocomplete="name" /></label>
<label>Email <input name="email" type="email" required autocomplete="email" /></label>
<label>Company <input name="company" autocomplete="organization" /></label>
<label>What do you need?
<textarea name="brief" rows="5" required></textarea>
</label>
<label>Budget
<select name="budget">
<option>Under $10k</option>
<option>$10k to $30k</option>
<option>$30k+</option>
</select>
</label>
<button type="submit">Send brief</button>
</form>
</BaseLayout>
Replace the action URL with your own provider. The static contact forms guide compares Formspree, Netlify Forms and other backends.
SEO for an agency site
Agency sites compete on brand and location searches more than broad keywords. Three things help most:
- Unique titles and descriptions per case study, naming the client and the service.
- Structured data:
OrganizationorProfessionalServiceon the home page with your address if you serve a local market. - A journal with real articles about your process. These earn links and long-tail traffic that case studies alone don’t.
Set site in astro.config.mjs, then add the sitemap integration with npx astro add sitemap. The Astro SEO checklist walks through the rest.
Launch and hand-off
npm run build writes a static dist/ folder. Deploy it to Cloudflare Pages, Netlify or Vercel by connecting the repo; each rebuilds on push and handles HTTPS. The Cloudflare Pages deploy docs cover the setup.
If you build sites for clients as well, the same structure works for them. Keep the content in collections, document where each piece lives, and the client’s team can add case studies or posts without touching layouts.
FAQ
Is Astro good for agency websites?
Yes. Astro produces fast static pages with no JavaScript unless you add it, so case studies and large images load quickly. Content collections keep case studies structured, and you can still add React, Svelte or Vue components where a page needs interactivity.
How do I add case studies to an Astro site?
Create a work content collection in src/content.config.ts with fields like client, year, services, summary and cover image, add one Markdown or MDX file per project, and generate a page for each with getStaticPaths() in src/pages/work/[id].astro.
Can I add animations to an Astro agency website?
Yes. Use Astro’s view transitions for page changes, CSS scroll-driven animations for reveal effects, and a library such as GSAP in a <script> tag for complex timelines. Load heavy libraries only on the pages that use them and respect prefers-reduced-motion.
How do contact forms work on a static Astro agency site?
Point the form’s action at a form backend such as Formspree, or use your host’s form handling like Netlify Forms. The service receives submissions and emails them to you, so the site stays static. Use server rendering with Astro Actions only if you need custom processing.
Should an agency use an Astro theme or build from scratch?
Use a theme if you need to launch quickly and the layout fits your positioning, then customize type, color and content. Build from scratch if your site is itself the main showcase of a distinctive design approach. Either way, the content collection structure is the same.