Skip to content

Commit 73de988

Browse files
committed
feat: Open social links in new tab
* Add target="_blank" and rel="noopener" to social links * Create custom nav.html template to override theme default
1 parent 7f7f629 commit 73de988

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

templates/partials/nav.html

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<nav>
2+
<div class="left-nav">
3+
{% if config.extra.logo %}
4+
<a href={{ config.base_url }} class="logo">
5+
<img alt="{{ config.title }}" src="{{ get_url(path=config.extra.logo) }}">
6+
</a>
7+
{% else %}
8+
<a href={{ config.base_url }}>{{ config.title }}</a>
9+
{% endif %}
10+
11+
12+
<div class="socials">
13+
{% for social in config.extra.socials %}
14+
<a rel="me" href="{{ social.url }}" class="social" target="_blank" rel="noopener">
15+
<img alt="{{ social.name }}"
16+
src="{{ get_url(path="icons/social/" ~ social.icon ~ ".svg") }}">
17+
</a>
18+
{% endfor %}
19+
</div>
20+
</div>
21+
22+
<div class="right-nav">
23+
{% for menu in config.extra.menu %}
24+
<a href={{ get_url(path=menu.url) }} style="margin-right: 0.5em">{{ menu.name }}</a>
25+
{% endfor %}
26+
27+
{% if config.build_search_index %}
28+
<button id="search-button"
29+
class="search-button"
30+
title="$SHORTCUT to open search">
31+
<img src="{{ get_url(path='icons/search.svg') }}"
32+
alt="Search"
33+
class="search-icon">
34+
</button>
35+
36+
<div id="searchModal"
37+
class="search-modal js"
38+
role="dialog"
39+
aria-labelledby="modalTitle">
40+
<div id="modal-content">
41+
<h1 id="modalTitle" class="page-header">Search</h1>
42+
<div id="searchBar">
43+
<input id="searchInput"
44+
role="combobox"
45+
autocomplete="off"
46+
spellcheck="false"
47+
aria-expanded="false"
48+
aria-controls="results-container"
49+
placeholder="Search..." />
50+
<button id="clear-search" class="clear-button" title="Clear search">
51+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960">
52+
<path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z" />
53+
</svg>
54+
</button>
55+
</div>
56+
<div id="results-container">
57+
<div id="results-info">
58+
<span id="zero_results" style="display: none;">No results</span>
59+
<span id="one_result" style="display: none;">1 result</span>
60+
<span id="many_results" style="display: none;">$NUMBER results</span>
61+
</div>
62+
<div id="results" role="listbox"></div>
63+
</div>
64+
</div>
65+
</div>
66+
{% endif %}
67+
68+
{% if config.extra.theme == "toggle" %}
69+
<a id="dark-mode-toggle"
70+
onclick="toggleTheme(); event.preventDefault();"
71+
href="#">
72+
<img src="{{ get_url(path="icons/sun.svg") }}"
73+
id="sun-icon"
74+
style="filter: invert(1)"
75+
alt="Light" />
76+
<img src={{ get_url(path="icons/moon.svg") }} id="moon-icon" alt="Dark" />
77+
</a>
78+
79+
<!-- Initialize the theme toggle icons -->
80+
<script>updateItemToggleTheme()</script>
81+
{% endif %}
82+
</div>
83+
</nav>

0 commit comments

Comments
 (0)