1
0
Fork 0

Add nav crumbs

This commit is contained in:
Tim Van Baak 2023-09-11 17:26:56 -07:00
parent 6da3c36735
commit 7755f2be31
2 changed files with 14 additions and 1 deletions

View File

@ -65,6 +65,14 @@ def main():
article.append(page_content)
page.article.replace_with(article)
# Inject path into the nav
for i in range(len(dirpath.parts)):
a = page.new_tag("a")
a["href"] = "/" + "/".join(dirpath.parts[:i+1]) + "/"
a.string = dirpath.parts[i]
page.nav.append(a)
page.nav.append(page.new_string("/"))
# Apply metadata to the template
if meta_title := meta.get("title"):
title = "".join(meta_title)

View File

@ -7,9 +7,13 @@
body {
max-width: 100ch;
margin: 0 auto;
padding: 2em;
padding: 1em 2em;
line-height: 1.4em;
}
nav {
font-size: 1.2em;
font-family: monospace;
}
:target {
background: palegoldenrod;
}
@ -22,6 +26,7 @@ header::after {
</head>
<body>
<header>
<nav><a href="/">~</a>/</nav>
<h1>Untitled Page</h1>
</header>
<main>