I’m trying to implement some caching, but I’m confused by how the variant variable works.
So for example, I have the line {{ partialCache "header" . .Section }} then I run into problems since the header partial has a line which uses .IsPage to decide whether certain JS/CSS is used.
When using partialCache it seems .IsPage always returns false, though I thought the .Section variant means the cache is rebuilt for each section (e.g. posts or sermons in this theme). Have I missed something in the docs?
Speculating here, but /posts/ and /posts/foo/ will both have posts as its value for .Section. So both /posts/and /posts/foo/ will have the same partial cached “value” despite one being .IsPage: true and the other not.
So, I’ve been playing with this. What other options can be passed as a variant to partialCached? Is there a way to get a the cache to be reused for all the Pages in a section (i.e. built with single.html) and not for the Node (list.html).
Basically, the above code snippet is the use case: can I use partialCached for building all the individual pages/posts in a section, but not use the cached version for the list or homepage parts of the site. Or am I trying to make things too tricky, and hugo’s efficiency means I don’t need to worry too much about making maximal use of caching?