Adding target:_blank to URL

Hey you folks,
i´ve a problem adding the target:_blank attribute to a link.

I get the Link from *.yml in this way:
label: Website
type: url
placeholder: http://

In my template i get the URL in this way:

<?= $page->website()->kirbytext() ?>


I hope anyone could help me adding target:_blank to this links.
Of course i´am an absolutely php-Gimp :wink:

Thank you in advance.

Using kirbytext here does not make sense. Solution:

<a class="link" href="<?= $page->website() ?>" target="_blank"><?= $page->website() ?></a>

Edit: Added the missing href attribute :blush:

1 Like

Hey Texnixe,

it seems this code doesn´t transport the href="*"

Please look at this.
<a href="<?= $page->website() ?>" target="_blank"><?= $page->website() ?></a>
It works fine, but i dont know if its correct.

Thank You.

Oopsy daisy! I probably didn’t have enough sleep.

Yep, that’s perfect!

Thank you for this amazing! fast solution.
You´re god :wink:


1 Like