Template Layouts Plugin


(Jim Mendenhall) #1

I’d like to do something that I don’t think is possible with any existing Caddy features and may require a plugin. Just wondering if any of you have some ideas on this and how to get started.

I’d like to have a layout or template that you could assign to a specific path. It could be used for any path, even something pointing to static files, but mostly I’d like to use it on proxy paths. The idea would be to define a template that the result from the proxy app is returned into. I know it’s possible to return a templates from a proxied request, but I’d like to be able to return a simple chunk of html from an app and have it inserted into the pre-defined layout.

Something like this:

<html>
<head>
    ...
</head>
<body>
    ... some stuff

    {. some template actions}

    {.yeild} <!-- Output from proxied server goes here -->

    ... more stuff

</body>
</html>