summaryrefslogtreecommitdiff
path: root/cgithub/src
diff options
context:
space:
mode:
Diffstat (limited to 'cgithub/src')
-rw-r--r--cgithub/src/app.ts2
-rw-r--r--cgithub/src/worker.ts5
2 files changed, 5 insertions, 2 deletions
diff --git a/cgithub/src/app.ts b/cgithub/src/app.ts
index 2fa5832..a040aaa 100644
--- a/cgithub/src/app.ts
+++ b/cgithub/src/app.ts
@@ -39,7 +39,7 @@ export function createApp(eta: Eta) {
const app = new Hono();
app.use(async (c, next) => {
- // Include render data for layout.eta.
+ // Include render data for views/layouts/base.eta.
c.setRenderer((template, data) =>
c.html(eta.render(template, { ...data, githubUrl: githubUrlFor(c), buildCommit })),
);
diff --git a/cgithub/src/worker.ts b/cgithub/src/worker.ts
index 7bf9100..e59c690 100644
--- a/cgithub/src/worker.ts
+++ b/cgithub/src/worker.ts
@@ -9,8 +9,11 @@ import { views } from "./views.generated.ts";
// cache: true, Eta serves them from the cache and never compiles.
const eta = new Eta({ cache: true });
+// Templates name each other as siblings ("./_tree") or from the views root
+// ("/layouts/base.eta"); either way the name is the path under views/ that
+// scripts/build.ts keyed the template by.
eta.resolvePath = (templatePath: string) => {
- let name = templatePath.replace(/^\.\//, "");
+ let name = templatePath.replace(/^\.?\//, "");
if (!name.endsWith(".eta")) name += ".eta";
return name;
};