Turning Recipe Data into an Astro Content Collection
Briefly

Turning Recipe Data into an Astro Content Collection
"Content collections are pretty much exactly how they sound - collection of content items you can use within your Astro site. If you go through the excellent Astro tutorial you will find this discussed at the end in the final optional step step. Content collections aren't required - you can build dynamic sets of data just using file system operations (and that's how the tutorial has you build the blog) - but they make it easier (imo) to re-use content throughout the site."
"I encourage you to check out the docs, but generally content collections come down to three types: A glob pointing to a folder of Markdown, MDX, Markdoc, JSON, YAML, or TOML files. A pointer to one file that has multiple records of data (think big ass JSON file or CSV) Anything and everything else if you're willing to write code for a custom loader"
"One more reason to like them is that you can, at any point, without wait, get an export of your data. This will give you a zip file of recipes in text file format which look like so: Title: Soft and Chewy Chocolate Chipless Cookies Description: Source: Sofi | Broma Bakery Original URL: https://bromabakery.com/chocolate-chipless-cookies/ Yield: 16,16 cookies Prep: 15 minutes Cook: 11 minute"
Content collections in Astro provide reusable sets of content that simplify integration across a site. They support three primary forms: a glob matching Markdown/MDX/Markdoc/JSON/YAML/TOML files; a single file containing multiple records (for example a large JSON or CSV); and fully custom loaders implemented in code. A practical example revisits Saffron recipe data, which can be exported as a zip of text files. Each exported recipe contains structured lines like Title, Description, Source, Original URL, Yield, Prep, and Cook. Content collections make loading, validating, and reusing such recipe data easier within an Astro site.
Read at Raymondcamden
Unable to calculate read time
[
|
]