From fe892622d33e45dd110abb8e6251b672ae1181d0 Mon Sep 17 00:00:00 2001 From: Florian Paul Azim Hoberg Date: Sat, 27 Jan 2024 18:35:21 +0100 Subject: [PATCH] feature(favicon): Add favicon support (#107) --- html.c | 9 ++++++++- utils.c | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/html.c b/html.c index 444a53d..4edf720 100644 --- a/html.c +++ b/html.c @@ -427,7 +427,9 @@ static xs_html *html_base_head(void) xs_html_attr("name", "generator"), xs_html_attr("content", USER_AGENT))); - /* add server CSS */ + /* add server CSS and favicon */ + xs *f; + f = xs_fmt("%s/favicon.ico", srv_baseurl); xs_list *p = xs_dict_get(srv_config, "cssurls"); char *v; while (xs_list_iter(&p, &v)) { @@ -436,6 +438,11 @@ static xs_html *html_base_head(void) xs_html_attr("rel", "stylesheet"), xs_html_attr("type", "text/css"), xs_html_attr("href", v))); + xs_html_add(head, + xs_html_sctag("link", + xs_html_attr("rel", "icon"), + xs_html_attr("type", "image/x-icon"), + xs_html_attr("href", f))); } return head; diff --git a/utils.c b/utils.c index 9992205..0d02659 100644 --- a/utils.c +++ b/utils.c @@ -81,6 +81,7 @@ static const char *greeting_html = "\n" "\n" "\n" + "\n" "Welcome to %host%\n" "\n" "%blurb%"