diff --git a/tools/doc/allhtml.mjs b/tools/doc/allhtml.mjs
index f69d4bbf3ae468..dd95d264139c47 100644
--- a/tools/doc/allhtml.mjs
+++ b/tools/doc/allhtml.mjs
@@ -32,7 +32,7 @@ for (const link of toc.match(//g)) {
const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ id="apicontent">/.exec(data);
// Get module name
- const moduleName = href.split('.')[0];
+ const moduleName = href.replace(/\.html$/, '');
contents += data.slice(0, match.index)
.replace(/[\s\S]*?id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*(