From 9cef0850f8049a8f1cb11097852738de4cad4a30 Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Tue, 11 Aug 2026 08:17:54 -0400 Subject: Link repo header and add a "View original" link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cgithub/src/app.ts | 5 ++++- cgithub/views/layout.eta | 4 ++-- 2 files changed, 6 insertions(+), 3 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): diff --git a/cgithub/views/layout.eta b/cgithub/views/layout.eta index a80bd1d..f803caf 100644 --- a/cgithub/views/layout.eta +++ b/cgithub/views/layout.eta @@ -9,7 +9,7 @@
-
<%= it.repo.owner %>/<%= it.repo.name %>
+
git clone https://github.com/<%= it.repo.owner %>/<%= it.repo.name %>.git
 git clone git@github.com:<%= it.repo.owner %>/<%= it.repo.name %>.git