The Default HTML template is using the output file name as the default index file for the HTML documentation generation. A few modifications to the template can alter this behavior and force HelpNDoc to generate an index.html file as the default index file.

Prior to doing any change to the default template, always make a copy in the personal template folder and work on that copy.

Modify the index.pas.html file

This is the index file which we'd like to export to "index.html". By default, HelpNDoc would have exported it as it uses the file name without the ".pas" part but we specifically instruct HelpNDoc to use another file name with the following line:

HndGeneratorInfo.CurrentFile := ExtractFileName(HndGeneratorInfo.OutputFile);

To alter this behavior, just comment or remove the line from the template. Now HelpNDoc will generate an index.html file automatically.

Fix the topics redirections in topics.pas.html

When a topic is called directly by its URL, it has a built-in mechanism to redirect to the index file so that the table of contents is shown. As we have renamed the index file, we need to change the behavior of the topics.pas.html file and change the following line:

top.location.href = "<% print(ExtractFileName(HndGeneratorInfo.OutputFile)); %>?" + sTopicId


top.location.href = "index.html?" + sTopicId

That's all. Now HelpNDoc will generate an HTML documentation which will automatically use the index.html file as the default index file.