Skip to content

Commit c92d66a

Browse files
committed
feat: add the cache_key parameter
For example, if cache_key is set as "page.Section", then the page section will be used as cache variant key
1 parent fc51904 commit c92d66a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

layouts/partials/hugopress/functions/render-hooks.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
{{- warnf "[hugopress] [%s] rendering hook: %q." .module .name }}
1616
{{- end }}
1717
{{- if .cacheable }}
18-
{{- if ne .cache_param_key "" }}
18+
{{- if ne .cache_key nil }}
19+
{{- partialCached .partial $ctx (index (apply (slice 0) .cache_key) 0) }}
20+
{{- else if ne .cache_param_key nil }}
1921
{{- partialCached .partial $ctx (index $page.Params .cache_param_key) }}
2022
{{- else }}
2123
{{- partialCached .partial $ctx }}

0 commit comments

Comments
 (0)