Skip to content

Commit

Permalink
Set default URL (#44)
Browse files Browse the repository at this point in the history
For pkgdown sites without `url` set.
  • Loading branch information
krlmlr committed Sep 24, 2020
1 parent b6572c9 commit 8b714e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
@@ -1,5 +1,8 @@
# downlit (development version)

* Autolinking guesses reference and article urls for pkgdown sites that haven't
set url (@krlmlr, #44).

* R6 classes are autolinked when a new object is created i.e. in
`r6_object$new()`, `r6_object` will link to the docs of `r6_object` if found
(#59, @maelle)
Expand Down
7 changes: 7 additions & 0 deletions R/metadata.R
Expand Up @@ -44,6 +44,13 @@ remote_metadata_slow <- function(package) {
if (has_name(yaml, "articles")) {
yaml$articles <- unlist(yaml$articles)
}
if (!has_name(yaml, "urls")) {
base_url <- dirname(url)
yaml$urls <- list(
reference = paste0(base_url, "/reference"),
article = paste0(base_url, "/articles")
)
}
return(yaml)
}
}
Expand Down

0 comments on commit 8b714e6

Please sign in to comment.