Thinkmill / Thinkmill/keystatic

collection with `**` path cannot use more than one mdx field

Open
#1,142 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

this may just be a documentation issue, but using multiple mdx fields in a collection which allows nested paths does not work.

issue repro: https://github.com/stefanprobst/keystatic-mdx-nested

collection has:

  posts: collection({
    label: "Posts",
    slugField: "title",
    path: "./content/posts/**",
    format: { contentField: "content" },
    schema: {
      title: fields.slug({ name: { label: "Title" } }),
      summary: fields.mdx({
        label: "Summary",
      }),
      content: fields.mdx({
        label: "Content",
      }),
    },
  }),

a collection entry will be saved as:

content/posts/my-first-post.mdx
content/posts/my-first-post/summary.mdx

however, reader.collections.posts.list() will return both "my-first-post" and "my-first-post/summary" as entries, and both are also listed in the keystatic ui:

Screenshot_20240519_194036

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 with the linked keystatic-mdx-nested reproduction and inspect how the ** collection path is read by reader.collections.posts.list(). Verify the collection entry with two MDX fields and compare the reader results with the entries shown in the Keystatic UI; done means the nested summary.mdx is treated as a field rather than a separate collection entry.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.