Structuring content text files differently

Sorry if this is a stupid question. I am tinkering with Kirby and one of the things I’m wondering is if it would be possible to structure content text files differently. What I mean is that instead of this:

Title: Himalaya and back

----

Text: 

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. 

{{ gallery }}

The copy warned the Little Blind Text, that where it came from it would have been rewritten a thousand times and everything that was left from its origin would be the word "and" and the Little Blind Text should turn around and return to its own, safe country. But nothing the copy said could convince her and so it didn’t take long until a few insidious Copy Writers ambushed her, made her drunk with Longe and Parole and dragged her into their agency, where they abused her for their projects again and again. 

----

Date: 2018-09-26 17:30

----

Author: Name

----

Tags: mountains, nepal

----

Gallery: photography/mountains

You might write some meta tags up front as YAML, and separate it from the text by whitespace, like this:

Title: Himalaya and back
Date: 2018-09-26 17:30
Author: Name
Tags: mountains, nepal
Gallery: photography/mountains

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. 

{{ gallery }}

The copy warned the Little Blind Text, that where it came from it would have been rewritten a thousand times and everything that was left from its origin would be the word "and" and the Little Blind Text should turn around and return to its own, safe country. But nothing the copy said could convince her and so it didn’t take long until a few insidious Copy Writers ambushed her, made her drunk with Longe and Parole and dragged her into their agency, where they abused her for their projects again and again.

I am not necessarily asking how to create this specific solution, I am wondering where and how Kirby parses content files and if there are any plugins that handle parsing content text files. Thanks!

No, that’s not possible and I don’t know of any plugin that does that. Not quite sure where this is done exactly, but I don’t think you can hook into that via a plugin.

Once again thank you for the quick and informative reply!

Just for completeness sake:

The encoding and decoding of the content data happens in the Txt class in /kirby/src/Data/Txt.php.

Theoretically, I guess you could create your own handler and then extend the Page class with models that read your custom content files, but I’d say, that’s definitely not worth the trouble.

I wonder why you would want to do that anyway, if you use the Panel, you will never see these files, and if you don’t, you can still structure your content with putting the meta data at the top, while keeping the separators.

Title: Himalaya and back
----
Date: 2018-09-26 17:30
----
Author: Name
----
Tags: mountains, nepal
----
Gallery: photography/mountains
----
Text:

Some text

Your suggested setup would only make sense for typical pages with a large text block and some short meta data. It would’t be very useful for a lot of structured content which is one of the big strengths of Kirby.

The reason I asked was mostly curiosity, not a lot of practical benefit. Other than that YAML blocks usually seem to be defined at the top of a file with three dashes as separators.