astro@5.0.0-beta.3
withastro/astro — 5 days ago
Minor Changes
-
#12047
21b5e80
Thanks @rgodha24! - Adds a new optionalparser
property to the built-infile()
loader for content collections to support additional file types such astoml
andcsv
.The
file()
loader now accepts a second argument that defines aparser
function. This allows you to specify a custom parser (e.g.toml.parse
orcsv-parse
) to create a collection from a file's contents. Thefile()
loader will automatically detect and parse JSON and YAML files (based on their file extension) with no need for aparser
.This works with any type of custom file formats including
csv
andtoml
. The following example defines a content collectiondogs
using a.toml
file.[[dogs]] id = "..." age = "..." [[dogs]] id = "..." age = "..." ```...