pkgdown
pkgdown copied to clipboard
Include arbitrary files
Am I missing an automatic way to flag specific files which should be included in the built site? I'm trying to use the pkgdown site as a drat repository, and since pkgdown cleans the gh-pages branch on every rebuild, I'm having to manually add the files back.
Specifically, I need to place some files in bin/
and src/contrib/
. I have these on my main branch, and ideally I'd like some way to tell pkgdown to just copy those locations/files directly over to gh-pages.
Not sure if this will help, but I have a repo + pkgdown website where I host arbitrary files:
https://github.com/vincentarelbundock/Rdatasets/
What I do is basically:
- commit the files to the
gh-pages
branch - deploy with
pkgdown::deploy_to_branch(clean = FALSE)
Note the important clean
argument.
The specific steps I take are listed in a reminder at the bottom of my README, but they are repo-specific.
Thanks - I do something similar right now but its helpful to see another example!
Where this falls down for me is needing to do clean = FALSE
. This could lead to a lot of cruft building up in gh-pages
. I'm OK with pkgdown cleaning out the existing gh-pages
, I just want to be able to flag files that pkgdown copies over automatically, after cleaning out the existing.
Indeed, we have a similar problem. We want to make available in the website a vignette that can only be built in PDF and we have to run a quite complicated sequence of commands:
https://github.com/MLopez-Ibanez/irace/blob/f8c50f9cc18c4a4c1d96b7e0bf1b95d0417ec5a4/.github/workflows/R-CMD-check.yaml#L193-L218
Seems like it would be reasonable to include some config that let you declare paths as "known" and not to be cleaned up.
Alternatively we could have a convention like where all files in pkgdown/include
are copied to the root directory of the package site.
Actually, template packages use inst/pkgdown/assets/
, so would probably make the most sense to copy pkgdown/assets
to the docs destination dir.
Oh, and indeed the code to do that already exists 😬
And it's already documented in https://pkgdown.r-lib.org/articles/customise.html#additional-html-and-files, so I'm going to close this issue 😄