diff --git a/Docs/src/bin/halibut/bk_xhtml.c b/Docs/src/bin/halibut/bk_xhtml.c
index ecab010b..fe85269c 100644
--- a/Docs/src/bin/halibut/bk_xhtml.c
+++ b/Docs/src/bin/halibut/bk_xhtml.c
@@ -910,7 +910,7 @@ static void xhtml_do_index_body(FILE * fp)
if (sect)
{
char fragmentbuf[NAMEDFRAGMENT_MAXLEN];
- fprintf(fp, "", sect->file->filename,
+ fprintf(fp, "", conf.leaf_level ? sect->file->filename : "",
xhtml_get_fragmentname(sect, fragmentbuf));
if (sect->para->kwtext)
{
@@ -1227,7 +1227,7 @@ xhtml_do_contents_section_limit(FILE * fp, xhtmlsection * section, int limit)
static int
xhtml_add_contents_entry(FILE * fp, xhtmlsection * section, int limit)
{
- char fragmentbuf[NAMEDFRAGMENT_MAXLEN], *fragment;
+ char fragmentbuf[NAMEDFRAGMENT_MAXLEN], *fragment, *filename;
if (!section || section->level > limit)
return FALSE;
if (fp == NULL || section->level < 0)
@@ -1244,17 +1244,18 @@ xhtml_add_contents_entry(FILE * fp, xhtmlsection * section, int limit)
fprintf(fp, "\n");
if(chm_toc)fprintf(chm_toc, "\n");
}
+ filename = conf.leaf_level ? section->file->filename : "";
fragment = xhtml_get_fragmentname(section, fragmentbuf);
fprintf(fp, "- ");
fprintf(fp, "",
(section->para->type == para_Chapter|| section->para->type == para_Appendix) ? "class=\"btitle\" " : "",
- section->file->filename,
+ filename,
(section->para->type == para_Chapter) ? "" : fragment);
if(chm_toc)fprintf(chm_toc, "