From a6874e4a2de82e97a9c16d3d5801b68038734eb8 Mon Sep 17 00:00:00 2001
From: Olivia Simonet <91660674+Olivia206@users.noreply.github.com>
Date: Mon, 7 Oct 2024 09:20:44 +0200
Subject: [PATCH] =?UTF-8?q?Ajouter=20la=20d=C3=A9tection=20des=20liens=20e?=
 =?UTF-8?q?xternes=20aux=20boutons=20du=20hero=20(#633)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 layouts/partials/header/hero.html | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/layouts/partials/header/hero.html b/layouts/partials/header/hero.html
index 03afc360..d967378e 100644
--- a/layouts/partials/header/hero.html
+++ b/layouts/partials/header/hero.html
@@ -47,7 +47,10 @@
 
         {{ with $button }}
           {{ if and .display .target .label }}
-            <a href="{{ .target }}" class="btn">{{ .label }}</a>
+            {{ $title := .label }}
+            {{ $isExternal := .external | default false }}
+            {{ $link_title := cond $isExternal (safeHTML (i18n "commons.link.blank_aria" (dict "Title" $title))) $title}}
+            <a href="{{ .target }}" title ="{{ $link_title }}" class="btn" {{ if $isExternal -}} target="_blank" rel="noopener" {{- end }}>{{ .label }}</a>
           {{ end }}
         {{ end }}
 
-- 
GitLab