Best way of reading YAML (or really files with frontmatter)

What would be the best way of reading blog files that has meta data in YAML format?

I have a large number of files that are formatted in the style of Hugo, Blot.im, etc, etc. In other words they look something like this

---
title: Some title 
date: 2023-03-12 19:37:30
somemetadata1: blabla
somemetadata2: blipp
category:
  - one category
  - another category
tags:
  - one tag
  - another tag
---

And here comes the body text, typically markdown

Is there a good way to read this kind of data? I’ve tried to find something and have found libraries for almost any other language, but unfortunately not AppleScript.

You can build YAML.framework on github and call it from AppleScript.

I use it with AppleScript like this.
http://piyocast.com/as/archives/2099
http://piyocast.com/as/archives/2097
http://piyocast.com/as/archives/2095

1 Like