Thinkmill / keystatic

First class CMS experience, TypeScript API, Markdown & YAML/JSON based, no DB
https://keystatic.com
MIT License
1.21k stars 81 forks source link

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

Open teinett opened 1 year ago

teinett commented 1 year ago

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

florian-lefebvre commented 1 year ago

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

teinett commented 1 year ago

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

Thanks for the info.

JedWatson commented 1 year ago

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.

tiwka19 commented 1 year ago

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

teinett commented 9 months ago

@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. :)

simonswiss commented 6 months ago

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