Skip to content

Commit

Permalink
feat: add the cache_key parameter
Browse files Browse the repository at this point in the history
For example, if cache_key is set as "page.Section", then the page section will be used as cache variant key
  • Loading branch information
razonyang committed Jun 1, 2024
1 parent fc51904 commit c92d66a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion layouts/partials/hugopress/functions/render-hooks.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
{{- warnf "[hugopress] [%s] rendering hook: %q." .module .name }}
{{- end }}
{{- if .cacheable }}
{{- if ne .cache_param_key "" }}
{{- if ne .cache_key nil }}
{{- partialCached .partial $ctx (index (apply (slice 0) .cache_key) 0) }}
{{- else if ne .cache_param_key nil }}
{{- partialCached .partial $ctx (index $page.Params .cache_param_key) }}
{{- else }}
{{- partialCached .partial $ctx }}
Expand Down

0 comments on commit c92d66a

Please sign in to comment.