Voog.com

menulink

Generates a link to a page. Use it with variables available from site.menuitems array:

{% for item in site.menuitems %}
  {% menulink item %}
{% endfor %}

#=>
<a href="/site_root/company">Company</a>
<a href="/site_root/contact">Contact information</a>

Optional parameters:

  • selected-class
    • class for current page and its parent pages (default: selected).
  • current-class
    • class for current page (default: current).
  • untranslated-class
    • class for untranslated pages (default: untranslated).
  • hidden-class
    • class for hidden pages (default: hidden).
  • wrapper-tag
    • wrapper tag (default: none). When present then link is wrapped to given tag and selected, current and untranslated classes is added to wrapper element.
  • wrapper-class
    • class that is added to wrapper tag if present (default: none).
  • link-class
    • class that is added to only the anchor tag (default: none).

Advanced example:

{% assign my_class = "my-class" %}

<nav><ul> {% for item in site.menuitems %} {% menulink item
link-class=my_class
wrapper-tag="li"
wrapper-class="link"
current-class="currentitem"
%} {% endfor %} </ul></nav> #=> <nav><ul> <li class="link currentitem">    <a class="my-class" href="/site_root/company">Company</a> </li> <li class="link">    <a class="my-class" href="/site_root/contact">Contact information</a> </li> </ul></nav>