# Use Prosefly with Astro Content Collections

Use the Aster template to connect Astro Content Collections to Prosefly, edit an MDX article, review the diff, and publish through Git.

import AsterDemo from '@/components/aster/AsterDemo.astro';

Connect an existing Astro site to Prosefly without defining its content twice. This walkthrough uses [Aster](https://github.com/prosefly/astro-template-aster), our open-source template for projects and writing. You will edit **Defaults With an Exit**, publish the reviewed MDX file to your own GitHub repository, and check the updated article on the website.

Your site keeps its Content Collections, file paths, components, and build process. An owner or admin connects the repository and configures publication. Writers can then edit and save drafts without using Git commands.

## Before you start

- Make your own GitHub copy of [Aster](https://github.com/prosefly/astro-template-aster), or use an existing supported Astro project. You need permission to publish to that repository.
- Create a Prosefly account and organization. The Personal trial lasts one calendar month and requires no credit card; see [pricing](/pricing/).
- Set up the site's usual build and hosting workflow if you want publication to update a live website. For a new Aster copy, update its site URL in `src/data/config.ts` and follow its README to run and deploy it.

[Explore the Aster demo](https://astro-template-aster.prosefly.dev/) and open the [original article](https://astro-template-aster.prosefly.dev/blog/defaults-with-an-exit/) before making a change. The example content stays in English throughout this guide, so the article, source, and captures can be compared directly.

## 1. Keep Aster's existing collection definitions

Aster defines **Blog** in `src/content/blog/` and **Projects** in `src/content/projects/`. Its `src/content.config.ts` already describes the fields:

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

const blog = defineCollection({
  loader: glob({
    base: './src/content/blog',
    pattern: '**/*.{md,mdx}',
  }),
  schema: z.object({
    title: z.string(),
    description: z.string(),
    publishedAt: z.coerce.date(),
    updatedAt: z.coerce.date().optional(),
    category: z.string(),
    tags: z.array(z.string()).default([]),
    project: reference('projects').optional(),
    draft: z.boolean().default(false),
  }),
});

const projects = defineCollection({
  loader: glob({
    base: './src/content/projects',
    pattern: '**/*.{md,mdx}',
  }),
  schema: z.object({
    title: z.string(),
    description: z.string(),
    year: z.number().int(),
    status: z.enum(['Open source', 'Private package']),
    tags: z.array(z.string()).default([]),
    website: z.url().optional(),
    repository: z.url().optional(),
    featured: z.boolean().default(false),
    order: z.number().int().default(0),
    draft: z.boolean().default(false),
  }),
});

export const collections = { blog, projects };
```

Keep this file as it is. The Blog fields include `title`, `description`, `publishedAt`, `category`, `tags`, and the optional `project` reference. Astro validates the files against this schema, and Prosefly reads supported fields to build the property form.

Connecting these collections needs no separate CMS schema, Prosefly runtime, or content API in the Astro site. Aster already uses `@prosefly/astro-components` to render its own MDX; that template dependency is separate from connecting Prosefly.

## 2. Connect your repository and confirm the scan

Open **Organization settings → Repositories**. Link GitHub, authorize the Prosefly GitHub App for your Aster repository, connect it, and choose **Scan repository**. Follow [Connect GitHub](/docs/connect-github/) for the authorization screens.

Check the configured target branch and application root. Confirm that the scan finds Blog and Projects at their existing paths. Review their fields and editor profiles before confirming the Content Space, then wait for indexing to finish. Aster's MDX imports Prosefly components; check the detected component profile for that content.

<p id="aster-scan-demo">
  Try this step in the <a href="#try-editor">complete workflow</a>.
</p>

Scanning reads the repository without executing its code or changing Git files. If a collection is missing, check the branch, application root, and loader paths before continuing.

## 3. Edit the same article and save a draft

Open the **Blog** collection and select **Defaults With an Exit**:

```text
src/content/blog/defaults-with-an-exit.mdx
```

Change the Description property to the new sentence below, then replace the opening paragraph in Visual mode. Leave the title, date, category, tags, and `project: aster` unchanged so the article keeps its existing identity and relationship.

```diff
-description: Good theme defaults shorten the first week without limiting what the site can become.
+description: Good defaults help a site grow without rewriting its content.
```

```md
A useful theme handles page structure, navigation, search, and readable prose so the team can focus on its content.
```

These are example edits for your own copy of Aster. Open Source to check the complete MDX, including frontmatter and component imports. Keep those imports when editing. Supported Prosefly MDX components can also be edited visually; custom syntax remains available in Source.

<p>
  Try this step in the <a href="#try-editor">complete workflow</a>.
</p>

Wait for the draft save status. The draft belongs to the Prosefly workspace; saving it does not create a Git commit or update the live article. See [Visual Editor](/docs/editor/visual-editor/) for the controls.

## 4. Review and publish the MDX file

An owner or admin chooses **Commit** or **Pull request** in **Space settings → Publishing**. Open publication review and check:

1. The repository and target branch are your intended destination.
2. The changed file is `src/content/blog/defaults-with-an-exit.mdx`.
3. The frontmatter diff contains the new description, and the body diff contains the new opening paragraph.
4. The article's component imports and other properties remain intact.

<p id="aster-review-demo">
  Try this step in the <a href="#try-editor">complete workflow</a>.
</p>

Publish after reviewing. Commit writes the reviewed change to the configured target branch. Pull request creates a proposed change that must be merged before that branch is updated. See [Publishing to Git](/docs/publishing/) for the complete workflow.

## 5. Check the article after the Astro build

Your existing hosting pipeline builds the updated repository. Wait for that build to complete, then open `/blog/defaults-with-an-exit/` on **your own deployment**. The linked Aster demo is a reference; publishing to your copy does not change it.

Confirm that the page description and opening paragraph match your edits, the existing article layout and components still render, and the post remains linked to its Aster project. Prosefly publishes the content files; your Astro project and hosting handle the website update.

<p id="aster-published-demo">
  Try this step in the <a href="#try-editor">complete workflow</a>.
</p>

## Try the complete workflow

The example opens at article editing. Use the stage controls to move through repository connection, collection discovery, editing, review, and the website preview.

<span id="aster-workflow-demo"></span>

<figure>
  <AsterDemo language="en" stage="edit" id="try-editor" />
  <figcaption>
    Aster walkthrough: connect → scan → edit → review → publish → check the website.
  </figcaption>
</figure>

## Apply this to your existing Astro site

Aster is an example, not a requirement. Keep your site's existing field names, content directories, and rendering code.

| Content setup                                                              | How to work with it                                                                                                        |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Static Content Collections with directory-wide Markdown/MDX `glob` loaders | Scan the repository and confirm the detected paths and supported fields.                                                   |
| Supported static schema fields                                             | Edit the detected properties beside the document; Astro keeps validating the published files.                              |
| Supported MDX component profiles                                           | Use visual component controls and open Source for custom syntax.                                                           |
| Remote or custom loaders, dynamic schemas, or selective file patterns      | Review the scan results and configure the content scope explicitly when needed. Prosefly does not execute repository code. |

Ordinary Astro collections do not define native documentation navigation. If you use Starlight, follow the [Starlight CMS guide](/docs/frameworks/starlight/) for sidebar and component editing.

## If something does not match

| What you see                          | What to check                                                                                                |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| Blog, Projects, or a field is missing | Check the target branch, application root, content paths, and supported schema definitions, then scan again. |
| An MDX component opens in Source      | Check the detected editor profile. Custom syntax remains editable in Source.                                 |
| The website still shows old text      | Check draft versus publication, PR merge status, the hosting build, and the URL of your own deployment.      |
| Git files changed outside Prosefly    | Scan again and rebuild the index before continuing.                                                          |

Continue with the [Astro CMS overview](/frameworks/astro/), [content ownership](/docs/content-ownership/), or [Astro Content Collections documentation](https://docs.astro.build/en/guides/content-collections/).
