-
Notifications
You must be signed in to change notification settings - Fork 1
/
sidebar.html
61 lines (52 loc) · 1.93 KB
/
sidebar.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{% assign image = page.image %}
{% unless image %}
{% if page.tag %}
{% assign tag = site.data.tags[page.tag] %}
{% assign image = tag.image %}
{% else %}
{% if page.tags.size > 0 %}
{% assign tag_name = page.tags[0] %}
{% assign tag = site.data.tags[tag_name] %}
{% assign image = tag.image %}
{% endif %}
{% endif %}
{% endunless %}
{% unless image %}
{% assign image = site.image %}
{% endunless %}
<div id="_backdrop"></div>
<a id="_menu" href="#_sidebar">☰</a>
<aside id="_sidebar" class="sidebar" {% if image %}style="background-image:url('{{ image }}')"{% endif %}>
<div class="container sidebar-sticky">
<div class="sidebar-about">
<h1><a href="{{ site.baseurl }}/">{{ site.title }}</a></h1>
{{ site.description | markdownify }}
</div>
<nav class="sidebar-nav">
{% for tag_key in site.sidebar_tags %}
{% assign tag = site.data.tags[tag_key] %}
<a class="sidebar-nav-item{% if page.tag == tag_key %} active{% endif %}" href="{{ site.baseurl }}/tag/{{ tag_key }}/">{{ tag.name }}</a>
{% endfor %}
{% comment %}
The code below dynamically generates a sidebar nav of pages with
`layout: page` in the front-matter. See readme for usage.
{% endcomment %}
{% assign pages_list = site.pages %}
{% for node in pages_list %}
{% if node.title != null %}
{% if node.layout == "page" %}
<a class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}" href="{{ node.url | prepend:site.baseurl }}">{{ node.title }}</a>
{% endif %}
{% endif %}
{% endfor %}
</nav>
<div class="sidebar-social">
{% if site.author.github %}
{% include icon-github.html username=site.author.github %}
{% endif %}
{% if site.author.twitter %}
{% include icon-twitter.html username=site.author.twitter %}
{% endif %}
</div>
</div>
</div>