diff options
| author | Joe Mou <dev@mou.fo> | 2026-08-11 08:17:54 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-08-11 08:19:32 -0400 |
| commit | 9cef0850f8049a8f1cb11097852738de4cad4a30 (patch) | |
| tree | e2db0a0985fa66c0e53a341f931f98432fdf88a7 /cgithub/src | |
| parent | 0be1fdd2635fbc49d7451d3711b5772e1e9990e2 (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 'cgithub/src')
| -rw-r--r-- | cgithub/src/app.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cgithub/src/app.ts b/cgithub/src/app.ts index e34c7b1..5bed45d 100644 --- a/cgithub/src/app.ts +++ b/cgithub/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): |
