kobweb icon indicating copy to clipboard operation
kobweb copied to clipboard

Add a way to reference variables declared inside markdown front matter

Open bitspittle opened this issue 4 years ago • 2 comments

Something like:

---
author: bitspittle
---

This blog post was brought to you by {{ author }}

We'll need to think about this. This will really only work well if we think of this as a larger feature, e.g. you can specify a yaml config elsewhere with all variables and then reference them in a {{ }} block, like above maybe author is set to nobody by default unless specifically tagged in the front matter.

Then the question is, will we be able to reference those variables in the normal kt files as well???

bitspittle avatar Sep 30 '21 05:09 bitspittle

Note that we're currently using {{ }} for calling Composable code. Maybe we can use the same block for front matter stuff too? {{ $author }} for example. Or maybe $author? Or $$author$$?

bitspittle avatar Jan 08 '22 01:01 bitspittle

Since we can access front matter in code, it's not critical for this to get into 1.0 anymore. (If anyone has a use case that's critical, though, that I'm overlooking, please share it here)

bitspittle avatar Jan 08 '22 06:01 bitspittle