{{- $path := .OriginalReq.URL.Path}} {{- if hasSuffix "/" $path}}{{$path = print $path "index"}}{{end}} {{- $path = print $path ".md"}} {{- if not (fileExists $path)}}{{httpError 404}}{{end}} {{- $markdown := (include $path | splitFrontMatter)}} {{- $title := default (trimSuffix ".md" (base $path)) $markdown.Meta.title}}