Simplify navigation and URL-based logic in your templates.
In an effort to reduce the number of packages we publicly maintain, Sprout Active will not be migrated to Craft 4. If you'd like to take the helm or take responsibility over maintaining the repository please reach out: sprout@barrelstrengthdesign.com., (*2)
Simplify navigation and URL-based logic in your templates., (*3)
Sprout Active makes it simple to control the active classname in your navigation or conditional content based on your URL segments or your full URL., (*4)
Sprout Active provides the active
and activeClass
Twig Filters to test for matching URL segments and output a class to make an element active., (*5)
The most simple version of these filters will match the first segment in the URL http://example.com/about-us. If no match is found, they will return blank., (*6)
``` twig {{ active('about-us') }} {# Output if match: active #}, (*7)
{{ activeClass('about-us') }} {# Output if match: class="active" #}, (*8)
{{ activeClass(entry.slug) }} ```, (*9)
See the documentation for more advanced use cases., (*10)
See the Sprout Website for documentation, guides, and additional resources., (*11)