Skip to content

Commit

Permalink
feat: load sharer only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
HEIGE-PCloud committed Mar 28, 2024
1 parent 0aef2ee commit 6cef8c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion layouts/partials/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
{{- end -}}

{{- /* Sharer.js */ -}}
{{- if $params.share.enable -}}
{{- if $params.share.enable | and (.Scratch.Get "this").sharer -}}
{{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "sharerjs" true | merge $config -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/plugin/share.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $share := (.Scratch.Get "params").share | default dict -}}

{{- .Page.Scratch.SetInMap "this" "sharer" true -}}
{{- if $share.enable -}}
{{- /* 001: Twitter */ -}}
{{- if $share.Twitter -}}
Expand Down

0 comments on commit 6cef8c4

Please sign in to comment.