Skip to content

Commit e112da8

Browse files
authored
Merge pull request #100 from JuliaComputing/sp/pagefind-symlinks
fix: resolve symlinks for pagefind index
2 parents 0d81c1e + e75cf2a commit e112da8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/search/pagefind.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,28 @@ function render()
2929
end
3030

3131
function build_search_index(root, docs, config, rootpath)
32-
# npx and npm are distributed as FileProducts,
32+
# npx and npm are distributed as FileProducts,
3333
# so the JLL does not bundle environment information into them.
3434
# To fix this, we wrap all uses of npx and npm inside `node() do ...`
3535
# which will automatically adjust the necessary environment variables.
36-
node() do
36+
node() do _
3737
if !success(Cmd(`$(npx) pagefind -V`; dir = root))
3838
@info "Installing pagefind into $root."
3939
if !success(Cmd(`$(npm) install pagefind`; dir = root))
4040
error("Could not install pagefind.")
4141
end
4242
end
43-
43+
4444
pattern = "*/{$(join(config.index_versions, ","))}/**/*.{html}"
45-
46-
run(`$(npx) pagefind --site $(root) --glob $(pattern) --root-selector article`)
45+
46+
out_path = joinpath(root, "pagefind")
47+
mktempdir() do dir
48+
# pagefind doesn't look at symlinks, so we resolve them here:
49+
cp(root, dir; follow_symlinks = true, force = true)
50+
run(`$(npx) pagefind --site $(dir) --output-path $(out_path) --glob $(pattern) --root-selector article`)
51+
end
4752
end
53+
4854
return nothing
4955
end
5056

0 commit comments

Comments
 (0)