diff --git a/src/plugins/server/doc.ml b/src/plugins/server/doc.ml
index e99ce3bd631df7c422577cd3e7d429e068582ac8..791434e1fe70fc78d0f644266b999ab933c59180 100644
--- a/src/plugins/server/doc.ml
+++ b/src/plugins/server/doc.ml
@@ -164,7 +164,7 @@ let metadata page : json =
 let pp_one_page ~root ~page ~title body =
   let full_path = Filepath.normalize (root ^ "/" ^ page) in
   let dir = Filename.dirname full_path in
-  Extlib.mkdir ~parents:true dir 0o755;
+  if not (Sys.file_exists dir) then Extlib.mkdir ~parents:true dir 0o755;
   try
     let chan = open_out full_path in
     let fmt = Format.formatter_of_out_channel chan in