Sorry, we don't support your browser.  Install a modern browser

Use curly brackets for writing KirbyTags#134

In #518, I made the suggestion to have a way to interpolate curly brackets in field content. So, for example, if you have the following content:

Title: Home


Myfield: Welcome to the {​{​ page.title }} page

…and the following template:

echo $page->myField()->replace(['page' => $page]);

…the echoed result would be:

Welcome to the Home page

What if this syntax is merged with the KirbyTags syntax and the kirbytext() method replaces both KirbyTags and interpolates curly brackets?

While having (link: text: my link) is sleek, I believe it’s also unnecessarily smart. “Mustache syntax” is more common and recognized for text substitution. It’s also a lot more noticeable when quickly going through content. Wouldn’t it be easier to have a single syntax and have:

{​{​ page.title }} outputs the page title
{​{​ link: text: my link }} outputs a link

I’m pretty confident it would also be faster to parse, since { is much more rarely seen, compared to (, making the regex quicker.

It would be cool to be able to do $page->myField->kt() and automatically interpolate {​{​ and }}, parsing kirbytags and properties of $page and $site.

14 days ago