Skip to content

Commit

Permalink
perf: cache partials (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jun 2, 2024
1 parent ec70bbc commit dbefac4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
20 changes: 9 additions & 11 deletions layouts/partials/hb/modules/content-panel/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
"name" "chat-dots"
}}
{{- $icon := partialCached "icons/icon" $iconCtx $iconCtx }}
{{- if and (default true site.Params.hb.content_panel.comments) (default true .Params.comments) }}
<div class="hb-content-panel-item">
<a
href="#content-comments"
class="btn btn-link text-body"
title="{{ i18n `comments` }}"
role="button">
{{- $icon }}
</a>
</div>
{{- end }}
<div class="hb-content-panel-item">
<a
href="#content-comments"
class="btn btn-link text-body"
title="{{ i18n `comments` }}"
role="button">
{{- $icon }}
</a>
</div>
12 changes: 9 additions & 3 deletions layouts/partials/hb/modules/content-panel/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<div
class="hb-content-panel-wrapper position-sticky mb-4 d-flex justify-content-center">
<div class="hb-content-panel d-flex shadow w-auto rounded-5 bg-body">
{{ partial "hb/modules/content-panel/translations" . }}
{{ partial "hb/modules/content-panel/comments" . }}
{{ partial "hb/modules/content-panel/repo" . }}
{{- with .Translations }}
{{ partial "hb/modules/content-panel/translations" . }}
{{- end }}
{{- if and (default true site.Params.hb.content_panel.comments) (default true .Params.comments) }}
{{ partialCached "hb/modules/content-panel/comments" . }}
{{- end }}
{{- if site.Params.hb.content_panel.repo }}
{{ partial "hb/modules/content-panel/repo" . }}
{{- end }}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- with .Translations }}
{{- with . }}
<div
class="hb-content-panel-item hb-content-panel-translations dropup-center dropup">
<button
Expand Down

0 comments on commit dbefac4

Please sign in to comment.