Skip to content

Multiple document fields in one collection #361

Answered by simonswiss
etmartinkazoo asked this question in Q&A
Discussion options

You must be logged in to vote

Hey!

Yep, this will work out of the box.

Since you set the content field as your contentField, the main file generated will contain that content field in the "body" of the .mdoc file, and the other fields in the frontmatter at the top.

Except for the summary and any other eventual document fields.

For those, Keystatic will create a folder named after the entry slug, and inside there a .mdoc file named after the field:

With your code, if you created a post with a slug of hello-world, the output files would be like so:

src/content/blog/
        hello-world.mdoc
        hello-world/
                summary.moc

I copied and pasted your exact code in a new project created with the Keystatic C…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@etmartinkazoo
Comment options

Answer selected by etmartinkazoo
Comment options

You must be logged in to vote
2 replies
@simonswiss
Comment options

@ddteeter
Comment options

Comment options

You must be logged in to vote
2 replies
@tordans
Comment options

@tordans
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants