🔥 All-Access Pass — $199 USD (Regular $499) · Unlock all 2,836 Astro themes ➔
komal.nakrani
Get All-Access Pass ($199)
ThemesCategoriesDocsBlogTips & TricksPricingGet All-Access Pass ($199)
Content & MDX••By Komal Nakrani

Astro Author Pages: Bios, Post Lists and Person Schema

Build Astro author pages: an authors collection, a reference() from each post, one static page per author with their posts, and Person schema for search engines.

#Astro#Author Page#Content Collections#Blog

To build an Astro author page, create an authors content collection, point each post at its author with reference('authors'), and generate one page per author with getStaticPaths() that lists their posts. Astro validates every reference at build time, so a post can’t name an author who doesn’t exist.

Key Takeaways

  • Store authors once, in a file() or glob() collection, instead of repeating names in every post.
  • reference('authors') in the post schema links posts to authors and fails the build on typos.
  • src/pages/authors/[id].astro turns each author into a static page with a bio and post list.
  • Add Person structured data and link author pages from every byline.

Define the collections

Authors rarely change, so a single JSON file works well. Posts reference them by ID:

// src/content.config.ts
import { defineCollection, reference } from 'astro:content';
import { glob, file } from 'astro/loaders';
import { z } from 'astro/zod';

const authors = defineCollection({
  loader: file('src/data/authors.json'),
  schema: ({ image }) =>
    z.object({
      name: z.string(),
      role: z.string(),
      bio: z.string(),
      avatar: image(),
      links: z.array(z.url()).default([]),
    }),
});

const blog = defineCollection({
  loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
  schema: z.object({
    title: z.string(),
    pubDate: z.coerce.date(),
    author: reference('authors'),
  }),
});

export const collections = { authors, blog };
[
  {
    "id": "maya-chen",
    "name": "Maya Chen",
    "role": "Frontend engineer",
    "bio": "Maya writes about Astro, CSS and accessible components.",
    "avatar": "../assets/authors/maya.jpg",
    "links": ["https://github.com/example"]
  }
]

Save that as src/data/authors.json. The avatar path is relative to the JSON file, and image() makes Astro check the file exists and optimize it. In a post, author: maya-chen is all you write.

For several authors per post, use authors: z.array(reference('authors')). The collection references tip covers both shapes.

Generate one page per author

---
// src/pages/authors/[id].astro
import { getCollection } from 'astro:content';
import { Image } from 'astro:assets';
import Base from '../../layouts/Base.astro';

export async function getStaticPaths() {
  const authors = await getCollection('authors');
  const posts = await getCollection('blog');
  return authors.map((author) => ({
    params: { id: author.id },
    props: {
      author,
      posts: posts
        .filter((p) => p.data.author.id === author.id)
        .sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()),
    },
  }));
}

const { author, posts } = Astro.props;
const { name, role, bio, avatar, links } = author.data;
---
<Base title={`${name}, ${role}`} description={bio}>
  <Image src={avatar} alt="" width={160} height={160} />
  <h1>{name}</h1>
  <p>{role}</p>
  <p>{bio}</p>
  <h2>Articles by {name}</h2>
  <ul>
    {posts.map((p) => <li><a href={`/blog/${p.id}/`}>{p.data.title}</a></li>)}
  </ul>
</Base>

The filter compares p.data.author.id, because a reference resolves to an { collection, id } object, not to the author data. An author with no posts still gets a page; filter authors first if you’d rather skip them. An index at src/pages/authors/index.astro that lists every author is a good companion.

Show the byline on posts

On the post page, resolve the reference with getEntry():

---
// src/components/Byline.astro
import { getEntry } from 'astro:content';
const { post } = Astro.props;
const author = await getEntry(post.data.author);
---
<p class="byline">
  By <a href={`/authors/${author.id}/`} rel="author">{author.data.name}</a>
</p>

Every byline linking to the author page gives readers and crawlers a path to everything that person wrote.

Add Person structured data

Search engines use author information to understand who stands behind content. Add Person JSON-LD to the author page, built from the same data:

---
// inside src/pages/authors/[id].astro
const person = {
  '@context': 'https://schema.org',
  '@type': 'Person',
  name,
  jobTitle: role,
  description: bio,
  url: new URL(`/authors/${author.id}/`, Astro.site).href,
  sameAs: links,
};
---
<script type="application/ld+json" set:html={JSON.stringify(person)} />

On post pages, set the author of your BlogPosting schema to the same name and URL. The JSON-LD guide shows the full post pattern, and the content collections docs cover references in detail. If you’d rather start from a finished blog with author support built in, the Blog & Editorial themes are a good place to look.

FAQ

How do I add an author to an Astro blog post?

Create an authors collection, add author: reference('authors') to the post schema, and set author: author-id in each post’s frontmatter. Resolve it on the page with getEntry(post.data.author).

How do I list all posts by one author in Astro?

In the author page’s getStaticPaths(), load all posts with getCollection('blog') and filter where post.data.author.id equals the author’s ID. Pass the filtered list as a prop.

Can an Astro post have multiple authors?

Yes. Use authors: z.array(reference('authors')) in the schema and list several IDs in frontmatter. Resolve them together with getEntries(post.data.authors).

Do author pages help SEO?

They help readers and search engines see who wrote what. An author page with a real bio, links to the author’s profiles and a list of their articles, plus Person structured data, gives that context in one place.