Skip to content

Commit

Permalink
Allow .yml everywhere
Browse files Browse the repository at this point in the history
Fixes #2244
  • Loading branch information
hadley committed Apr 22, 2024
1 parent 910bb1d commit 0b64b5b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pkgdown (development version)

* Anywhere you can use `_pkgdown.yml`, you can now use `_pkgdown.yaml` (#2244).
* `build_article()` no longer generates the wrong source link when you build your site outside of the root directory (#2172).
* `build_reference()` matches usage for S3 and S4 methods to the style used by R 4.0.0 and later (#2187).
* `<source>` tags now have their `srcref` attributes tweaked in the same way that the `src` attributes of `<img>` tags are (#2402).
Expand Down
14 changes: 6 additions & 8 deletions R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,16 @@ check_bootstrap_version <- function(version, pkg) {
pkgdown_config_path <- function(path) {
path_first_existing(
path,
c("_pkgdown.yml",
"_pkgdown.yaml",
"pkgdown/_pkgdown.yml",
"inst/_pkgdown.yml"
c(
"_pkgdown.yml", "_pkgdown.yaml",
"pkgdown/_pkgdown.yml", "pkgdown/_pkgdown.yaml",
"inst/_pkgdown.yml", "inst/_pkgdown.yaml"
)
)
}
pkgdown_config_href <- function(path) {
cli::style_hyperlink(
text = "_pkgdown.yml",
url = paste0("file://", pkgdown_config_path(path))
)
config <- pkgdown_config_path(path) %||% "_pkgdown.yml"
cli::style_hyperlink(fs::path_file(config), paste0("file://", config))
}

read_meta <- function(path) {
Expand Down
2 changes: 1 addition & 1 deletion vignettes/customise.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ template:
code_font: {google: "JetBrains Mono"}
```

If you want to use a non-Google font, you'll need to do a bit more work. There are two steps: you need to first configure the font with CSS and then use it in your `_pkgdown.yaml`. There are two ways you might get the CSS:
If you want to use a non-Google font, you'll need to do a bit more work. There are two steps: you need to first configure the font with CSS and then use it in your `_pkgdown.yml`. There are two ways you might get the CSS:

* As a block of CSS which you should put in `pkgdown/extra.scss` or `pkgdown/extra.css`. The CSS will look something like this:

Expand Down
2 changes: 1 addition & 1 deletion vignettes/pkgdown.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ You'll learn about the main components of the site (the home page, reference, ar
You can override pkgdown's defaults with a YAML file called `_pkgdown.yml`[^1].
The most important field is `url`, which gives the final location of the site:

[^1]: You can also put it in `pkgdown/_pkgdown.yml` if you want to keep the package root clutter-free, or in `inst/_pkgdown.yml` if you want to make it available when your package is installed.
[^1]: You can also put it in `pkgdown/_pkgdown.yml` if you want to keep the package root clutter-free, or in `inst/_pkgdown.yml` if you want to make it available when your package is installed. You can also use `.yaml` as the extension if desired.

``` yaml
url: https://pkgdown.r-lib.org
Expand Down

0 comments on commit 0b64b5b

Please sign in to comment.