Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rspack-contrib/rsbuild-plugin-open-graph

An Rsbuild plugin to generate Open Graph meta tags.
https://github.com/rspack-contrib/rsbuild-plugin-open-graph

rsbuild rsbuild-plugin rspack

Last synced: 16 days ago
JSON representation

An Rsbuild plugin to generate Open Graph meta tags.

Awesome Lists containing this project

README

        

# rsbuild-plugin-open-graph

An Rsbuild plugin to generate Open Graph meta tags.



npm version

license

## Usage

Install:

```bash
npm add rsbuild-plugin-open-graph -D
```

Add plugin to your `rsbuild.config.ts`:

```ts
// rsbuild.config.ts
import { pluginOpenGraph } from 'rsbuild-plugin-open-graph';

export default {
plugins: [
pluginOpenGraph({
// options
}),
],
};
```

## Example

- Config:

```ts
pluginOpenGraph({
title: 'Rsbuild',
type: 'website',
url: 'https://rsbuild.dev/',
image: 'https://rsbuild.dev/og-image.png',
description: 'The Rspack-based build tool',
twitter: {
site: '@rspack_dev',
card: 'summary_large_image',
},
});
```

- Generated HTML:

```html










```

## Options

Here are the available options:

```ts
type PluginOpenGraphOptions = {
url?: string;
type?: string;
title?: string;
image?: string;
audio?: string;
video?: string;
locale?: string;
determiner?: 'a' | 'an' | 'the' | 'auto' | '';
description?: string;
twitter?: {
site?: string;
card?: string;
title?: string;
image?: string;
player?: string;
creator?: string;
description?: string;
};
};
```

See the following documents for details:

- [The Open Graph protocol](https://ogp.me/)
- [The Open Graph of Twitter](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/abouts-cards)
- [The Open Graph of Meta / Facebook](https://developers.facebook.com/docs/sharing/webmasters)

## License

[MIT](./LICENSE).