mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -1,21 +1,13 @@
|
||||
---
|
||||
title: partialCached
|
||||
linktitle: partialCached
|
||||
description: Allows for caching of partials that do not need to be re-rendered on every invocation.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
parent: functions
|
||||
keywords: [performance]
|
||||
signature: ["partialCached LAYOUT INPUT [VARIANT...]"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
The `partialCached` template function can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation.
|
||||
@@ -26,7 +18,7 @@ The `partialCached` template function can offer significant performance gains fo
|
||||
|
||||
Here is the simplest usage:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ partialCached "footer.html" . }}
|
||||
```
|
||||
|
||||
@@ -38,11 +30,10 @@ You can also pass additional parameters to `partialCached` to create *variants*
|
||||
|
||||
If you need to pass additional parameters to create unique variants, you can pass as many variant parameters as you need:
|
||||
|
||||
```
|
||||
```go-html-template
|
||||
{{ partialCached "footer.html" . .Params.country .Params.province }}
|
||||
```
|
||||
|
||||
Note that the variant parameters are not made available to the underlying partial template. They are only use to create a unique cache key. Since Hugo `0.61.0` you can use any object as cache key(s), not just strings.
|
||||
|
||||
|
||||
> See also [The Full Partial Series Part 1: Caching!](https://regisphilibert.com/blog/2019/12/hugo-partial-series-part-1-caching-with-partialcached/)
|
||||
See also [The Full Partial Series Part 1: Caching!](https://regisphilibert.com/blog/2019/12/hugo-partial-series-part-1-caching-with-partialcached/).
|
||||
|
Reference in New Issue
Block a user