Read gist bodies without evaluating them as templates
Adding how-gists-kejadlen-dev-works.md, which quotes this file's own
source, recursed until it exhausted lotus-land-story's memory. readFile
also keeps a .md from reaching template functions like env.
Assisted-by: Claude Opus 5 via Claude Code
diff --git a/_render.html b/_render.html
index 4dee485..8c3b62f 100644
--- a/_render.html
+++ b/_render.html
@@ -1,7 +1,9 @@
{{$path := .OriginalReq.URL.Path -}}
{{$file := printf "%s.md" (trimSuffix "/" $path) -}}
{{if not (fileExists $file)}}{{httpError 404}}{{end -}}
-{{$doc := include $file | splitFrontMatter -}}
+{{/* readFile, not include: include evaluates the .md as a template, so a
+ document quoting this file's own source recurses until caddy OOMs. */ -}}
+{{$doc := readFile $file | splitFrontMatter -}}
<!doctype html>
<html lang="en">
<head>
diff --git a/how-gists-kejadlen-dev-works.md b/how-gists-kejadlen-dev-works.md
index e0bc9eb..00ee0f6 100644
--- a/how-gists-kejadlen-dev-works.md
+++ b/how-gists-kejadlen-dev-works.md
@@ -30,7 +30,9 @@ And the abridged `_render.html` in the `gists` repo:
{{$path := .OriginalReq.URL.Path -}}
{{$file := printf "%s.md" (trimSuffix "/" $path) -}}
{{if not (fileExists $file)}}{{httpError 404}}{{end -}}
-{{$doc := include $file | splitFrontMatter -}}
+{{/* readFile, not include: include evaluates the .md as a template, so a
+ document quoting this file's own source recurses until caddy OOMs. */ -}}
+{{$doc := readFile $file | splitFrontMatter -}}
<!doctype html>
<html lang="en">
<head>