#How to define relations of Content Collections in AstroJs?

3 messages · Page 1 of 1 (latest)

vestal totem
#

Imagine you are having a Blog Entry, which can relate to other Blog Entries. It could as simple as "BlogPost 1 extends BlogPost 2". Ideally you would like to show the information thon both blog post entries.

Where would you define the relation?
Easiest would be to define the relation on both Blogposts:

//1-post.mdx
---
id: 1
relations: [{ type: "extends", id: 2 }]
---
//2-post.mdx
---
id: 1
relations: [{ type: "extended by", id: 1 }]
---

What is the recommended way ?

dusky joltBOT
#

Hi @vestal totem. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the Astro documentation for more information on working with content and relationships between blog posts:

These resources should help you understand how to structure and manage content in Astro.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

Astro Documentation

Learn how to create content using Markdown or MDX with Astro

Astro Documentation

Content collections help organize your Markdown and type-check your frontmatter with schemas.