-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.html
More file actions
40 lines (33 loc) · 1002 Bytes
/
Copy pathtemplate.html
File metadata and controls
40 lines (33 loc) · 1002 Bytes
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
<div class="topbar">
<h2>Haishu Su(Hygebra)</h2>
<div class="nav-links">
<a href="/index.html">Homepage</a>
<a href="/blog/index.html">Blog</a>
<!-- <a href="index.html#papers">论文</a>
<a href="index.html#about">关于我</a> -->
</div>
</div>
<div class="sidebar">
<h2>Navigation</h2>
<a href="/index.html">Homepage</a>
<a href="/blog/index.html">Blog</a>
<a href="/test.html">Test</a>
<!-- <a href="#about">关于我</a> -->
<script>
// 找到 sidebar 中所有链接
const sidebarLinks = document.querySelectorAll('.sidebar a');
const currentPage = window.location.pathname.split("/").pop(); // 获取当前页面文件名
sidebarLinks.forEach(link => {
const linkPage = link.getAttribute('href');
if (linkPage === currentPage) {
link.classList.add('active'); // 加上高亮类
}
});
</script>
</div>
<div class="container">
<div class="main">
$body$
</div>
</div>
<script src="/js/sidebar-control.js"></script>