r-lib / pkgdown

Generate static html documentation for an R package

Home Page:https://pkgdown.r-lib.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function name is not a valid topic name?

robmoss opened this issue · comments

I experience an error on GitLab CI, but not locally, where pkgdown 2.0.7 raises an error when building the function reference:

! In '_pkgdown.yml', topic must be a known topic name or alias
✖ Not 'retic_steady_state'

where retic_steady_state is a documented and exported function in my package. The reference section of _pkgdown.yaml looks like:

reference:
- title: "Model parameters"
  desc: >
    Functions that ...
  contents:
  - ends_with("_parameters")
  - retic_steady_state

In both cases, I'm calling R -e 'pkgdown::build_site()' from the command line, and the site builds without any issues on my laptop. I can't figure out why it behaves completely differently on GitLab CI — do you have any ideas? I can link to the CI job if that would be helpful.

A link might help indeed!
One possibility: could the help file have been gitignored, or just not pushed to the repository?

@robmoss There's a .gitignore file in man/, that ignores all the .Rd file. pkgdown does not run devtools::document() so you'd need to either

  • add this step to the workflow that intends to build the website,
  • remove man/.gitignore.

I'd recommend doing the latter, because it's unusual to not commit the Rd files to the code source repository, even if those are "derived files".

With the Rd files checked into the repository, you could even simplify the installation instructions I think (recommending using pak (see also pak package source), or install.packages() if you set up an R-universe).

Note that for package development issues, the problem can also sometimes be .Rbuildignore -- those pesky ignore files should not be... ignored 😸

@maelle thanks very much for your advice. I've managed to set up a personal R-universe and simplified the installation instructions as a result.