Skip to content

Commit

Permalink
🐛 Fix: to create a scratch pad that is not reset on server rebuilds, …
Browse files Browse the repository at this point in the history
…use the Store method instead of Scratch method (fixes #417)
  • Loading branch information
Lruihao committed Feb 21, 2024
1 parent 1bd5610 commit 9d6ee9f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/single.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $params := .Scratch.Get "params" -}}
{{- $author := .Scratch.Get "author" -}}
{{- $author := .Store.Get "author" -}}
# {{ .Title }}

{{ if $params.password -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/init/patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
-}}
{{- end -}}
{{- end -}}
{{- .Scratch.Set "author" $author -}}
{{- .Store.Set "author" $author -}}

{{- /* Toc data patch */ -}}
{{- $toc := $params.toc -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/single/post-author.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $params := .Scratch.Get "params" -}}
{{- $author := .Scratch.Get "author" -}}
{{- $params := .Params | merge .Site.Params.page -}}
{{- $author := .Store.Get "author" -}}

<span class="post-author">
{{- $content := $author.name -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/single/reward.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- $reward := .Scratch.Get "reward" -}}
{{- $author := .Scratch.Get "author" -}}
{{- $author := .Store.Get "author" -}}
{{- $options := dict "Reward" $reward "Id" "fi-reward" "Author" $author.name -}}
{{- partial "plugin/reward.html" $options -}}
2 changes: 1 addition & 1 deletion layouts/shortcodes/reward.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- $alipay := (.Get "alipay") | default (.Get 1) -}}
{{- $paypal := (.Get "paypal") | default (.Get 2) -}}
{{- $bitcoin := (.Get "bitcoin") | default (.Get 3) -}}
{{- $author := (.Get "author") | default (.Get 4) | default (.Page.Scratch.Get "author").name -}}
{{- $author := (.Get "author") | default (.Get 4) | default (.Page.Store.Get "author").name -}}
{{- $comment := (.Get "comment") | default (.Get 5) -}}
{{- $mode := (.Get "mode") | default (.Get 6) -}}
{{- $reward := dict "enable" true "comment" $comment "mode" $mode -}}
Expand Down

0 comments on commit 9d6ee9f

Please sign in to comment.