summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-02 09:11:17 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-02 09:11:17 +0800
commit5fdc3e6ae9f688dfdbae8c99669ba5427b2dee78 (patch)
tree06ed7cb765bcd5f0405b6af8c128e8d04ba80741
parentUpdate layouts (diff)
downloadwebsite-5fdc3e6ae9f688dfdbae8c99669ba5427b2dee78.tar.gz
website-5fdc3e6ae9f688dfdbae8c99669ba5427b2dee78.tar.zst
website-5fdc3e6ae9f688dfdbae8c99669ba5427b2dee78.zip
Add actual navbar
-rw-r--r--assets/style.css33
-rw-r--r--layouts/_default/baseof.html24
2 files changed, 56 insertions, 1 deletions
diff --git a/assets/style.css b/assets/style.css
index 481e4af..949f7d1 100644
--- a/assets/style.css
+++ b/assets/style.css
@@ -33,15 +33,42 @@ a:link, a:visited {
aside#sidebar {
position: fixed;
+ top: 0;
+ left: 0;
width: min(33%, 200px);
height: 100%;
background-color: var(--sidebar-bg);
overflow-y: auto;
+ padding: 0px 10px;
+ box-sizing: border-box;
+}
+
+aside#sidebar a:link,
+aside#sidebar a:visited {
+ text-decoration: none;
+ color: var(--fg);
+}
+
+
+aside#sidebar > ul > li:not(first-child) {
+ margin-top: 1rem;
+}
+
+aside#sidebar > ul {
+ list-style: none;
+}
+
+aside#sidebar ul {
+ padding-left: 1rem;
+}
+
+aside#sidebar > ul {
+ padding-left: 0rem;
}
div#main-and-footer {
margin-left: min(33%, 200px);
- padding: 10px;
+ padding: 0px 10px;
}
main {
@@ -60,3 +87,7 @@ main:not(.wide) {
margin-left: 0px;
}
}
+
+.nav-current {
+ font-weight: bold;
+}
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 33f8136..6f55b57 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -9,6 +9,30 @@
</head>
<body>
<aside id="sidebar">
+ <p style="text-align: center; font-weight: bold;">
+ <a href="/">{{ .Site.Title }}</a>
+ </p>
+ {{ $currentSection := .CurrentSection }}
+ <ul>
+ {{ range .Site.Sections }}
+ {{ if eq $currentSection . }}
+ <li class="nav-current"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+ {{ else }}
+ <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+ {{ end }}
+ {{ if or (eq $currentSection .) ($currentSection.IsDescendant .) }}
+ <ul>
+ {{ range .Pages }}
+ {{ if eq $currentSection . }}
+ <li class="nav-current"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+ {{ else }}
+ <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+ {{ end }}
+ {{ end }}
+ </ul>
+ {{ end }}
+ {{ end }}
+ </ul>
</aside>
<div id="main-and-footer">
<main>