Reputation: 417
i have a project running grunt with assemble and swig as the engine for templating. i need to know how to handle paths for my navigation, because i want to store some files in subfolders.
i just found this for assemble: http://assemble.io/helpers/helpers-path.html but that doesn't work for me, it says "Warning: Unexpected string Use".
anyone knows a solution for that? do you need any further information?
Upvotes: 1
Views: 337
Reputation: 417
Thanks for your help at first! I found a first solution myself today:
{{ _dirname(page) }}
doesn't work either, because dirname
is related to the layout file where I created my navigation. It does work if I use page.dirname
.
My code now looks like
<ul class="navigation-level-1">
<li class="item-level-1 {% if basename == "page" %}current{% endif %}">
<a href="{% if dirname != 'root' %}../{% endif %}page.html" class="text-level-1">
Guild
</a>
<ul class="navigation-level-2">
<li class="item-level-2">
<a href="{% if page.dirname != "www/subfolder" %}subfolder/{% endif %}subpage.html" class="text-level-2">subpage</a>
</li>
</ul>
</li>
</ul>
But the Problem with this is, that I cannot get into subpages from other pages if i entered one subpage. I hope someone can understand what i mean :D
I try to visualize:
* Page A
** Subpage A
* Page B
** Subpage B
If I entered Subpage A and I want to visit Subpage B i can't do so because my solution just works if I am on the root, you know?
Any ideas? :)
Upvotes: 1