From 7d0f8e7e987bdba3c2ad5b49caa28e45d7ef2b91 Mon Sep 17 00:00:00 2001 From: Koki Fukuda Date: Tue, 26 Jan 2021 15:10:18 +0900 Subject: Add noopener attribute to external links --- layouts/_default/_markup/render-link.html | 2 +- layouts/partials/article-author.html | 10 +++++----- layouts/partials/copyright.html | 6 +++--- layouts/partials/navigation-items.html | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 312379b..4b2feef 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -2,4 +2,4 @@ {{- $text := .Text | safeHTML -}} {{- $text -}} \ No newline at end of file +{{- if strings.HasPrefix $url "http" -}}target="_blank" rel="noopener noreferrer"{{- end -}}>{{- $text -}} diff --git a/layouts/partials/article-author.html b/layouts/partials/article-author.html index a3e12e3..4ea8c6a 100644 --- a/layouts/partials/article-author.html +++ b/layouts/partials/article-author.html @@ -14,21 +14,21 @@
{{- with .github -}} -  {{- . -}} +  {{- . -}} {{- end -}} {{- with .docker -}} -  {{- . -}} +  {{- . -}} {{- end -}} {{- with .twitter -}} -  @{{- . -}} +  @{{- . -}} {{- end -}} {{- with .email -}} -  {{- . -}} +  {{- . -}} {{- end -}}
{{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/layouts/partials/copyright.html b/layouts/partials/copyright.html index 6ee749c..215f256 100644 --- a/layouts/partials/copyright.html +++ b/layouts/partials/copyright.html @@ -2,7 +2,7 @@ \ No newline at end of file + diff --git a/layouts/partials/navigation-items.html b/layouts/partials/navigation-items.html index 882279c..60fbf4a 100644 --- a/layouts/partials/navigation-items.html +++ b/layouts/partials/navigation-items.html @@ -13,8 +13,8 @@ {{- $url = $url | safeURL -}} {{- if strings.HasPrefix $url "/" -}}{{- $url = $url | relLangURL -}}{{- end -}} {{- .title -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} -- cgit v1.2.3