Skip to content

Commit

Permalink
perf: cache partials
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jun 4, 2024
1 parent 67ed9a3 commit 98eb6e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
8 changes: 8 additions & 0 deletions layouts/partials/hb/modules/breadcrumb/ancestor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<li class="breadcrumb-item">
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
{{- with .Params.nav_icon }}
{{- partial "icons/icon" (merge . (dict "color" "" "className" "me-1")) }}
{{- end }}
{{- cond .IsHome (i18n "hb_breadcrumb_home") .Title -}}
</a>
</li>
3 changes: 3 additions & 0 deletions layouts/partials/hb/modules/breadcrumb/ancestors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- range .Reverse }}
{{ partialCached "hb/modules/breadcrumb/ancestor" . . }}
{{- end -}}
11 changes: 1 addition & 10 deletions layouts/partials/hb/modules/breadcrumb/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@
<div class="container-fluid px-0 mb-4">
<nav aria-label="breadcrumb">
<ol class="hb-breadcrumb breadcrumb">
{{- range .Ancestors.Reverse }}
<li class="breadcrumb-item">
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
{{- with .Params.nav_icon }}
{{- partial "icons/icon" (merge . (dict "color" "" "className" "me-1")) }}
{{- end }}
{{- cond .IsHome (i18n "hb_breadcrumb_home") .Title -}}
</a>
</li>
{{- end -}}
{{- partialCached "hb/modules/breadcrumb/ancestors" .Ancestors .Ancestors }}
<li class="breadcrumb-item active" aria-current="page">
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
{{- with .Params.nav_icon }}
Expand Down

0 comments on commit 98eb6e7

Please sign in to comment.