How can I add target _blank in <?= html::a($social->url(), $social->platform()) ?>?

 <?php foreach ($page->social()->toStructure() as $social): ?>
 <li><?= html::a($social->url(), $social->platform()) ?></li>
 <?php endforeach ?>

Hi,
I want to add 'target="_blank" in <?= html::a($social->url(), $social->platform()) ?>.
How can I do that?

1 Like

You can pass an array with attributes as the 3rd parameter:

Html::a($social->url(), $social->platform(), ['target' => '_blank']);

Reference: https://getkirby.com/docs/reference/tools/html/a

1 Like

Super! Thank you so much. :slight_smile: