Save entry to a YAML file?

Hi,

I am interested in Kirby and I am currently investigating if it’s a good fit. I have a .yaml file with my bookmarks, it’s constructed like this:

- href: "https://www.youtube.com/watch?v=nCX8UBhDGqE"
  title: "How to Seam Seal Siliconised Fabric Using Silnet"
  tags: [outdoor, guides]
  date: 2020-07-29

- href: "https://www.youtube.com/watch?v=fhhI4pOtpCc"
  title: "Seasoning a Carbon Steel Fry Pan in the Oven"
  tags: guides
  date: 2021-10-02

Is it possible to save entries via a custom blueprint in Panel to the .yaml file? I assume it wouldn’t be to difficult to iterate over this .yaml file and display bookmarks on site.org/bookmarks. Thanks for the answers!

Welcome tom the community!

I would suggest a Structure would be best for this. although im not sure if theres an ulitmatly limit on the number of entries in terms of perfomance. As a bookmak tool, i imagine over time you will have quite alt of entires. From there you can loop over the entries to output them.

Edit: I just remembered that Bastian actually video on making a bookmarks tool, which might intrest you.

1 Like

Thanks for your reply and thinking along. I was hoping to find a solution that lets me save bookmarks to a separate yaml file as your solution adds all bookmarks to the .txt file in the folder. That means it’s getting mixed up with the meta data for the page.

I checked out the video about building a bookmark tool, but that saves each bookmark individually and that is not what I am looking for. Still I appreciate your time!

Kirby stores page content entered via the panel in the page txt files. So editing yaml files is not possible via this standard procedure. An option could be a custom Panel area.

1 Like

In addition to the cookbook, you can view another example in our sandbox plugin: sandbox/plugins/sandbox/index.php at main · getkirby/sandbox · GitHub

Where we are using our custom Environment class to do the CRUD, you could use the Data class to read/write your YAML file/s: https://getkirby.com/docs/reference/objects/data/data

1 Like