facebook / facebook/docusaurus
A hook for PageMetadata
- Dominant language
- TypeScript
- Stars
- 66.2k
- Forks
- 10k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 52
Description
### Have you read the Contributing Guidelines on issues?
- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).
### Description
Consider the `PageMetadata` component:
https://github.com/facebook/docusaurus/blob/6b618bc9e5fcc9d52d3aa49a9d447f4d7ea76d41/packages/docusaurus-theme-common/src/utils/metadataUtils.tsx#L27-L62
There's no way to hook into this and make adjustments. It would be cool if there was.
### Has this been requested on Canny?
No
### Motivation
I recently built a plugin which allows users to use Cloudinary as a CDN for images:
https://johnnyreilly.com/docusaurus-image-cloudinary-rehype-plugin
Whilst I'm able to use this to flip to Cloudinary for general image serving, I cannot for `og:image` / `twitter:image` which is surfaced in the `PageMetadata` component. And interestingly, images there get hardcoded with the baseUrl of the site (which doesn't work for image CDNs)
It would be cool if it were possible to control this somehow.
### API design
I'm not quite sure what makes sense, possibly a hook that cook be supplied in the `docusaurus.config.js` which would have current parameters as inputs, and new parameters as outputs. Not really sure.
Open to suggestions.
### Have you tried building it?
No
### Self-service
- [X] I'd be willing to contribute this feature to Docusaurus myself.
Contributor guide
Assessment
This issue has not been assessed yet.