Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation reorg / edit suggestions + recommend use_pkgdown_github_pages() over use_pkgdown() #2562

Merged
merged 21 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion R/build-articles.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@
#' Additionally, htmlwidgets do not work when `as_is: true`.
#'
#' # Suppressing vignettes
#' If you want articles that are not vignettes, either put them in
#' If you want [articles](https://r-pkgs.org/vignettes.html#sec-vignettes-article)
#' that are not vignettes, use `usethis::use_article()` either put them in
#' subdirectories or list in `.Rbuildignore`. An articles link will be
#' automatically added to the default navbar if the vignettes directory is
#' present: if you do not want this, you will need to customise the navbar. See
Expand Down
1 change: 1 addition & 0 deletions R/build-home.R
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
#' ```
#' @inheritParams build_articles
#' @export
#' @order 1
build_home <- function(pkg = ".",
override = list(),
preview = NA,
Expand Down
2 changes: 1 addition & 1 deletion R/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' It specifies where the site will be published and is used to allow other
#' pkgdown sites to link to your site when needed (`vignette("linking")`),
#' generate a `sitemap.xml`, automatically generate a `CNAME` when
#' [deploying to github][deploy_site_github], generate the metadata needed
#' [deploying to github][build_site_github_pages()], generate the metadata needed
#' rich social "media cards" (`vignette("metadata")`), and more.
#'
#' * `title` overrides the default site title, which is the package name.
Expand Down
4 changes: 3 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Then learn about the many new ways to customise your site in `vignette("customis

## In the wild

At last count, pkgdown is used [by over 11,000 packages](https://github.com/search?q=path%3A_pkgdown.yml+language%3AYAML&type=code&l=YAML). Here are a few examples created by contributors to pkgdown:
At last count, pkgdown is used [by over 11,000 packages](https://github.com/search?q=path%3A_pkgdown.yml+language%3AYAML&type=code&l=YAML). Here are a few examples:
olivroy marked this conversation as resolved.
Show resolved Hide resolved

* [bayesplot](http://mc-stan.org/bayesplot/index.html)
([source](https://github.com/stan-dev/bayesplot/tree/gh-pages)):
Expand All @@ -88,6 +88,8 @@ At last count, pkgdown is used [by over 11,000 packages](https://github.com/sear
([source](https://github.com/renozao/NMF)):
a framework to perform non-negative matrix factorization (NMF).

* [tidyverse and r-lib packages source](https://github.com/search?q=path%3A%22_pkgdown.yml%22+AND+%28org%3Atidyverse+OR+org%3Ar-lib%29&type=code)

Comparing the source and output of these sites is a great way to learn new pkgdown techniques.

## Code of conduct
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Then learn about the many new ways to customise your site in

At last count, pkgdown is used [by over 11,000
olivroy marked this conversation as resolved.
Show resolved Hide resolved
packages](https://github.com/search?q=path%3A_pkgdown.yml+language%3AYAML&type=code&l=YAML).
Here are a few examples created by contributors to pkgdown:
Here are a few examples:

- [bayesplot](http://mc-stan.org/bayesplot/index.html)
([source](https://github.com/stan-dev/bayesplot/tree/gh-pages)):
Expand All @@ -103,6 +103,9 @@ Here are a few examples created by contributors to pkgdown:
([source](https://github.com/renozao/NMF)): a framework to perform
non-negative matrix factorization (NMF).

- [tidyverse and r-lib packages
source](https://github.com/search?q=path%3A%22_pkgdown.yml%22+AND+%28org%3Atidyverse+OR+org%3Ar-lib%29&type=code)

Comparing the source and output of these sites is a great way to learn
new pkgdown techniques.

Expand Down
3 changes: 2 additions & 1 deletion man/build_articles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions man/build_home.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/build_site.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ authors:
Maëlle Salmon:
href: https://masalmon.eu
Hadley Wickham:
href: http://hadley.nz
href: https://hadley.nz
Posit Software, PBC:
href: https://www.posit.co
href: https://posit.co
html: >-
<img src='https://www.tidyverse.org/posit-logo.svg' alt='Posit' width='62' height='16' style="margin-bottom: 3px;" />

Expand Down Expand Up @@ -52,21 +52,22 @@ articles:

reference:
- title: Build

- subtitle: Build the complete site
contents:
- build_site
- clean_site
- preview_site
- pkgdown_sitrep

- subtitle: Build part of a site
desc: These functions are useful for rapid iteration when you're working on a
specific part of your site.
contents:
- starts_with("build_")
- -build_site
- -build_site_github_pages
- -build_favicons
- init_site
olivroy marked this conversation as resolved.
Show resolved Hide resolved

- subtitle: Customisation
Expand All @@ -86,6 +87,7 @@ reference:
- as_pkgdown
- in_pkgdown
- render_page
- build_favicons

- title: Regression tests
contents:
Expand Down
12 changes: 6 additions & 6 deletions vignettes/pkgdown.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,12 @@ It just re-builds the index page, making it faster to quickly change `_pkgdown.y
## Articles

pkgdown will automatically build all vignettes found in `vignettes/`, translating them to HTML files in `articles/`.
Due to the way that pkgdown has to integrate RMarkdown generated HTML with its own HTML, relatively little control is available over the output format.
It is recommended to name your intro article with your package name to generate a Get Started page automatically.

Due to the way that pkgdown has to integrate R Markdown generated HTML with its own HTML, relatively little control is available over the output format.
You can see the details in `?build_articles`.

If you want to include an article on the website but not in the package (e.g., because it's large), you can either place it in a subdirectory of `vignettes/` (e.g. `vignettes/web_only`) or add it to `.Rbuildignore` (and make sure that there's no `vignettes:` section in the yaml header).
If you want to include an article on the website but not in the package (e.g., because it's large), you can either place it in a subdirectory of `vignettes/` (e.g. `vignettes/web_only`) or add it to `.Rbuildignore` (and make sure that there's no `vignettes:` section in the yaml header). See `usethis::use_article()` for an automated way to do this.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you want to include an article on the website but not in the package (e.g., because it's large), you can either place it in a subdirectory of `vignettes/` (e.g. `vignettes/web_only`) or add it to `.Rbuildignore` (and make sure that there's no `vignettes:` section in the yaml header). See `usethis::use_article()` for an automated way to do this.
If you want to include an article on the website but not in the package (e.g., because it's large), you can either place it in a subdirectory of `vignettes/` (e.g. `vignettes/articles`) or add it to `.Rbuildignore` (and make sure that there's no `vignettes:` section in the yaml header). See `usethis::use_article()` for an automated way to do this.

Do we really need to suggest two ways to do this?

In the extreme case where you want to produce only articles but not vignettes, you should add the complete `vignettes/` directory to `.Rbuildignore` and ensure that DESCRIPTION does not have a `VignetteBuilder` field.

## News
Expand Down Expand Up @@ -168,10 +170,8 @@ See `?build_news` for more customisation options including how to:

If you use GitHub, there are two ways to publish your site on GitHub Pages:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're now only recommending one way (which is good!), this sentence needs to be tweaked, and I think we can get rid of the bullets.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also made changes in README to reflect that everywhere!


- Build the site locally, check in the docs directory, then configure GitHub Pages to [use that directory](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site).

- Use GitHub actions to automatically build and publish the site every time you make a change.
The easiest way to set this up is to run `usethis::use_pkgdown_github_pages()`.
The easiest way to set this up is to run `usethis::use_pkgdown_github_pages()`, and if you need to customize the action, see [README.md r-lib/actions](https://github.com/r-lib/actions/tree/v2-branch/examples#build-pkgdown-site).

## Promoting

Expand All @@ -187,4 +187,4 @@ Once your finalized site is built and published on the web, you should publicize

(`usethis::use_pkgdown_github_pages()` does this for you.)

3. On Twitter (make sure to include `#rstats`).
3. On social media (make sure to include `#rstats`).
Loading