Thinkmill / Thinkmill/keystatic

[AstroJS] Keystatic doesn't show files from Content Collection

Open
#519 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

framework:astro roadmap
Dominant language
TypeScript
Stars
2.4k
Forks
159
Avg merge
21h 41m
Merged PRs (30d)
2

Description

I have AstroJS project, and I added Keystatic.

I have several pages in src/content folder, and it works in Astro:

2023-08-10 18-07-46

File src/content/config.ts:

import { z, defineCollection } from "astro:content";

const docsCollection = defineCollection({
    type: "content",
    schema: z.object({
        title: z.string(),
    }),
});

export const collections = {
    docs: docsCollection,
};

File keystatic.config.ts:

import { config, fields, collection } from "@keystatic/core";

export default config({
    storage: {
        kind: "local",
    },
    collections: {
        docs: collection({
            label: "Documents",
            slugField: "title",
            path: "src/content/docs/*",
            format: { contentField: "content" },
            schema: {
                title: fields.slug({ name: { label: "Title" } }),
                content: fields.document({
                    label: "Content",
                    formatting: true,
                    dividers: true,
                    links: true,
                    images: true,
                }),
            },
        }),
    },
});

Example of mdoc file: src/content/docs/en/about.mdoc

---
title: "About website"
---

# About website

## Website Feedback

Снимок экрана 2023-08-10 в 18 08 21

I go to my Keystatic admin.

What I see: No results No items matching "" were found.

What I expected to see: the list of my mdoc files form existing AstroJS project.

2023-08-10 18-03-33

Node 18.17.0
MacOS Catalina

"dependencies": {
"@astrojs/markdoc": "^0.4.4",
"@astrojs/node": "^5.3.2",
"@astrojs/react": "^2.2.1",
"@keystatic/astro": "^0.0.8",
"@keystatic/core": "^0.0.114",
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"accept-language": "^3.0.18",
"astro": "^2.10.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the collection path and schema in keystatic.config.ts with the existing src/content/config.ts and the example src/content/docs/en/about.mdoc file. Check the Keystatic admin entry point for how it discovers matching files; done means the existing mdoc files appear in the Documents collection without breaking Astro content loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, typescript
Domain
content
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.