diff --git a/src/MultiDocumenter.jl b/src/MultiDocumenter.jl
index 080c1b3b..42a144e9 100644
--- a/src/MultiDocumenter.jl
+++ b/src/MultiDocumenter.jl
@@ -38,7 +38,8 @@ end
brand_image,
custom_stylesheets = [],
custom_scripts = [],
- search_engine = SearchConfig()
+ search_engine = SearchConfig(),
+ prettyurls = true
)
Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`.
@@ -49,6 +50,7 @@ Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`
- `custom_stylesheets` is a `Vector{String}` of stylesheets injected into each page.
- `custom_scripts` is a `Vector{String}` of scripts injected into each page.
- `search_engine` inserts a global search bar. See [`SearchConfig`](@ref) for more details.
+- `prettyurls` removes all `index.html` suffixes from links in the global navigation.
"""
function make(
outdir,
@@ -58,9 +60,10 @@ function make(
custom_stylesheets = [],
custom_scripts = [],
search_engine = SearchConfig(index_versions = ["stable"], engine = FlexSearch),
+ prettyurls = true
)
- dir = make_output_structure(docs)
+ dir = make_output_structure(docs, prettyurls)
out_assets = joinpath(dir, "assets")
if assets_dir !== nothing && isdir(assets_dir)
cp(assets_dir, out_assets)
@@ -75,6 +78,7 @@ function make(
custom_stylesheets,
custom_scripts,
search_engine,
+ prettyurls
)
if search_engine != false
@@ -87,7 +91,7 @@ function make(
return outdir
end
-function make_output_structure(docs::Vector)
+function make_output_structure(docs::Vector, prettyurls)
dir = mktempdir()
for doc in docs
@@ -105,7 +109,7 @@ function make_output_structure(docs::Vector)
io,
"""
-
+
""",
)
end
@@ -113,7 +117,7 @@ function make_output_structure(docs::Vector)
return dir
end
-function make_global_nav(dir, docs, thispagepath, brand_image, search_engine)
+function make_global_nav(dir, docs, thispagepath, brand_image, search_engine, prettyurls)
nav = Gumbo.HTMLElement{:nav}([], Gumbo.NullNode(), Dict("id" => "multi-page-nav"))
if brand_image !== nothing
@@ -147,7 +151,7 @@ function make_global_nav(dir, docs, thispagepath, brand_image, search_engine)
[],
navitems,
Dict(
- "href" => string(rp, "/", "index.html"),
+ "href" => string(rp, prettyurls ? "/" : "/index.html"),
"class" =>
startswith(thispagepath, joinpath(dir, doc.path)) ?
"nav-link active nav-item" : "nav-link nav-item",
@@ -215,6 +219,7 @@ function inject_styles_and_global_navigation(
custom_stylesheets,
custom_scripts,
search_engine,
+ prettyurls
)
if search_engine != false
@@ -268,7 +273,7 @@ function inject_styles_and_global_navigation(
# inject global navigation as first element in body
global_nav =
- make_global_nav(dir, docs, root, brand_image, search_engine)
+ make_global_nav(dir, docs, root, brand_image, search_engine, prettyurls)
global_nav.parent = el
pushfirst!(el.children, global_nav)
injected += 1