Skip to content

Commit 93d57b5

Browse files
committed
[try redirect]
1 parent 5a9151e commit 93d57b5

File tree

3 files changed

+90
-57
lines changed

3 files changed

+90
-57
lines changed

_includes/header.liquid

+75-56
Original file line numberDiff line numberDiff line change
@@ -42,71 +42,90 @@
4242

4343
<div class="collapse navbar-collapse text-right" id="navbarNav">
4444
<ul class="navbar-nav ml-auto flex-nowrap">
45-
<!-- Other pages -->
46-
{% assign sorted_pages = site.pages | sort: 'nav_order' %}
47-
{% for p in sorted_pages %}
48-
{% unless p.permalink == '/index.html' %}
49-
{% if p.nav and p.autogen == null %}
50-
<!-- Existing logic for other pages -->
51-
{% if p.dropdown %}
52-
<!-- Dropdown logic -->
53-
{% assign has_active_child = false %}
54-
{% for child in p.children %}
55-
{% if page.title == child.title %}
56-
{% assign has_active_child = true %}
57-
{% endif %}
58-
{% endfor %}
59-
<li class="nav-item dropdown {% if page.title == p.title or has_active_child %}active{% endif %}">
60-
<a
61-
class="nav-link dropdown-toggle"
62-
href="#"
63-
id="navbarDropdown"
64-
role="button"
65-
data-toggle="dropdown"
66-
aria-haspopup="true"
67-
aria-expanded="false"
68-
>
69-
{{- p.title }}
70-
{% if page.title == p.title or has_active_child %}
71-
<span class="sr-only">(current)</span>
72-
{% endif %}
73-
</a>
74-
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
75-
{% for child in p.children %}
76-
{% if child.title == 'divider' %}
77-
<div class="dropdown-divider"></div>
78-
{% else %}
79-
<a class="dropdown-item {% if page.title == child.title %}active{% endif %}" href="{{ child.permalink | relative_url }}">
80-
{{- child.title -}}
81-
</a>
82-
{% endif %}
83-
{% endfor %}
84-
</div>
85-
</li>
86-
{% else %}
87-
{% assign parent_link = p.permalink | remove: 'index.html' %}
88-
<li class="nav-item {% if page.url contains parent_link %}active{% endif %}">
89-
<a class="nav-link" href="{{ p.url | relative_url }}">
90-
{{- p.title }}
91-
{% if page.url contains p.url %}
92-
<span class="sr-only">(current)</span>
93-
{% endif %}
94-
</a>
95-
</li>
96-
{% endif %}
97-
{% endif %}
98-
{% endunless %}
45+
{% for page in site.pages %}
46+
{% if page.permalink == '/' %} {% assign about_title = page.title %} {% endif %}
9947
{% endfor %}
10048

101-
<!-- Home/blog Page -->
49+
<!-- About -->
10250
<li class="nav-item {% if page.permalink == '/' %}active{% endif %}">
10351
<a class="nav-link" href="{{ '/' | relative_url }}">
104-
blog
52+
{{- about_title }}
10553
{% if page.permalink == '/' %}
10654
<span class="sr-only">(current)</span>
10755
{% endif %}
10856
</a>
10957
</li>
58+
59+
<!-- Other pages -->
60+
{% assign sorted_pages = site.pages | sort: 'nav_order' %}
61+
{% for p in sorted_pages %}
62+
{% if p.nav and p.autogen == null %}
63+
{% if p.dropdown %}
64+
{% assign has_active_child = false %}
65+
{% for child in p.children %}
66+
{% if page.title == child.title %}
67+
{% assign has_active_child = true %}
68+
{% endif %}
69+
{% endfor %}
70+
<li class="nav-item dropdown {% if page.title == p.title or has_active_child %}active{% endif %}">
71+
<a
72+
class="nav-link dropdown-toggle"
73+
href="#"
74+
id="navbarDropdown"
75+
role="button"
76+
data-toggle="dropdown"
77+
aria-haspopup="true"
78+
aria-expanded="false"
79+
>
80+
{{- p.title }}
81+
{% if page.title == p.title or has_active_child %}
82+
<span class="sr-only">(current)</span>
83+
{% endif %}
84+
</a>
85+
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
86+
{% for child in p.children %}
87+
{% if child.title == 'divider' %}
88+
<div class="dropdown-divider"></div>
89+
{% else %}
90+
<a class="dropdown-item {% if page.title == child.title %}active{% endif %}" href="{{ child.permalink | relative_url }}">
91+
{{- child.title -}}
92+
</a>
93+
{% endif %}
94+
{% endfor %}
95+
</div>
96+
</li>
97+
{% else %}
98+
{% assign parent_link = p.permalink | remove: 'index.html' %}
99+
<li class="nav-item {% if page.url contains parent_link %}active{% endif %}">
100+
{% if p.permalink contains '/blog/' %}{% assign url = '/blog/' %} {% else %}{% assign url = p.url %}{% endif %}
101+
<a class="nav-link" href="{{ url | relative_url }}">
102+
{{- p.title }}
103+
{% if page.url contains p.url %}
104+
<span class="sr-only">(current)</span>
105+
{% endif %}
106+
</a>
107+
</li>
108+
{% endif %}
109+
{% endif %}
110+
{% endfor %}
111+
{% if site.search_enabled %}
112+
<!-- Search -->
113+
<li class="nav-item">
114+
<button id="search-toggle" title="Search" onclick="openSearchModal()">
115+
<span class="nav-link">ctrl k <i class="ti ti-search"></i></span>
116+
</button>
117+
</li>
118+
{% endif %}
119+
{% if site.enable_darkmode %}
120+
<!-- Toogle theme mode -->
121+
<li class="toggle-container">
122+
<button id="light-toggle" title="Change theme">
123+
<i class="ti ti-sun-moon" id="light-toggle-system"></i>
124+
<i class="ti ti-moon-filled" id="light-toggle-dark"></i>
125+
<i class="ti ti-sun-filled" id="light-toggle-light"></i>
126+
</button>
127+
</li>
128+
{% endif %}
110129
</ul>
111130
</div>
112131
</div>

_pages/blog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: default
3-
permalink: /
3+
permalink: /blog/
44
title: blog
55
nav: true
66
nav_order: 1

index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="refresh" content="0; url=/blog" />
6+
<script>
7+
window.location.href = "/blog";
8+
</script>
9+
<title>Redirecting to Blog</title>
10+
</head>
11+
<body>
12+
<p>If you are not redirected automatically, please <a href="/blog">click here</a>.</p>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)