To build a job board with Astro, store each listing as a Markdown file in a content collection, generate one static page per job with getStaticPaths(), add JobPosting structured data so listings can appear in Google’s job search results, and filter the list with a small client-side script. A static Astro job board can run on a free host; you only need a server when employers post jobs and pay through the site itself.
Key Takeaways
- Model jobs and companies as two content collections linked with
reference().- Every job page should output
JobPostingJSON-LD withdatePostedandvalidThrough.- Hide expired jobs at build time and schedule a daily rebuild so they drop off on time.
- Filtering by role, location and type works with
data-attributes and a few lines of script.- Take submissions through a form or a headless CMS before you build accounts and payments.
Plan the job board
Decide early how jobs get onto the site, because it shapes everything else.
| Model | How jobs arrive | What you need |
|---|---|---|
| Curated board | You add listings yourself | Markdown files or a Git-based CMS |
| Submit and review | Employers fill in a form, you approve | A form backend or CMS, a rebuild on publish |
| Self-serve paid | Employers sign up, pay and publish | Adapter, database, auth, payments |
Most niche job boards start curated or submit-and-review. Both run as a static site and both are covered below. The self-serve model is a web application; Astro can host it with an adapter, but plan for authentication, payments and moderation as separate projects.
Model jobs as a content collection
A job has structured fields (title, company, location, salary, dates) plus a free-text description. That fits a Markdown file with frontmatter. Companies repeat across jobs, so give them their own collection and reference them:
// src/content.config.ts
import { defineCollection, reference } from 'astro:content';
import { glob, file } from 'astro/loaders';
import { z } from 'astro/zod';
const companies = defineCollection({
loader: file('src/data/companies.json'),
schema: z.object({
name: z.string(),
website: z.url(),
logo: z.string().optional(),
}),
});
const jobs = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/jobs' }),
schema: z.object({
title: z.string(),
company: reference('companies'),
location: z.string(),
remote: z.boolean().default(false),
type: z.enum(['full-time', 'part-time', 'contract', 'internship']),
salaryMin: z.number().optional(),
salaryMax: z.number().optional(),
currency: z.string().default('USD'),
datePosted: z.coerce.date(),
validThrough: z.coerce.date(),
applyUrl: z.url(),
tags: z.array(z.string()).default([]),
}),
});
export const collections = { companies, jobs };
A listing then looks like this:
---
# src/content/jobs/acme-frontend-engineer.md
title: Frontend Engineer
company: acme
location: Berlin, Germany
remote: true
type: full-time
salaryMin: 70000
salaryMax: 90000
currency: EUR
datePosted: 2026-11-01
validThrough: 2026-12-15
applyUrl: https://acme.example/careers/frontend
tags: [astro, typescript]
---
Acme builds tools for field researchers. You'll own our marketing site and docs...
The file() loader reads companies.json as an array of objects with an id field, so company: acme points to the entry whose id is acme. If a job names a company that doesn’t exist, the build fails with a clear error instead of rendering a broken page. The content collections guide covers loaders and schemas in depth, and the content docs show where collection files live in a project.
Hide expired jobs
Old listings are the fastest way to lose trust on a job board. Filter them in one helper so every page uses the same rule:
// src/lib/jobs.ts
import { getCollection } from 'astro:content';
export async function getOpenJobs() {
const now = new Date();
const jobs = await getCollection('jobs', ({ data }) => data.validThrough >= now);
return jobs.sort((a, b) => b.data.datePosted.getTime() - a.data.datePosted.getTime());
}
On a static site, “now” means build time. A job that expires on Tuesday stays visible until the next build after Tuesday, so schedule a daily rebuild. On GitHub Actions that is a schedule trigger with a cron expression that calls your host’s deploy hook.
Build the job board pages
The listing page
The index renders every open job as a card. The data- attributes are for the filter script in the next section:
---
// src/pages/jobs/index.astro
import { getEntry } from 'astro:content';
import Base from '../../layouts/Base.astro';
import { getOpenJobs } from '../../lib/jobs';
const jobs = await getOpenJobs();
const rows = await Promise.all(
jobs.map(async (job) => ({ job, company: await getEntry(job.data.company) })),
);
---
<Base title="Astro and Frontend Jobs" description="Open frontend roles at companies that build with Astro.">
<h1>Open jobs</h1>
<form class="filters" aria-label="Filter jobs">
<select name="type">
<option value="">All types</option>
<option value="full-time">Full-time</option>
<option value="contract">Contract</option>
</select>
<label><input type="checkbox" name="remote" /> Remote only</label>
</form>
<ul class="jobs">
{rows.map(({ job, company }) => (
<li data-type={job.data.type} data-remote={String(job.data.remote)}>
<a href={`/jobs/${job.id}/`}>{job.data.title}</a>
<span>{company?.data.name} · {job.data.location}</span>
</li>
))}
</ul>
</Base>
The job detail page
Each job gets its own URL, which is what search engines index and what people share:
---
// src/pages/jobs/[id].astro
import { getEntry, render } from 'astro:content';
import Base from '../../layouts/Base.astro';
import { getOpenJobs } from '../../lib/jobs';
export async function getStaticPaths() {
const jobs = await getOpenJobs();
return jobs.map((job) => ({ params: { id: job.id }, props: { job } }));
}
const { job } = Astro.props;
const company = await getEntry(job.data.company);
const { Content } = await render(job);
---
<Base title={`${job.data.title} at ${company?.data.name}`} description={`${job.data.type} role in ${job.data.location}.`}>
<h1>{job.data.title}</h1>
<p>{company?.data.name} · {job.data.location}{job.data.remote && ' · Remote'}</p>
<Content />
<a href={job.data.applyUrl} rel="nofollow">Apply on {company?.data.name}</a>
</Base>
If you use [id].astro, remember that getStaticPaths() must return every job. A job that is filtered out simply has no page, so links to it return your 404 page.
Add JobPosting structured data
Google can show job listings in a dedicated job search experience when the page includes JobPosting structured data. Build the object from the same frontmatter that renders the page, so the two never disagree:
---
// src/components/JobPostingSchema.astro
const { job, company, description } = Astro.props;
const d = job.data;
const schema = {
'@context': 'https://schema.org',
'@type': 'JobPosting',
title: d.title,
description,
datePosted: d.datePosted.toISOString().slice(0, 10),
validThrough: d.validThrough.toISOString(),
employmentType: d.type.toUpperCase().replace('-', '_'),
hiringOrganization: { '@type': 'Organization', name: company.data.name, sameAs: company.data.website },
jobLocation: { '@type': 'Place', address: { '@type': 'PostalAddress', addressLocality: d.location } },
...(d.remote && { jobLocationType: 'TELECOMMUTE' }),
...(d.salaryMin && {
baseSalary: {
'@type': 'MonetaryAmount',
currency: d.currency,
value: { '@type': 'QuantitativeValue', minValue: d.salaryMin, maxValue: d.salaryMax, unitText: 'YEAR' },
},
}),
};
---
<script type="application/ld+json" set:html={JSON.stringify(schema)} />
Pass the job description as plain text or HTML. employmentType values follow Google’s list (FULL_TIME, PART_TIME, CONTRACTOR, INTERN and others), so map contract and internship to CONTRACTOR and INTERN rather than relying on the simple transform above. Fully remote roles also need applicantLocationRequirements. Google’s job posting structured data docs list required and recommended fields, and our JSON-LD guide shows the general pattern in Astro.
Filter jobs on the client
A job board with a few hundred listings doesn’t need a search server. The filter reads the form and toggles hidden on each card:
<script>
// src/components/JobFilters.astro
const form = document.querySelector<HTMLFormElement>('.filters');
const items = document.querySelectorAll<HTMLLIElement>('.jobs li');
form?.addEventListener('change', () => {
const data = new FormData(form);
const type = data.get('type');
const remoteOnly = data.has('remote');
items.forEach((li) => {
const matchType = !type || li.dataset.type === type;
const matchRemote = !remoteOnly || li.dataset.remote === 'true';
li.hidden = !(matchType && matchRemote);
});
});
</script>
Without JavaScript, every job is still listed, which is a sensible fallback. For full-text search across descriptions, add Pagefind at build time, which indexes the built HTML and needs no server. Static category pages such as /jobs/remote/ or /jobs/contract/ are worth generating too, because they give search engines and visitors stable URLs for common filters.
Accept new job listings
For a submit-and-review board, start with the simplest path that works:
- A form backend. Employers fill in a form with the same fields as your schema. Submissions land in your inbox or a spreadsheet, and you create the Markdown file. The form backends comparison lists options.
- A Git-based CMS. Keystatic, Decap CMS or TinaCMS can give a reviewer a form that writes Markdown into
src/content/jobs/and triggers a rebuild. - A headless CMS with a webhook. Employers or staff enter jobs in the CMS, and a publish webhook rebuilds the site. Swap the
glob()loader for the CMS’s loader or API.
Payments come last. Once a paid posting flow is proven, add an adapter, a checkout and an Action that creates the listing after payment.
Start from a job board theme
If you want a designed starting point, our HR & Hiring category is small, with recruitment agency sites such as Celeris. A few job portal designs live in other categories: Careari has job category pages for a classic job board, and Better Talent includes jobs, company and job offer pages. Their listings are static pages, so you’d connect them to a collection like the one above.
FAQ
Can you build a job board with Astro?
Yes. A curated or moderated job board fits Astro well: listings are content-collection entries, each job gets a static page, and filters run in a small script. You only need a server when employers create accounts and pay on the site.
How do I get my job listings into Google Jobs?
Add JobPosting structured data to each job page with at least the title, description, datePosted, hiring organization and location. Keep validThrough accurate, remove expired jobs, and submit a sitemap so Google finds new listings.
How do I remove expired jobs from a static site?
Filter listings by validThrough when the site builds, and schedule a daily rebuild through your CI or your host’s deploy hook. Each build drops jobs whose end date has passed.
Do I need a database for an Astro job board?
Not at first. Markdown files or a headless CMS hold listings fine for hundreds of jobs. Add a database when employers post and edit their own listings or when you need applications stored on your side.
How do I add search and filters to an Astro job board?
Put the filterable values on each listing as data- attributes and toggle visibility with a short script. For full-text search across descriptions, add Pagefind, which builds a static search index during the Astro build.