fix(404): Simplify path retrieval logic

This commit is contained in:
conglinyizhi 2025-05-18 10:10:16 +08:00
parent 5a2abc1d11
commit b110b04273

View file

@ -1,15 +1,14 @@
--- ---
import Layout from '../layouts/Layout.astro'; import Layout from '../layouts/Layout.astro';
const url = new URL(Astro.url); const url = Astro.url.pathname
const notFoundPath = url.pathname
--- ---
<Layout title="404 | Terminal Blog" description="Page not found"> <Layout title="404 | Terminal Blog" description="Page not found">
<h1 class="title">command not found.</h1> <h1 class="title">command not found.</h1>
<div class="content"> <div class="content">
<p class="typewriter">sh: <span class="path">~{notFoundPath}</span>: command not found.</p> <p class="typewriter">sh: <span class="path">~{url}</span>: command not found.</p>
<div style="margin-top: 2rem;"> <div style="margin-top: 2rem;">
<span class="command">help</span> <span class="command">help</span>