So building on the answers from my previous question, I'm trying to cache the main navigation on my site.
As I understand it, the principle is to cache everything in one big chunk and then use the stash:nocache
tag to except the conditionals used for the active state.
The relevant part of my code is:
{exp:stash:set name="full_nav_cache" parse_tags="yes" parse_conditionals="yes" output="yes" save="yes" refresh="180" replace="no" scope="site"}
{exp:navee:custom nav_title="main-nav" wrap_type="none"}
<li class="{stash:nocache}{if '{site_url}{segment_1}/' == {/stash:nocache}'{link}'{stash:nocache}}selected{/if}{/stash:nocache}">
{/exp:navee:custom}
{/exp:stash:set}
However, it seems like the {segment_1}
variable is still parsed when the cache is saved. In the database I'm seeing:
<li class="{if '{site_url}/products/' == 'http://mysite.com/products/'}selected{/if}">
But I was expecting:
<li class="{if '{site_url}{segment_1}/' == 'http://mysite.com/products/'}selected{/if}">
which would then get parsed on the page load. Is the the expected behavior?