Skip to content

Commit

Permalink
Include full article path in site metadata (#2498)
Browse files Browse the repository at this point in the history
This is a pragmatic fix so that autolinking for bslib should start working again.

Fixes #2350
  • Loading branch information
hadley authored Apr 25, 2024
1 parent 4a21528 commit 2dc1877
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/context.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ context_set_scoped <- function(name, value, scope = parent.frame()) {
article_index <- function(pkg) {
set_names(
fs::path_rel(pkg$vignettes$file_out, "articles"),
path_file(pkg$vignettes$name)
pkg$vignettes$name
)
}
12 changes: 12 additions & 0 deletions tests/testthat/test-init.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@ test_that("site meta doesn't break unexpectedly", {

expect_snapshot(yaml)
})

test_that("site meta includes vignette subdirectories", {
pkg <- local_pkgdown_site()

vig_path <- path(pkg$src_path, "vignettes")
dir_create(path(vig_path, "a"))
file_create(path(vig_path, "a", c("a.Rmd", "b.Rmd")))
pkg <- as_pkgdown(pkg$src_path)

meta <- site_meta(pkg)
expect_equal(meta$articles, list("a/a" = "a/a.html", "a/b" = "a/b.html"))
})

0 comments on commit 2dc1877

Please sign in to comment.