@@ -63,7 +63,8 @@ function walk_outputs(f, root, docs::Vector{MultiDocRef}, dirs::Vector{String})
6363 for file in files
6464 file == " index.html" || continue
6565
66- f (chop (r, head = length (root), tail = 0 ), joinpath (r, file))
66+ # +1 for path separator
67+ f (chop (r, head = length (root) + 1 , tail = 0 ), joinpath (r, file))
6768 end
6869 end
6970 break
@@ -86,7 +87,8 @@ const DEFAULT_ENGINE = SearchConfig(index_versions = ["stable", "dev"], engine =
8687 custom_stylesheets = [],
8788 custom_scripts = [],
8889 search_engine = SearchConfig(),
89- prettyurls = true
90+ prettyurls = true,
91+ rootpath = "/"
9092 )
9193
9294Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`.
@@ -99,6 +101,7 @@ Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`
99101 `Docs.HTML` objects are inserted as the content of inline scripts.
100102- `search_engine` inserts a global search bar if not `false`. See [`SearchConfig`](@ref) for more details.
101103- `prettyurls` removes all `index.html` suffixes from links in the global navigation.
104+ -`rootpath` is the path your site ends up being deployed at, e.g. `/foo/` if it's hosted at `https://bar.com/foo`
102105"""
103106function make (
104107 outdir,
@@ -109,6 +112,7 @@ function make(
109112 custom_scripts = [],
110113 search_engine = DEFAULT_ENGINE,
111114 prettyurls = true ,
115+ rootpath = " /" ,
112116)
113117 maybe_clone (flatten_multidocrefs (docs))
114118
@@ -135,10 +139,11 @@ function make(
135139 custom_scripts,
136140 search_engine,
137141 prettyurls,
142+ rootpath,
138143 )
139144
140145 if search_engine != false
141- search_engine. engine. build_search_index (dir, flatten_multidocrefs (docs), search_engine)
146+ search_engine. engine. build_search_index (dir, flatten_multidocrefs (docs), search_engine, rootpath )
142147 end
143148
144149 cp (dir, outdir; force = true )
@@ -300,10 +305,11 @@ function inject_styles_and_global_navigation(
300305 custom_scripts,
301306 search_engine,
302307 prettyurls,
308+ rootpath,
303309)
304310
305311 if search_engine != false
306- search_engine. engine. inject_script! (custom_scripts)
312+ search_engine. engine. inject_script! (custom_scripts, rootpath )
307313 search_engine. engine. inject_styles! (custom_stylesheets)
308314 end
309315 pushfirst! (custom_stylesheets, joinpath (" assets" , " default" , " multidoc.css" ))
0 commit comments