facebook / facebook/docusaurus

A hook for PageMetadata

Abierto
#8,658 4 comentarios 0 reacciones 0 asignados Ver en GitHub
feature
Lenguaje dominante
TypeScript
Estrellas
66.2k
Forks
10k
Merge medio
1 d 3 h
PR fusionados (30 d)
52

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.