diff options
author | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2020-12-28 21:05:09 +0100 |
---|---|---|
committer | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2020-12-28 21:05:09 +0100 |
commit | ba300906321a4fa8d01dc1f335c0d6d5c7cae602 (patch) | |
tree | 7f52c8145f1a757ef524ea0917caadd48ba55fcd | |
parent | b7b9f617b55e0098e9014ffbbde0de0ff8cb324a (diff) |
fix(templates/simple): fix link back if script_name is empty
-rw-r--r-- | templates/simple.c | 11 |
1 files 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"); |