aboutsummaryrefslogtreecommitdiff
path: root/src/app.ts
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-08-11 08:17:54 -0400
committerJoe Mou <dev@mou.fo>2026-08-11 08:19:32 -0400
commit54430d7b02cc78b4a5aa5a4f917f8da85a385efe (patch)
treebca2a7972e1217250a078a3645817faef249ca94 /src/app.ts
parentb43ce92c7b16bdefedb7c4c2aef41f9417f1ddf6 (diff)
Link repo header and add a "View original" link
The owner/name header in the layout now links to the owner page and the repository root. tryRender passes the request's path and query through as githubUrl — our URLs mirror GitHub's, so the same path is the page we scraped — and the footer links there with rel="noreferrer", matching the no-referrer policy used on redirects to github.com. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/app.ts')
-rw-r--r--src/app.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/app.ts b/src/app.ts
index e34c7b1..5bed45d 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -44,7 +44,10 @@ export function createApp(eta: Eta) {
return c.html(eta.render("error.eta", { message: "" + e }));
}
}
- return c.html(eta.render(template, data));
+ // Our URLs mirror GitHub's, so the page we scraped is the same path there.
+ const { pathname, search } = new URL(c.req.url);
+ const githubUrl = `https://github.com${pathname}${search}`;
+ return c.html(eta.render(template, { ...data, githubUrl }));
}
// For fragments fetched asynchronously by client-side JS (see public/static/refs.js):