Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 02e96c6

Browse files
authored
Sidebar from chirpy
Added sidebar locally for further customizations
1 parent 44f8d6a commit 02e96c6

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

_includes/sidebar.html

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<!-- The Side Bar -->
2+
3+
<aside aria-label="Sidebar" id="sidebar" class="d-flex flex-column align-items-end">
4+
<header class="profile-wrapper">
5+
<a href="{{ '/' | relative_url }}" id="avatar" class="rounded-circle">
6+
{%- if site.avatar != empty and site.avatar -%}
7+
{%- capture avatar_url -%}
8+
{% include media-url.html src=site.avatar %}
9+
{%- endcapture -%}
10+
<img src="{{- avatar_url -}}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
11+
{%- endif -%}
12+
</a>
13+
14+
<a class="site-title d-block" href="{{ '/' | relative_url }}">{{ site.title }}</a>
15+
<p class="site-subtitle fst-italic mb-0">{{ site.tagline }}</p>
16+
</header>
17+
<!-- .profile-wrapper -->
18+
19+
<nav class="flex-column flex-grow-1 w-100 ps-0">
20+
<ul class="nav">
21+
<!-- home -->
22+
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
23+
<a href="{{ '/' | relative_url }}" class="nav-link">
24+
<i class="fa-fw fas fa-home"></i>
25+
<span>{{ site.data.locales[include.lang].tabs.home | upcase }}</span>
26+
</a>
27+
</li>
28+
<!-- the real tabs -->
29+
{% for tab in site.tabs %}
30+
<li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
31+
<a href="{{ tab.url | relative_url }}" class="nav-link">
32+
<i class="fa-fw {{ tab.icon }}"></i>
33+
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
34+
35+
<span>{{ site.data.locales[include.lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
36+
</a>
37+
</li>
38+
<!-- .nav-item -->
39+
{% endfor %}
40+
</ul>
41+
</nav>
42+
43+
{% for tongue in site.languages %}
44+
<a {% if tongue == site.active_lang %}style="font-weight: bold;"{% endif %} {% static_href %}href="{% if tongue == site.default_lang %}{{site.baseurl}}{{page.url}}{% else %}{{site.baseurl}}/{{ tongue }}{{page.url}}{% endif %}"{% endstatic_href %} >{{ tongue }}</a>{%- if forloop.last == false -%}{{" "}}{{ site.langsep }}{%- endif -%}
45+
{% endfor %}
46+
47+
<div class="sidebar-bottom d-flex flex-wrap align-items-center w-100">
48+
{% unless site.theme_mode %}
49+
<button type="button" class="btn btn-link nav-link" aria-label="Switch Mode" id="mode-toggle">
50+
<i class="fas fa-adjust"></i>
51+
</button>
52+
53+
{% if site.data.contact.size > 0 %}
54+
<span class="icon-border"></span>
55+
{% endif %}
56+
{% endunless %}
57+
58+
{% for entry in site.data.contact %}
59+
{% case entry.type %}
60+
{% when 'github', 'twitter' %}
61+
{%- capture url -%}
62+
https://{{ entry.type }}.com/{{ site[entry.type].username }}
63+
{%- endcapture -%}
64+
{% when 'email' %}
65+
{% assign email = site.social.email | split: '@' %}
66+
{%- capture url -%}
67+
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
68+
{%- endcapture -%}
69+
{% when 'rss' %}
70+
{% assign url = '/feed.xml' | relative_url %}
71+
{% else %}
72+
{% assign url = entry.url %}
73+
{% endcase %}
74+
75+
{% if url %}
76+
<a
77+
href="{{ url }}"
78+
aria-label="{{ entry.type }}"
79+
{% assign link_types = '' %}
80+
81+
{% unless entry.noblank %}
82+
target="_blank"
83+
{% assign link_types = 'noopener noreferrer' %}
84+
{% endunless %}
85+
86+
{% if entry.type == 'mastodon' %}
87+
{% assign link_types = link_types | append: ' me' | strip %}
88+
{% endif %}
89+
90+
{% unless link_types == empty %}
91+
rel="{{ link_types }}"
92+
{% endunless %}
93+
>
94+
<i class="{{ entry.icon }}"></i>
95+
</a>
96+
{% endif %}
97+
{% endfor %}
98+
</div>
99+
<!-- .sidebar-bottom -->
100+
</aside>
101+
<!-- #sidebar -->

0 commit comments

Comments
 (0)