use relative hrefs
This commit is contained in:
parent
0045b7e0a4
commit
0f5f33328a
12
build.py
12
build.py
|
|
@ -132,7 +132,7 @@ sheets: ["/static/highlight.css"]
|
|||
<article class="panel">
|
||||
<h1>{input['title']}</h1>
|
||||
<p>{input['date']}</p>
|
||||
<a href="{'/' / path.parent}">back</a>py{{{{ ' | ' if minimal else ' ' }}}}<a href="{'/' / path}">raw</a>
|
||||
<a href=".">back</a>py{{{{ ' | ' if minimal else ' ' }}}}<a href="{path.name}">raw</a>
|
||||
<p>{format_tags(input['tags'])}</p>
|
||||
<hr>
|
||||
{html}
|
||||
|
|
@ -151,9 +151,11 @@ def index_dir(dir):
|
|||
else:
|
||||
f = reversed(sorted([p for p in dir.glob('*') if not p.name.startswith('.')], key=os.path.getmtime))
|
||||
def href(x):
|
||||
if x.is_dir():
|
||||
return f'{x.name}/'
|
||||
if x.suffix in ['.md', '.html']:
|
||||
return x.with_suffix('')
|
||||
return x
|
||||
return x.with_suffix('').name
|
||||
return x.name
|
||||
def title(x):
|
||||
if x.suffix in ['.md', '.html']:
|
||||
return frontmatter.load(x).metadata['title']
|
||||
|
|
@ -164,9 +166,9 @@ title: '{dir}'
|
|||
<div class="container">
|
||||
<div class="panel">
|
||||
<h2>{dir}</h2>
|
||||
<a href="{'/' / dir.parent}">back</a>
|
||||
<a href="..">back</a>
|
||||
<ul>
|
||||
{chr(10).join(f'<li><a href="/{href(x)}">{title(x)}</a></li>' for x in f)}
|
||||
{chr(10).join(f'<li><a href="{href(x)}">{title(x)}</a></li>' for x in f)}
|
||||
</ul>
|
||||
</div>
|
||||
</div>'''
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ title: home
|
|||
<div class="panel c">
|
||||
<h2>py{{ 'μ.twoha.cc' if minimal else 'u.twoha.cc' }}</h2>
|
||||
<hr>
|
||||
<a href="/about">about</a><br>
|
||||
<a href="/contact">contact</a><br>
|
||||
<a href="/uses">uses</a><br>
|
||||
<a href="/ctf">ctf</a><br>
|
||||
<a href="about">about</a><br>
|
||||
<a href="contact">contact</a><br>
|
||||
<a href="uses">uses</a><br>
|
||||
<a href="ctf/">ctf</a><br>
|
||||
<hr>
|
||||
py{{ '<a href="https://u.twoha.cc">full site</a>' if minimal else '<a href="https://mu.twoha.cc">minimal</a>' }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
<a href="/about">about</a><p>[ about ]</p>
|
||||
<a href="/contact">contact</a><p>[ contact ]</p>
|
||||
<a href="/uses">uses</a><p>[ uses ]</p>
|
||||
<a href="/ctf">ctf</a><p>[ ctf ]</p>
|
||||
<a href="/ctf/">ctf</a><p>[ ctf ]</p>
|
||||
<hr>
|
||||
</nav>
|
||||
<div class="panel" id="settings">
|
||||
|
|
|
|||
Loading…
Reference in a new issue