-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path_build_site.R
More file actions
28 lines (24 loc) · 757 Bytes
/
_build_site.R
File metadata and controls
28 lines (24 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Build pkgdown site with exclusions
# pkgdown doesn't support excluding .md files from home page processing,
# so we temporarily hide them during the build.
exclude_from_home <- c("TODO.md", "AGENTS.md", "CLAUDE.md", "GEMINI.md", "sonograph_log.md")
# Temporarily rename files so pkgdown won't find them
hidden <- character(0)
for (f in exclude_from_home) {
if (file.exists(f)) {
hidden_name <- paste0(".", f, ".pkgdown-hide")
file.rename(f, hidden_name)
hidden <- c(hidden, setNames(hidden_name, f))
}
}
# Restore function
restore_files <- function() {
for (i in seq_along(hidden)) {
file.rename(hidden[[i]], names(hidden)[[i]])
}
}
# Build, then always restore
tryCatch(
pkgdown::build_site(),
finally = restore_files()
)