keystatic icon indicating copy to clipboard operation
keystatic copied to clipboard

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

Open teinett opened this issue 1 year ago • 6 comments

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" }

teinett avatar Aug 11 '23 00:08 teinett

It doesn't support slugs with several variables yet, see #340

florian-lefebvre avatar Aug 12 '23 09:08 florian-lefebvre

It doesn't support slugs with several variables yet, see #340

Thanks for the info.

teinett avatar Aug 12 '23 18:08 teinett

Confirming what @florian-lefebvre said, and also noting that you're specifically using Astro's convention for different languages (ref https://docs.astro.build/en/recipes/i18n/)

I've been thinking about adding a feature specific to content translation that would show you a language dropdown for each entry in the UI, rather than showing you all the entries in one list and treating en or ru (in your content above) as just another part of the slug.

We'll have a look at it this week and get back to you with when we can add support for this.

JedWatson avatar Aug 13 '23 02:08 JedWatson

Confirming what @florian-lefebvre said, and also noting that you're specifically using Astro's convention for different languages (ref https://docs.astro.build/en/recipes/i18n/)

I've been thinking about adding a feature specific to content translation that would show you a language dropdown for each entry in the UI, rather than showing you all the entries in one list and treating en or ru (in your content above) as just another part of the slug.

We'll have a look at it this week and get back to you with when we can add support for this.

ADMIN UI still doesn't see the posts, even with path: 'src/content/blog/**' in path

tiwka19 avatar Aug 17 '23 08:08 tiwka19

@JedWatson Do you already have an estimated time when this feature will be available in production? Can't wait to try your admin on real projects. :)

teinett avatar Jan 27 '24 18:01 teinett

Collating this in https://github.com/Thinkmill/keystatic/issues/1080

simonswiss avatar Apr 19 '24 00:04 simonswiss