I have a YAML file in my _data
folder that contains a list of links I have in my main nav.
_data/nav.yml
:
main:
- title: Link A
- url: "/path/to/linkA"
- title: Link B
- url: "/path/to/linkB"
- title: Link C
- url: "#"
I then use liquid to dynamically generate the links. Here's the relevant portion of my header file.
_includes/header.html
:
<nav class="quick-links">
{% for item in site.data.nav.main %}
<a href="{{ item.url }}">{{ item.title }}</a>
{% if forloop.last == false %} :: {% endif %}
{% endfor %}
</nav>
The nav outputs as:
Link A :: Link B :: Link C
I'd like the output to look like the following
Link A :: Link B
since Link C
is a placeholder.
How can I dynamically hide placeholder links, i.e. links with "#" as the href?