Skip to content

Commit 09fe20d

Browse files
committed
feat: add path navigation to header
1 parent 949f94d commit 09fe20d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

open-dir.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,19 @@ def process_dir(top_dir):
3232
print('cannot create file %s %s' % (index_path, e))
3333
return
3434

35+
path_top_dir_parents = path_top_dir.parents
36+
path_format = "/ <a style='text-decoration: underline;' href='https://dorianb.net/talks/'>Talks</a> "
37+
for parent in reversed(path_top_dir_parents):
38+
if parent.name != "":
39+
path_format += f"/<a style='text-decoration: underline;' href='https://dorianb.net/talks/{parent}'>{parent.name}</a>"
40+
path_format += f"/<a style='text-decoration: underline;' href='https://dorianb.net/talks/{path_top_dir}'>{path_top_dir.name}</a>"
41+
3542
index_file.write("""<!DOCTYPE html>
3643
<html>
3744
<head>
3845
<meta charset="utf-8">
3946
<meta name="viewport" content="width=device-width, initial-scale=1.0">
47+
<title>Dorian B. Talks</title>
4048
<style>
4149
* { padding: 0; margin: 0; }
4250
body {
@@ -397,7 +405,7 @@ def process_dir(top_dir):
397405
398406
<header>
399407
<h1>"""
400-
f'{path_top_dir.name}'
408+
f'{path_format}'
401409
"""</h1>
402410
</header>
403411
<main>

0 commit comments

Comments
 (0)