facebook / facebook/docusaurus

A hook for PageMetadata

オープン
#8,658 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
feature
主要言語
TypeScript
スター
66.2k
フォーク
10k
平均マージ
1日 3時間
マージ済み PR(30日)
52

説明

### 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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。