diff --git a/docs/mdbook/book.toml b/docs/mdbook/book.toml index 59e8c630..4024b309 100644 --- a/docs/mdbook/book.toml +++ b/docs/mdbook/book.toml @@ -5,6 +5,9 @@ multilingual = false src = "." title = "nixvim docs" +[output.html] +site-url = "@SITE_URL@" + [output.html.fold] enable = true level = 0 diff --git a/docs/mdbook/default.nix b/docs/mdbook/default.nix index 1e8d8821..28d70b91 100644 --- a/docs/mdbook/default.nix +++ b/docs/mdbook/default.nix @@ -6,6 +6,8 @@ nixosOptionsDoc, transformOptions, hmOptions, + # The root directory of the site + baseHref ? "/", }: with lib; let @@ -238,6 +240,10 @@ let # Using pkgs.writeShellScript helps to avoid the "bash: argument list too long" error bash -e ${pkgs.writeShellScript "copy_docs" docs.commands} + # Patch book.toml + substituteInPlace ./book.toml \ + --replace-fail "@SITE_URL@" "${baseHref}" + # Prepare SUMMARY.md for mdBook # Using pkgs.writeText helps to avoid the same error as above substituteInPlace ./SUMMARY.md \