Navigation static - Twig, Craft CMS

<!-- Declare uri segment --> {% set uriSegment = craft.request.segment(1) %} <!-- --> <ul class="nav"> <li{% if craft.request.firstSegment == '' %} class="current"{% endif %}><a href="{{ siteUrl }}"><div>Home</div></a></li> <li{% if uriSegment == "work" %} class="current"{% endif %}><a href="{{ siteUrl }}work"><div>Work</div></a></li> <li{% if uriSegment == "about" %} class="current"{% endif %}><a href="{{ siteUrl }}about"><div>About</div></a></li> <li{% if uriSegment == "contact" %} class="current"{% endif %}><a href="{{ siteUrl }}contact"><div>Contact</div></a></li> </ul>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.