чување cc546b019a922c51036114659592cf576874ffbd
родитељ c300b020c664c0cf6034facdeae7e741c31a2c45
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Wed, 6 Jan 2021 22:59:54 +0100
Added favicon-url variable
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 4, додавања: 14(+), брисања: 3(-)
diff --git a/index.html b/index.html
@@ -3,7 +3,7 @@
<head>
<title>slweb - Simple static website generator. </title>
<meta charset="utf8" />
-<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
+<link rel="shortcut icon" type="image/x-icon" href="/slweb/favicon.ico" />
<meta name="description" content="Simple static website generator" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="slweb" />
@@ -128,7 +128,7 @@ this program. If not, see <<a href="https://www.gnu.org/licenses">https://www
<div id="git-log">
Previous commit:
-index.slw 4b288df 2021-01-06 22:44:41 +0100 (Страхиња Радић) (HEAD -> master)
+index.slw 5db4380 2021-01-06 22:59:54 +0100 (Страхиња Радић) (HEAD -> master)
</div><!--git-log-->
diff --git a/index.slw b/index.slw
@@ -2,6 +2,7 @@
site-name: slweb - Simple static website generator.
site-desc: Simple static website generator
stylesheet: index.css
+favicon-url: /slweb/favicon.ico
---
{main}
# slweb
diff --git a/slweb.1.in b/slweb.1.in
@@ -288,6 +288,14 @@ attribute. For example, instead of \fCblog/2020/august.html\fR, the resulting
permalink will have \fCblog/2020/august\fR.
.
.IP \[bu] 4
+.BR favicon-url .
+if present, this
+.SM URL
+will be used as a favicon
+.SM URL
+instead of the default, \fC/favicon.ico\fR.
+.
+.IP \[bu] 4
.BR permalink-url .
If present, this
.SM URL
diff --git a/slweb.c b/slweb.c
@@ -919,6 +919,7 @@ begin_html_and_head(FILE* output, KeyValue* vars, size_t vars_count)
{
uint8_t* site_name = get_value(vars, vars_count, (uint8_t*)"site-name", NULL);
uint8_t* site_desc = get_value(vars, vars_count, (uint8_t*)"site-desc", NULL);
+ uint8_t* favicon_url = get_value(vars, vars_count, (uint8_t*)"favicon-url", NULL);
fprintf(output, "<!DOCTYPE html>\n"
"<html lang=\"en\">\n"
@@ -932,7 +933,8 @@ begin_html_and_head(FILE* output, KeyValue* vars, size_t vars_count)
sprintf(favicon, "%s/favicon.ico", basedir);
if (!access(favicon, R_OK))
fprintf(output, "<link rel=\"shortcut icon\" type=\"image/x-icon\""
- " href=\"/favicon.ico\" />\n");
+ " href=\"%s\" />\n",
+ favicon_url ? (char*)favicon_url : "/favicon.ico");
free(favicon);
if (site_desc && *site_desc)