I think you could use the Caddy website’s source as inspiration:
Take a look at the Caddyfile, you’ll notice that it has a rewrite to map everything in certain sections of the site (everything in a subpath) to specific index files.
Then you can take a look at the src/docs/index.html to see how front matter is parsed and how markdown content is included into the page.
In v1, we determined that the markdown directive wasn’t very useful. The idea from that was that it served static Markdown files by rendering them as HTML. But Markdown without styling wasn’t very useful, either, so we added css and js and eventually template subdirectives so you could make static Markdown files presentable.
… but that’s the same thing as the templates directive.
So we got rid of the markdown directive.
Now in v2, you’d use the templates directive like we do for the Caddy site here:
That directive renders response bodies (for example, static files loaded by file_server) as templates. Our Caddyfile rewrites all requests in /docs/* to go to an HTML file that is rendered as a template. It starts with these lines:
Those lines load the actual requested markdown file and parse out its front matter from its body.
Then we can just render it as markdown in the proper place in the HTML:
So basically, the static files are the template(s).
This is just an example but that’s how you use it.
Thanks for the detailed explanation. I followed the logic in the example site, but clarifying that indeed that feature has been removed was what I needed.
I was specifically drawn by the markdown directive and not sure I want to do all of the conditional logic in a single html file if I want to use more than one layout in a single directory.
Otherwise, I love the idea of skipping the build step.