Skip to content

Include OpenGraph metadata in documentation pages #6280

@sin-ack

Description

@sin-ack

Currently, if a BCR API documentation page is posted to Slack or Discord, it results in the following generic OpenGraph image:

Discord OpenGraph image, showing the text Bazel Central Registry - Browse Bazel modules and versions

It would be nice if it instead included something like this:

# [email protected] docs

Rules for foo language.

An additional cool feature could be to show the documentation for a specific module/rule/macro/extension module when it is linked. This won't work out of the box though, since the full documentation is currently on one page, and everything is navigated using fragments (which aren't sent to the server). A possible way for this is to make links like this:

https://registry.bazel.build/docs/rules_foo/1.2.3?path=function-foo_library

Which are just redirects to the same page with a fragment, but autodetects OpenGraph crawlers and instead of redirecting returns an empty page with OpenGraph metadata about the specific rule in question. The links on the page can then be rewritten using JS when the page is loaded (but with an event handler to just navigate to the fragment instead; this way, copying the link gives you the query version but clicking doesn't navigate you to another page). This would require some server-side work though, I don't know if the BCR site is fully static or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions