From ba300906321a4fa8d01dc1f335c0d6d5c7cae602 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 28 Dec 2020 21:05:09 +0100 Subject: fix(templates/simple): fix link back if script_name is empty --- templates/simple.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/templates/simple.c b/templates/simple.c index 1b3c293..5ec9eeb 100644 --- a/templates/simple.c +++ b/templates/simple.c @@ -58,8 +58,15 @@ void template_header(struct template_data data) { xml_open_tag(&ctx, "body"); xml_open_tag(&ctx, "header"); xml_open_tag(&ctx, "h1"); - if(data.page_type != PAGE_TYPE_INDEX && data.script_name != NULL) { - xml_open_tag_attrs(&ctx, "a", 1, "href", data.script_name); + if(data.page_type != PAGE_TYPE_INDEX) { + char *index; + if(data.script_name == NULL || data.script_name[0] == '\0') { + index = "/"; + } else { + index = data.script_name; + } + + xml_open_tag_attrs(&ctx, "a", 1, "href", index); } xml_escaped(&ctx, BLOG_TITLE); xml_close_including(&ctx, "header"); -- cgit 1.4.1