Skip to content

Error pages not beneffiting from markdown directive #1265

@Sirtea

Description

@Sirtea

1. What version of Caddy are you running (caddy -version)?

Caddy (untracked dev build)
(0.9.3-r0 from alpine linux)

2. What are you trying to do?

I have declared a 404 error page, but I cannot make it markdownify even that the path is for markdown files

3. What is your entire Caddyfile?

8080
root /srv/www
log stdout
errors {
    404 404.html
}
status 404 /templates
markdown / {
    ext .html
    template blog templates/blog.html
    template page templates/page.html
}

4. How did you run Caddy (give the full command and describe the execution environment)?

caddy
(no arguments)

5. What did you expect to see?

I want the page /404.html to be rendered as markdown

6. What did you see instead (give full error messages and/or log)?

Plain text, including the front matter

7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?

Reproduce a simple folder with a index (optional), caddyfile and a template for the page.

gerard@aldebaran:~/docker/caddy/www$ tree
.
├── templates
│   ├── blog.html
│   └── page.html
├── 404.html
├── Caddyfile
└── index.html

1 directory, 5 files
gerard@aldebaran:~/docker/caddy/www$ 

Place a "page" template and a 404 as follows

gerard@aldebaran:~/docker/caddy/www$ cat 404.html
---
title: Error 404
template: page
---

Error 404: BOOOM!
gerard@aldebaran:~/docker/caddy/www$ cat templates/page.html 
<!DOCTYPE html>
<html>
	<head>
		<title>{{.Doc.title}}</title>
	</head>
	<body>
		{{.Doc.body}}
	</body>
</html>
gerard@aldebaran:~/docker/caddy/www$ 

visit http://localhost:8080/nonexistentpage and view the plain text in 404.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions