Can I Use CSS or something similar with Caddy File Web Server?

I configured caddy as an open directory with “file_server browse”, and while the auto generated web file browser is nice.
Is it possible to use CSS styling on it?
I found about http.markdown but i couldn’t not figure out how it works exactly, im kinda new to this.Thank you.

1 Like

Hi @George, welcome to the Caddy community!

There’s no way to slipstream CSS specifically into the existing browse template. That said, you can specify a different template to override the default entirely.

You can even take the entire original template and modify it slightly just to include the CSS you want. The current browse template can be found here: https://github.com/caddyserver/caddy/blob/master/modules/caddyhttp/fileserver/browsetpl.go

You’ll just want to rip the entire text out of the defaultBrowseTemplate variable and save it on its own as a .html.tmpl document of some kind, then refer to the file when configuring the file server module.

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.