Skip to content

Instantly share code, notes, and snippets.

@croxton
Created January 9, 2012 12:03
Show Gist options
  • Save croxton/1582667 to your computer and use it in GitHub Desktop.
Save croxton/1582667 to your computer and use it in GitHub Desktop.
Taxonomy and Stash - primary navigation
In the viewModel:
{exp:stash:set name="nav_main" parse_tags="yes" save="yes" refresh="60" replace="no" scope="site"}
{exp:taxonomy:nav tree_id="1" depth="1" ul_css_id="my-id"}
<a href="{node_url}"{stash:nocache}{if "{exp:stash:get name='segment_1' type='global'}" == "{/stash:nocache}{node_url}{stash:nocache}"} class="active"{/if}{/stash:nocache}>{node_title}</a>
{/exp:taxonomy:nav}
{/exp:stash:set}
(I'm assuming Taxonomy {node_url} is something like 'my_page' NOT 'www.mysite/my_page', so that we can compae it to {segment_1}- if it produces something else adjust the conditional above accordingly)
In the view:
{exp:stash:get name="nav_main" scope="site"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment