Skip to content

Simplify navigation and URL-based logic in your templates.

License

Notifications You must be signed in to change notification settings

barrelstrength/sprout-active

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

No Maintenance Intended

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.


Sprout Active

Overview

Simplify navigation and URL-based logic in your templates.

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.

Usage

Sprout Active provides the active and activeClass Twig Filters to test for matching URL segments and output a class to make an element active.

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.

{{ active('about-us') }} {# Output if match: active #}

{{ activeClass('about-us') }} {# Output if match: class="active" #}

{{ activeClass(entry.slug) }}

See the documentation for more advanced use cases.

Documentation

See the Sprout Website for documentation, guides, and additional resources.

Support

About

Simplify navigation and URL-based logic in your templates.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Languages