Add use_r_universe_badge()#1994
Merged
jennybc merged 18 commits intor-lib:mainfrom Jul 29, 2025
Merged
Conversation
jennybc
reviewed
Nov 21, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Member
|
@jeroen Will you take a quick look at this? The only real question I have is about the most correct URL for the badge. I'll comment inline. |
jennybc
reviewed
Jul 29, 2025
| } | ||
|
|
||
| owner <- parse_repo_spec(repo_spec)[["owner"]] | ||
| src <- glue("https://{owner}.r-universe.dev/{pkg}/badges/version") |
Member
There was a problem hiding this comment.
I can't tell if the best form is what I currently have:
https://{owner}.r-universe.dev/{pkg}/badges/version
Or:
https://{owner}.r-universe.dev/badges/{pkg}
It feels like the prose and the example here sort of contradict each other?
https://docs.r-universe.dev/publish/set-up.html#badge-showing-the-number-of-the-deployed-version
Member
There was a problem hiding this comment.
Also the markdown you get from the "copy markdown" button on a page like this:
https://r-lib.r-universe.dev/badges
looks like:
[](https://r-lib.r-universe.dev/usethis)
These examples are not great, as it stands. But I don't think showing the use `use_badge()` to create one's on R-universe badge is the most obvious usage to add here.
jennybc
reviewed
Jul 29, 2025
| #' * `use_lifecycle_badge()`: badge declares the developmental stage of a | ||
| #' package according to <https://lifecycle.r-lib.org/articles/stages.html>. | ||
| #' * `use_r_universe_badge()`: `r lifecycle::badge("experimental")` badge | ||
| #' indicates what version of your package is available on [R-universe |
Member
There was a problem hiding this comment.
Just to confirm: it's "R-universe" (lowercase "u"), yeah? As opposed to "R-Universe" (uppercase "U").
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1883
Edit by @jennybc: I finished this off and sorted out various issues in the way that makes sense to me.
It has limitations, in the sense that it doesn't verify that the repo actually exists. It would also be great to add the r-universe installation options too.
I could add this to the badge with
ui_code()It worked out of the box with usethis

implementation considerations
use_badge()If you want, you can let me know what you think @jeroen. And you'd probably best to implement this function.
ideas
A
browse_r_universe()similar tobrowse_github()would probably be useful and easy to implement + the badge could build on top of this.man page preview