-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnavbar_item.html
43 lines (43 loc) · 2.48 KB
/
navbar_item.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<li class="{{ listclass }}">
{%- if include.item.type == 'link' -%}
{%- if include.item.href and include.item.title -%}
<a class="{{ linkclass }} {{include.itemclass}}" href="{{ include.item.href }}" target="_blank" title="Linkki johtaa ulkopuoliselle sivustolle">{{ include.item.title }} <i class="fas fa-external-link-square-alt"></i></a>
{%- endif -%}
{%- elsif include}.item.type == 'file' -%}
{%- if include.item.href and include.item.title -%}
<a class="{{ linkclass }} {{include.itemclass}}" href="{{ include.item.href }}" download title="Ladattava tiedosto {% if include.item.format %}( {{include.item.format}} ){% endif %}">{{ include.item.title }} <i class="fas fa-download"></i></a>
{%- endif -%}
{%- elsif include}.item.type == 'group' -%}
{%- if include.item.title -%}
<span class="{{ linkclass }} {{include.itemclass}} heading">{{ include.item.title }}</span>
{%- endif -%}
{%- elsif include.item.type == 'module' -%}
{%- assign navdata = site.data.modules[include.item.moduleId] -%}
{%- if navdata -%}
{%- if navdata.versions -%}
{%- assign default_version = navdata.versions | where_exp: "version", "version.default" | first -%}
{%- unless default_version -%}
{%- assign default_version = navdata.versions | first -%}
{%- endunless -%}
{%- else -%}
{%- assign default_version = nil -%}
{%- endif -%}
{%- if navdata.basepath and navdata.nav_items -%}
{%- assign basepath = navdata.basepath -%}
{%- assign default_item = navdata.nav_items | where_exp: "item", "item.default" | first -%}
{%- unless default_item -%}
{%- assign default_item = navdata.nav_items | first -%}
{%- endunless -%}
{%- capture default_path -%}{%- include common/getNavItemPath.html item=default_item -%}{%- endcapture -%}
{%- if default_version -%}
{%- assign path = basepath | append: '/' | append: default_version.path | append: '/' | append: default_path -%}
{%- else -%}
{%- assign path = basepath | append: '/' | append: default_path -%}
{%- endif --%}
<a class="{{ linkclass }} {{include.itemclass}}" href="{{ site.url }}/{{ path }}">{{ navdata.title }}</a>
{%- else -%}
<span class="{{ linkclass }} {{include.itemclass}} disabled">{{ navdata.title }}</span>
{%- endif -%}
{%- endif -%}
{%- endif -%}
</li>