docs: specify site-url

Fixes 404 page's relative links and styling being relative to `/`.
This commit is contained in:
Matt Sturgeon 2024-11-11 17:49:40 +00:00
parent 4ea34656c2
commit a92339d83b
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 11 additions and 0 deletions

View file

@ -5,6 +5,9 @@ multilingual = false
src = "."
title = "nixvim docs"
[output.html]
site-url = "@SITE_URL@"
[output.html.fold]
enable = true
level = 0

View file

@ -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