diff options
-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"); |