From e9b5e33b39fea555831da392856675f7d390fc43 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Sun, 4 Sep 2022 02:02:48 +0800 Subject: [PATCH] :zap: Perf: remove extra spaces in plugin link --- CHANGELOG.md | 1 + layouts/partials/plugin/link.html | 29 ++++++++++------------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b978aa8e..48e9e862 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - :sparkles: Feat(highlight): add full support for Chroma highlighting languages in the [list](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages) - :sparkles: Feat: add optional parameter `noreferrer` for the shortcode `link` - :sparkles: Feat: update echarts theme config +- :zap: Perf: remove extra spaces in plugin link - :wheelchair: Feat(accessibility): use `aria-hidden=true` on icons that AT should ignore - :bug: Fix: add function doc2unix to unify new lines symbol between Windows and Unix/Mac OS - :bug: Fix: author display error in post and markdown file diff --git a/layouts/partials/plugin/link.html b/layouts/partials/plugin/link.html index 1dbaa233..a940fa53 100644 --- a/layouts/partials/plugin/link.html +++ b/layouts/partials/plugin/link.html @@ -4,29 +4,20 @@ {{- if eq .Noreferrer false -}} {{- $noreferrer = false -}} {{- end -}} +{{- if (urls.Parse .Destination).Host | or .Newtab -}} + {{- $rel = cond $noreferrer "external nofollow noopener noreferrer" "external nofollow" -}} + {{- $external = true -}} +{{- end -}} {{- $class := .Class | default "" -}} {{- if eq .Card true -}} {{- $class = trim (printf "%v %v" "card-link" $class) " " -}} {{- end -}} - {{- if ne .Card true -}} {{- with .Icon -}}