Skip to content

Commit 23a4aaa

Browse files
Add redirect for old links
1 parent 296d33f commit 23a4aaa

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/make.jl

+19
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,22 @@ makedocs(modules=[DiffEqBase,DiffEqProblemLibrary,DiffEqBiological],
113113
deploydocs(
114114
repo = "github.com/JuliaDiffEq/DiffEqDocs.jl.git"
115115
)
116+
117+
#Redirect old links
118+
cd("build/") do
119+
for (root, dirs, files) in walkdir(".")
120+
for file in files
121+
path = relpath(joinpath(root, file), ".")
122+
m = match(r"(.+)/index\.html$", path)
123+
m === nothing && continue
124+
redirect = "$(m[1]).html"
125+
@info "Adding redirect for $(m[1]) from $(redirect)"
126+
isfile(redirect) && (@warn "$redirect exists, skip"; continue)
127+
open(redirect, "w") do io
128+
write(io, """
129+
<meta http-equiv="refresh" content="0; url=$(basename(m[1]))/index.html"/>
130+
""")
131+
end
132+
end
133+
end
134+
end

0 commit comments

Comments
 (0)