38
38
brand_image,
39
39
custom_stylesheets = [],
40
40
custom_scripts = [],
41
- search_engine = SearchConfig()
41
+ search_engine = SearchConfig(),
42
+ prettyurls = true
42
43
)
43
44
44
45
Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`.
@@ -49,6 +50,7 @@ Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`
49
50
- `custom_stylesheets` is a `Vector{String}` of stylesheets injected into each page.
50
51
- `custom_scripts` is a `Vector{String}` of scripts injected into each page.
51
52
- `search_engine` inserts a global search bar. See [`SearchConfig`](@ref) for more details.
53
+ - `prettyurls` removes all `index.html` suffixes from links in the global navigation.
52
54
"""
53
55
function make (
54
56
outdir,
@@ -58,9 +60,10 @@ function make(
58
60
custom_stylesheets = [],
59
61
custom_scripts = [],
60
62
search_engine = SearchConfig (index_versions = [" stable" ], engine = FlexSearch),
63
+ prettyurls = true
61
64
)
62
65
63
- dir = make_output_structure (docs)
66
+ dir = make_output_structure (docs, prettyurls )
64
67
out_assets = joinpath (dir, " assets" )
65
68
if assets_dir != = nothing && isdir (assets_dir)
66
69
cp (assets_dir, out_assets)
@@ -75,6 +78,7 @@ function make(
75
78
custom_stylesheets,
76
79
custom_scripts,
77
80
search_engine,
81
+ prettyurls
78
82
)
79
83
80
84
if search_engine != false
@@ -87,7 +91,7 @@ function make(
87
91
return outdir
88
92
end
89
93
90
- function make_output_structure (docs:: Vector )
94
+ function make_output_structure (docs:: Vector , prettyurls )
91
95
dir = mktempdir ()
92
96
93
97
for doc in docs
@@ -105,15 +109,15 @@ function make_output_structure(docs::Vector)
105
109
io,
106
110
"""
107
111
<!--This file is automatically generated by MultiDocumenter.jl-->
108
- <meta http-equiv="refresh" content="0; url=./$(first (docs). path) / index.html"/>
112
+ <meta http-equiv="refresh" content="0; url=./$(string ( first (docs). path), prettyurls ? " / " : " / index.html" ) "/>
109
113
""" ,
110
114
)
111
115
end
112
116
113
117
return dir
114
118
end
115
119
116
- function make_global_nav (dir, docs, thispagepath, brand_image, search_engine)
120
+ function make_global_nav (dir, docs, thispagepath, brand_image, search_engine, prettyurls )
117
121
nav = Gumbo. HTMLElement {:nav} ([], Gumbo. NullNode (), Dict (" id" => " multi-page-nav" ))
118
122
119
123
if brand_image != = nothing
@@ -147,7 +151,7 @@ function make_global_nav(dir, docs, thispagepath, brand_image, search_engine)
147
151
[],
148
152
navitems,
149
153
Dict (
150
- " href" => string (rp, " /" , " index.html" ),
154
+ " href" => string (rp, prettyurls ? " /" : " / index.html" ),
151
155
" class" =>
152
156
startswith (thispagepath, joinpath (dir, doc. path)) ?
153
157
" nav-link active nav-item" : " nav-link nav-item" ,
@@ -215,6 +219,7 @@ function inject_styles_and_global_navigation(
215
219
custom_stylesheets,
216
220
custom_scripts,
217
221
search_engine,
222
+ prettyurls
218
223
)
219
224
220
225
if search_engine != false
@@ -268,7 +273,7 @@ function inject_styles_and_global_navigation(
268
273
# inject global navigation as first element in body
269
274
270
275
global_nav =
271
- make_global_nav (dir, docs, root, brand_image, search_engine)
276
+ make_global_nav (dir, docs, root, brand_image, search_engine, prettyurls )
272
277
global_nav. parent = el
273
278
pushfirst! (el. children, global_nav)
274
279
injected += 1
0 commit comments