If I don’t type anything in url blueprint, I hope a href does not work at the front end. What and how can I write in blueprints for that?
<a href="<?= $playlist->url() ?>" target="_blank">
If I don’t type anything in url blueprint, I hope a href does not work at the front end. What and how can I write in blueprints for that?
<a href="<?= $playlist->url() ?>" target="_blank">
Could you please rephrase and add some context?
You can use an if statement to check if the field is empty
<?php if ( $page->content()->get('url')->isNotEmpty()) : ?>
<a href="<?= $playlist->content()->get('url') ?>" target="_blank">
<?php endif; ?>
Note that url() is a native Kirby method, so if your field is called url, you have to fetch it via the content() method, otherwise you will get the page url and not the url entered into that field.