diff --git a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_split_html.pike b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_split_html.pike
index b62b2744d48beb12bde18430999becb4e19a6180..3882112f8f87983ac2ccfd7d8f38b016d6958e6e 100644
--- a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_split_html.pike
+++ b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_split_html.pike
@@ -639,6 +639,8 @@ class Node
       prev_url   = make_link(prev);
     }
 
+    string extra_headers = "";
+
     string res = replace(template,
       (["$navbar$": make_navbar(),
 	"$contents$": make_content(),
@@ -652,6 +654,7 @@ class Node
 	"$dotdot$": extra_prefix,
 	"$imagedir$":image_prefix(),
 	"$filename$": _Roxen.html_encode_string(make_filename()),
+	"$extra_headers$": extra_headers,
       ]));
 
     if (exporter) {
@@ -865,6 +868,13 @@ int low_main(string doc_file, string template_file, string outdir,
     template = replace(template,
 		       ({ "$dotdot$/images/" }),
 		       ({ "$imagedir$" }));
+
+    if (!has_value(template, "$extra_headers$")) {
+      template = replace(template,
+			 ({ "<head>" }),
+			 ({ "<head>\n"
+			    "$extra_headers$" }));
+    }
   }
 
   top->make_html(template, outdir, exporter);
diff --git a/refdoc/structure/modref.html b/refdoc/structure/modref.html
index bca5b1b3cc4454a8324e968a740e7181b078b16a..5c255952d8cf70879b479f6464f30fbc80ed4c89 100644
--- a/refdoc/structure/modref.html
+++ b/refdoc/structure/modref.html
@@ -2,6 +2,7 @@
   <head>
     <title>Pike Reference Manual - $title$</title>
     <link rel='stylesheet' href='$style$' />
+    $extra_headers$
   </head>
   <body link="#0768b2" alink="#002040" vlink="#0768b2">
     <header>
diff --git a/refdoc/structure/pelix_modref.html b/refdoc/structure/pelix_modref.html
index f0a70779de03477d1d72619d6910e5c35d0cd4d6..b94779ec34f2fe1b3be69334ab88cf2a9baf8b61 100644
--- a/refdoc/structure/pelix_modref.html
+++ b/refdoc/structure/pelix_modref.html
@@ -12,6 +12,8 @@ h2         { margin-bottom: 4px; }
 td         { font-family: arial, helvetica, sans-serif; font-size: 13px; }
 </style>
 
+  $extra_headers$
+
 </head>
 
 <body leftmargin="0" vlink="#0768b2" marginheight="0" bottommargin="0" bgcolor="white" marginwidth="0" text="#343434" link="#0768b2" topmargin="0" rightmargin="0" alink="#002040" >