To build a law firm website with Astro, model practice areas and attorney profiles as content collections, give each its own static page, add a consultation request form with a clear “no attorney-client relationship” notice, mark up the firm with LegalService structured data, and deploy to a static host. A law firm website built this way is fast, has no admin panel or plugins to keep patched, and keeps sensitive client details off your web server.
This guide covers the pages a firm needs, the Astro 7 code, and the legal-marketing details developers often miss.
Key Takeaways
- Practice area pages and attorney bios do most of the work. Each deserves its own URL, title and description.
- Show disclaimers near forms: submitting a form does not create an attorney-client relationship, and visitors shouldn’t send confidential details.
- Use
LegalServiceJSON-LD with address, phone and hours, and match your Google Business Profile exactly.- Check your jurisdiction’s attorney advertising rules before publishing results, testimonials or “specialist” claims.
- Static output means no database and no login, which suits firms that would rather not run a server.
The pages a law firm site needs
Prospective clients usually arrive with a problem (“divorce lawyer in Austin”, “contract dispute attorney”) and want to know three things fast: do you handle this, are you credible, and how do I talk to someone.
| Page | Purpose |
|---|---|
| Home | Practice areas, locations, consultation CTA, phone |
| Practice areas | One page per area: what you handle, process, typical questions |
| Attorneys | Bio, bar admissions, education, practice areas, languages |
| Results or case studies | Only where your jurisdiction allows, with required disclaimers |
| Insights | Articles explaining the law in plain language |
| Contact | Offices, hours, intake form, phone |
| Legal notices | Disclaimer, privacy policy, cookie notice |
One page per practice area matters for search. A single “Our services” page listing ten areas rarely ranks for any of them.
Set up the project
# Terminal
npm create astro@latest law-firm-site
cd law-firm-site
npx astro add sitemap
npm run dev
If you’d like a finished design to adapt, the Astro professional services themes category covers law, finance and consulting. Law-specific examples include Aawans, with Practice Areas, Attorney and Cases pages, and Alegis, which has separate pages for criminal, family, immigration and tax law. Free alternatives are thinner for law specifically, but general business templates such as AstroWind or Astro’s official starters adapt well if you plan to build the practice area pages yourself.
Model practice areas and attorneys
// src/content.config.ts
import { defineCollection, reference } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const attorneys = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/attorneys' }),
schema: ({ image }) =>
z.object({
name: z.string(),
title: z.enum(['Partner', 'Senior Associate', 'Associate', 'Of Counsel']),
barAdmissions: z.array(z.string()).min(1),
education: z.array(z.string()),
languages: z.array(z.string()).default(['English']),
email: z.string().email().optional(),
photo: image(),
photoAlt: z.string(),
order: z.number().default(99),
}),
});
const practiceAreas = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/practice-areas' }),
schema: z.object({
title: z.string(),
summary: z.string().max(200),
attorneys: z.array(reference('attorneys')),
faqs: z.array(z.object({ q: z.string(), a: z.string() })).default([]),
}),
});
export const collections = { attorneys, practiceAreas };
Requiring at least one bar admission (.min(1)) is a small guard that stops an attorney profile going live without the detail clients and regulators most expect to see.
---
# src/content/practice-areas/family-law.md
title: "Family law"
summary: "Divorce, custody, support and prenuptial agreements, with fixed-fee options for uncontested cases."
attorneys: ["maria-lopez", "james-carter"]
faqs:
- q: "How long does an uncontested divorce take?"
a: "It depends on your state's waiting period and court schedule. We explain the timeline in your first consultation."
---
## What we handle
Divorce, child custody and visitation, child and spousal support, and property division.
Practice area pages with an FAQ
Each practice area page should explain the area in plain language, show who handles it, and answer the questions clients ask on the first call.
---
// src/pages/practice-areas/[id].astro
import { getCollection, getEntries, render } from 'astro:content';
import BaseLayout from '../../layouts/BaseLayout.astro';
export async function getStaticPaths() {
const areas = await getCollection('practiceAreas');
return areas.map((area) => ({ params: { id: area.id }, props: { area } }));
}
const { area } = Astro.props;
const { Content } = await render(area);
const team = await getEntries(area.data.attorneys);
const faqSchema = area.data.faqs.length > 0 && {
'@context': 'https://schema.org',
'@type': 'FAQPage',
mainEntity: area.data.faqs.map((f) => ({
'@type': 'Question',
name: f.q,
acceptedAnswer: { '@type': 'Answer', text: f.a },
})),
};
---
<BaseLayout title={`${area.data.title} lawyers`} description={area.data.summary}>
<h1>{area.data.title}</h1>
<Content />
<h2>Attorneys in this practice</h2>
<ul>{team.map((a) => <li><a href={`/attorneys/${a.id}/`}>{a.data.name}, {a.data.title}</a></li>)}</ul>
{area.data.faqs.length > 0 && (
<section>
<h2>Common questions</h2>
{area.data.faqs.map((f) => (<><h3>{f.q}</h3><p>{f.a}</p></>))}
</section>
)}
<a href="/contact/">Request a consultation</a>
{faqSchema && <script type="application/ld+json" set:html={JSON.stringify(faqSchema)} />}
</BaseLayout>
FAQ answers should be general information, not legal advice for a specific situation. Keep them short and point to a consultation for anything that depends on the facts. The FAQ section with schema component shows a reusable version of this pattern.
A consultation form that protects the firm
Law firm forms carry a specific risk: a visitor may send confidential details before any conflict check, and in some jurisdictions that can create obligations for the firm. Put the notice right above the submit button, and keep the form short.
---
// src/components/ConsultationForm.astro
const action = import.meta.env.PUBLIC_FORM_ENDPOINT;
---
<form method="POST" action={action}>
<label>Full name <input name="name" required autocomplete="name" /></label>
<label>Email <input name="email" type="email" required autocomplete="email" /></label>
<label>Phone <input name="phone" type="tel" autocomplete="tel" /></label>
<label>Practice area
<select name="area" required>
<option value="">Choose one</option>
<option>Family law</option>
<option>Business law</option>
<option>Estate planning</option>
</select>
</label>
<label>Briefly, what do you need help with?
<textarea name="summary" rows="4" maxlength="500"></textarea>
</label>
<p class="notice">
Submitting this form does not create an attorney-client relationship.
Please do not include confidential information until we confirm we can represent you.
</p>
<label><input type="checkbox" name="ack" required /> I understand the notice above.</label>
<button type="submit">Request consultation</button>
</form>
The maxlength on the summary nudges people toward a brief description instead of their whole case. The form posts to whatever backend you set in PUBLIC_FORM_ENDPOINT; the static contact forms guide compares services. If the firm uses a legal practice management system with its own intake form, link to that instead.
LegalService schema and local SEO
Most law firm searches include a location. Make the firm easy to place:
---
// src/components/FirmSchema.astro
const schema = {
'@context': 'https://schema.org',
'@type': 'LegalService',
name: 'Lopez & Carter LLP',
url: Astro.site?.href,
telephone: '+1-512-555-0142',
priceRange: '$$',
address: {
'@type': 'PostalAddress',
streetAddress: '800 Congress Ave, Suite 1200',
addressLocality: 'Austin',
addressRegion: 'TX',
postalCode: '78701',
addressCountry: 'US',
},
openingHours: 'Mo-Fr 09:00-17:30',
areaServed: 'Travis County, Texas',
};
---
<script type="application/ld+json" set:html={JSON.stringify(schema)} />
Add a Person object to each attorney page with jobTitle, worksFor and alumniOf. For firms with several offices, give each office its own page and its own LegalService block. The JSON-LD structured data guide covers generating these from collections, and schema.org documents the LegalService type.
Advertising rules and disclaimers
This is the part of a law firm build where the developer should defer to the firm. Many jurisdictions regulate lawyer advertising, and the rules commonly touch:
- Case results: often require a disclaimer that past results don’t guarantee future outcomes.
- Testimonials and reviews: allowed in some places, restricted in others.
- “Specialist” or “expert”: often limited to lawyers certified by a recognized body.
- Firm name and responsible attorney: some rules require naming the attorney responsible for the site.
Build the site so these are easy to comply with. A disclaimer field on the results collection, a site-wide footer notice, and a separate legal notices page cover most needs. Then ask the firm to sign off before launch.
Performance and accessibility
Law firm sites tend to be content-heavy and image-light, which is ideal for Astro. A few checks:
- Attorney photos through
<Image />fromastro:assets, sized to how they display. - Fonts self-hosted, with one or two weights. Many firm sites load four serif weights they barely use.
- Phone numbers as
tel:links, addresses as text. - Clear focus styles and real labels on every form field.
- No chat widget on page load. If the firm wants live chat, load it after interaction or on the contact page only.
Run Lighthouse on the practice area pages as well as the home page, since those are where search traffic lands.
Deploy
npm run build writes static files to dist/. Connect the repo to Cloudflare Pages, Netlify or Vercel and every push rebuilds. Static hosting removes the usual law-firm-website worries: no admin login to brute-force, no outdated plugins, no database backups. The static deploy docs cover each host, and the official Astro deploy guides list more options.
FAQ
Is Astro good for a law firm website?
Yes. Astro builds fast static pages with no database or admin panel, which reduces both maintenance and attack surface. Practice areas and attorney bios fit content collections, so each gets its own indexable page with consistent structure.
What pages should a law firm website have?
At minimum: a home page, one page per practice area, attorney profiles, a contact page with office details and an intake form, and legal notices including a disclaimer and privacy policy. Many firms add an insights section with plain-language articles.
How do I add a contact form to a static law firm site?
Post the form to a form backend or your host’s form handling, or link to your practice management system’s intake form. Place a notice above the submit button that the form doesn’t create an attorney-client relationship and that visitors shouldn’t send confidential details.
What schema markup should a law firm use?
Use schema.org LegalService on the home and office pages with name, address, phone and opening hours, and Person markup on attorney profiles. Add FAQPage markup to practice area pages that include a question-and-answer section.
Can a law firm website show case results?
Often yes, but it depends on your jurisdiction’s attorney advertising rules, which may require disclaimers or restrict certain claims. Have the firm confirm what’s allowed before publishing results, testimonials or specialist titles.