Perf: remove extra spaces in plugin link

This commit is contained in:
Cell
2022-09-04 02:02:48 +08:00
parent 2d2d6c4071
commit e9b5e33b39
2 changed files with 11 additions and 19 deletions
+1
View File
@@ -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
+10 -19
View File
@@ -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 -}}
<a
href="{{ .Destination | safeURL }}"
{{ with .Title }}
title="{{ . }}"
{{ end }}
{{ if (urls.Parse .Destination).Host | or .Newtab }}
{{ $rel = cond $noreferrer "external nofollow noopener noreferrer" "external nofollow" }}
{{ $external = true }}
target="_blank"
{{ end }}
{{ if $rel | or .Rel }}
rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"
{{ end }}
{{ with $class }}
class="{{ with $class }}{{ . }}{{ end }}"
{{ end }}
{{ with .Download }}
download="{{ . }}"
{{ end }}
<a href="{{ .Destination | safeURL }}"
{{- with .Title }} title="{{ . }}"{{- end -}}
{{- if $external -}} target="_blank"{{- end -}}
{{- if $rel | or .Rel }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{- end -}}
{{- with $class }} class="{{ with $class }}{{ . }}{{ end }}"{{- end -}}
{{- with .Download }} download="{{ . }}"{{- end -}}
>
{{- if ne .Card true -}}
{{- with .Icon -}}