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

docs: Convert website to use {pkgdown} #902

Merged
merged 16 commits into from
Feb 19, 2024
Merged

Conversation

olivroy
Copy link
Contributor

@olivroy olivroy commented Feb 16, 2024

Now hosted at https://rstudio.github.io/leaflet

I think some of the information is a bit dated, but will not pursue further if there is no interest.

For deployment, you need to setup gh pages with usethis::use_pkgdown_github_pages().

Everything renders! Polishing probably necessary in a potential follow-up

But having the function reference online, search function seems like an improvement to me?
Capture d’écran, le 2024-02-16 à 9 24 39 a m

Outstanding work if you decide to proceed:

On my side:

  • Correct links
  • Replace deprecated things
  • Are there useful things in docs/ that is worth saving somewhere else?
  • Polishing

On your side:

  • Adjust css / look (on you)
  • usethis::use_pkgdown_github_pages()
  • Verify if there is an alternative to "hrbrmstr/albersusa" (archived and uses archived packages)

_pkgdown.yml Outdated Show resolved Hide resolved
DESCRIPTION Outdated Show resolved Hide resolved
NEWS.md Outdated Show resolved Hide resolved
inst/examples/highlight-polygons.R Show resolved Hide resolved
vignettes/articles/basemaps.Rmd Show resolved Hide resolved
vignettes/articles/json.Rmd Show resolved Hide resolved
@schloerke
Copy link
Contributor

Thank you @olivroy !!

Could extra requests:

  • Please uncomment
    ## Website is not pkgdown; Run `source("tools/docs_update.R")` on release!
    # website:
    # uses: rstudio/shiny-workflows/.github/workflows/website.yaml@v1
    ; When the PR is merged, I'll redirect the website location.

Co-authored-by: Barret Schloerke <[email protected]>
@olivroy
Copy link
Contributor Author

olivroy commented Feb 16, 2024

@schloerke Would you want me to delete the old docs directory, or leaving it as docs_old/ is okay for now?

docs_old/scratch.Rmd Outdated Show resolved Hide resolved
@schloerke
Copy link
Contributor

@schloerke Would you want me to delete the old docs directory, or leaving it as docs_old/ is okay for now?

The geojson files in docs_old/json need to be available to the files. Maybe we put the data files in the pkgdown/assets folder and add the assets folder in the pkgdown config? (And also move the _pkgdown.yml file to pkgdown/_pkgdown.yml, similar to https://github.com/rstudio/plumber/blob/56a69494cf15c3c3ca0831a86a91ba033337206a/pkgdown/_pkgdown.yml#L9 )

By having the files as assets, they are available on the website and users can see the full url. In the past, we've had comments that the files do not exist on user's local machines when copying the example to run. So I'd like to keep the URL behavior if possible.

I do not see any other files that I would keep in docs_old/. Let's remove it? Thank you!

.Rbuildignore Outdated Show resolved Hide resolved
.Rbuildignore Outdated Show resolved Hide resolved
olivroy and others added 2 commits February 16, 2024 10:17
@schloerke
Copy link
Contributor

Two comments then I think we're good to go!


Can we move the json files in pkgdown/assets/FILE to pkgdown/assets/json/FILE? This will keep the existing urls like https://rstudio.github.io/leaflet/json/us-states.geojson working.


We need to add redirect HTML files from the previous vignette locations to the new locations. In addition, I'd like to maintain the hash being used. (**working on getting an example file / instructions)

@schloerke
Copy link
Contributor

We should add files with the content of: (untested)

<!DOCTYPE html>
<html>
  <body>
    <h1>VIGTITLE</h1>
    Please find the article at its <a href="articles/ARTICLE">new location</a>
<script>
  window.location.href = "articles/ARTICLE" + window.location.hash;
</script>
  </body>
</html>

Where VIGTITLE is the article title and ARTICLE is the file name.

Within pkgdown/assets, we need an HTML redirect file (named ARTICLE) for every past article (except for ./):

ARTICLE - VIGTITLE:

  • map_widget.html - The Map Widget
  • basemaps.html - Basemaps
  • markers.html - Markers
  • popups.html - Popups and Labels
  • shapes.html - Lines and Shapes
  • json.html - GeoJSON and TopoJSON
  • raster.html - Raster Images
  • shiny.html - Shiny Integration
  • colors.html - Colors
  • legends.html - Legends
  • showhide.html - Show/Hide Layers
  • choropleths.html - Choropleths
  • projections.html - Projections
  • morefeatures.html - Additional Features

@olivroy
Copy link
Contributor Author

olivroy commented Feb 16, 2024

I tested the pkgdown approach for redirects locally, but ideally, we'd overwrite the site now, and move to dev mode later?
I tested this with servr locally, and changed the URL manually in my browser, and it works well!

https://pkgdown.r-lib.org/reference/build_site.html#redirects

DESCRIPTION Outdated Show resolved Hide resolved
@schloerke
Copy link
Contributor

Yes! (TIL, again!)

The previous website didn't really have headers to click on to set the hash. So the pkgdown redirects will work great. Thank you

@schloerke
Copy link
Contributor

Thank you @olivroy !

@olivroy
Copy link
Contributor Author

olivroy commented Feb 16, 2024

Thanks for the prompt review! (I would have forgotten the redirects !)

I will send a follow-up early next week to address outstanding issues! And will test outstanding issues, reorder vignettes etc. maybe use the json approach and move other shapefiles / resources to pkgdown/assets to read from the website as much as possible, add back the copywright license in the bottom. The "leaflet" R package is copyright © 2014-2023 Posit Software, PBC.
The Leaflet JavaScript library is © 2010–2023 Vladimir Agafonkin, 2010–2011 CloudMade.
Maps © OpenStreetMap contributors unless otherwise noted.

to make the reproducibility of examples easier to do for users. internal links in the articles. ( I didn't want to read all the content in the context of this PR)

@schloerke
Copy link
Contributor

( I didn't want to read the content in the context of this PR)

I appreciate it.

I look forward to the followup next week. I'll try to have the PR merged (**waiting on team approval) later today.

@schloerke schloerke changed the title Pkgdown Convert website to use {pkgdown} Feb 16, 2024
@schloerke schloerke merged commit dc772e7 into rstudio:main Feb 19, 2024
12 checks passed
@schloerke schloerke changed the title Convert website to use {pkgdown} docs: Convert website to use {pkgdown} Feb 19, 2024
@schloerke
Copy link
Contributor

Thank you @olivroy !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants