I would like to serve a favicon when my markdown page is accessed. Any recommendations? Or should this be a feature request??
I did this by adding to the javascript file that I had already specified in the js argument in the markdown directive:
window.onload = function() {
var link = top.document.createElement("link");
link.type = "image/x-icon";
link.rel = "shortcut icon";
link.href = "/wiki.ico";
top.document.getElementsByTagName("head")[0].appendChild(link);
}
Until there is a favicon directive for markdown, I guess this might be the easiest way.
Don’t browsers request /favicon.ico
if you don’t offer an icon link tag? Try rewriting that to /wiki.ico
and see if your browser picks it up.
Haha, brilliant! Just put a favicon.ico in the directory and it works without any other setting necessary! I guess I thought caddy would be really secure and not serve files with other extensions.
Anyway, I removed my javascript and renamed wiki.ico to favicon.ico!
What do you mean by this?
(Browsers will request favicon.ico regardless.)
Caddy will serve any files you put in the webroot, by virtue of being a web server, which is pretty much expected (and ubiquitous) behaviour. How else would someone get your favicon anyway? Don’t put stuff in your webroot if you don’t want it served
Muddled thinking… Of course a web server will try to serve files requested.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.