Perf: optimize path splicing (#139)

This commit is contained in:
Cell
2022-05-20 17:01:47 +08:00
parent 0963931d2e
commit 0f16e2b72c
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
{{- $gravatar := .Site.Params.gravatar -}}
{{- with $gravatar -}}
{{- $avatar = printf "https://%v/avatar/%v?s=240&d=%v"
(.Host | default "www.gravatar.com")
(path.Clean .Host | default "www.gravatar.com")
(md5 $profile.gravatarEmail)
(.Style | default "mp")
-}}
+1 -1
View File
@@ -38,7 +38,7 @@
{{- with $params.edit -}}
{{- if .Enable -}}
<span>
{{- $options := dict "Class" "link-to-edit" "Destination" (printf "%v/%v" .Url $.File.Path) "Title" (T "editThisPage") "Content" (T "editThisPage") "externalIcon" false -}}
{{- $options := dict "Class" "link-to-edit" "Destination" (path.Join .Url $.File.Path) "Title" (T "editThisPage") "Content" (T "editThisPage") "externalIcon" false -}}
{{- partial "plugin/link.html" $options -}}
</span>
{{- end -}}
+5 -1
View File
@@ -11,7 +11,11 @@
{{- if (not $avatar | or $params.gravatarForce) | and $author.email -}}
{{- $gravatar := .Site.Params.gravatar -}}
{{- with $gravatar -}}
{{- $avatar = printf "https://%v/avatar/%v?s=32&d=%v" (.Host | default "www.gravatar.com") (md5 $author.email) (.Style | default "") -}}
{{- $avatar = printf "https://%v/avatar/%v?s=32&d=%v"
(path.Clean .Host | default "www.gravatar.com")
(md5 $author.email)
(.Style | default "")
-}}
{{- end -}}
{{- end -}}
<span class="post-author">