Using markdown and root directives

Can someone tell me why this Caddyfile (which works):

localhost:8082
root /Users/me/website/content
markdown / {
    template index ../templates/index.html
}

does not translate to this Caddyfile (which doesn’t work):

localhost:8082
root /Users/me/website/
markdown /content {
    template index ../templates/index.html
}

What do you mean by works and doesn’t work?

The main difference I see is that the first Caddyfile does not require a “/content” prefix in the path in order to serve markdown content. Their site roots are different.

I mean the top example shows a website, and the bottom example results in a 404 error. What do you mean that it doesn’t require a content prefix?

To put this question in a more specific form: /Users/me/website/content is where I store my .md files, but I would like the website root to be /Users/me/website. How do I form the markdown and template paths to work with a root path of /Users/me/website?

I mean the URL’s path doesn’t have to begin with /content.

Just put them all in /Users/me/website like you would any static website.

I think this is what you want. With a file called test.md in your content directory you will be able to access it as http://localhost:8082/test or http://localhost:8082/test.md

localhost:8082
root /Users/me/website
markdown /content {
	template index ../templates/index.html
}
rewrite {
	to {path} {path}/ /content{uri}
}
ext .md

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.