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

Add Kirby Comment Tags

S

I come from twig and I love to comment stuff.
In twig a comment looks like this:

{# my comment here #} 

It’s very straight forward.
I am new to php, but to make comments within a template seems so verbose.

So at the moment I comment everything with

<!-- my comment here -->

Php comments work fine,

<?php
    // My comment here. 
?>

<?php
    /*
        My comment here
    */
?>

<?= // my comment here ?>

But none of this looks sexy.

So maybe a kirby comment tag would be something interesting?

Maybe ya all doning it differently. It’s just something that bothers me from time to time.

Cheers

a year ago

I am using PHP comments, and this would be the equivalent of your Twig comment (stripped out from source code) since Kirby doesn’t have a custom templating lang like Twig.

a year ago

Since Kirby’s default template engine is raw PHP templates without anz additional run, a custom comment format isn’t something we would aim for - given the performance downsights for any additional run alone.

I think the native HTML and PHP comments are fine. And if you need more, you can always add your own template parser: https://getkirby.com/docs/reference/plugins/components/template

a year ago