Here’s a solution to parse external files in the content’s fields, maybe it’s good idea to add the method to core? This way you can have metadata in the template file, and the content in any external file you want.
Title: Project Test
----
Text: README.md
We do a custom field method (inside /site/plugins/methods.php) that return the file:
// return file
field::$methods['get_file'] = function($field) {
$file = kirby()->page()->file($field->value);
return $file;
};
So we can use get_file()
method to get the external file, and work with it:
$file = $page->text()->get_file();
$text = $file->read();
echo date("d/m/Y H:i", filemtime($file));
The problem is that $text right now is not an object, like the one you have on kirby, so you can’t use ->kibrytext();
and other methods on it, still you can use kirbytext($text);