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
).
- class for current page and its parent pages (default:
current-class
- class for current page (default:
current
).
- class for current page (default:
untranslated-class
- class for untranslated pages (default:
untranslated
).
- class for untranslated pages (default:
hidden-class
- class for hidden pages (default:
hidden
).
- class for hidden pages (default:
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 tag (default:
wrapper-class
- class that is added to wrapper tag if present (default:
none
).
- class that is added to wrapper tag if present (default:
link-class
- class that is added to only the anchor tag (default:
none
).
- class that is added to only the anchor tag (default:
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>