diff --git a/docs/mdbook/book.toml b/docs/mdbook/book.toml index 386386ac..56899e18 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 c856d5fd..3798ea5d 100644 --- a/docs/mdbook/default.nix +++ b/docs/mdbook/default.nix @@ -321,6 +321,10 @@ pkgs.stdenv.mkDerivation (finalAttrs: { cp "$file" "$path" done + # Patch book.toml + substituteInPlace ./book.toml \ + --replace-fail "@SITE_URL@" "$siteURL" + # Patch SUMMARY.md - which defiens mdBook's table of contents substituteInPlace ./SUMMARY.md \ --replace-fail "@PLATFORM_OPTIONS@" "$wrapperOptionsSummary" \ @@ -332,6 +336,10 @@ pkgs.stdenv.mkDerivation (finalAttrs: { cp -r ${search}/* $dest/search ''; + # The root directory of the site + # Can be overridden, e.g. by CI + siteURL = "/nixvim/"; + inherit (mdbook) nixvimOptionsSummary wrapperOptionsSummary