Skip to content

Commit

Permalink
More debugging in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
dreeves committed Aug 17, 2023
1 parent 42d87f1 commit 1af2381
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/404.astro
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const posts = await getPosts().then((posts: Post[]) => posts.map(p => ({
let cpost = '';
let edist = Infinity; // minimum edit distance across all slugs in the archive
for (const p of posts) {
const dist = 0 // levenshtein(sadslug, p.slug);
const dist = levenshtein(sadslug, p.slug);
if (dist <= edist) { edist = dist; cpost = p } // break ties by recency
}
---
Expand All @@ -57,9 +57,9 @@ https://www.beeminder.com/assets/sadbee-e89491e7c1ea7c8568c8cdf0d19ff41acc079cc1
</Shadowbox>
</Layout>

<script define:vars={{posts, cpost, edist}}>
<script define:vars={{sadslug, posts, cpost, edist}}>

const sadslug = location.pathname.slice(1); // the thing that's 404ing
// const sadslug = location.pathname.slice(1); // the thing that's 404ing
const links = posts.filter(p => p.slug.startsWith(sadslug));
const ul = document.querySelector("#nearmisses");

Expand Down

0 comments on commit 1af2381

Please sign in to comment.