mirror of
https://github.com/caddyserver/website.git
synced 2025-04-22 04:56:17 -04:00
docs: Return 404 for bad paths
Requires Caddy compiled with Go 1.17 or newer.
This commit is contained in:
parent
578394fc5f
commit
28eac39c29
1 changed files with 1 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
{{$pathParts := splitList "/" .OriginalReq.URL.Path}}
|
||||
{{$markdownFilename := default "index" (slice $pathParts 2 | join "/")}}
|
||||
{{$markdownFilePath := printf "/docs/markdown/%s.md" $markdownFilename}}
|
||||
{{if not (fileExists $markdownFilePath)}}{{httpError 404}}{{end}}
|
||||
{{$markdownFile := (include $markdownFilePath | splitFrontMatter)}}
|
||||
{{$title := default $markdownFilename $markdownFile.Meta.title}}
|
||||
<!DOCTYPE html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue