{"id":13678238,"url":"https://github.com/rspack-contrib/rsbuild-plugin-open-graph","last_synced_at":"2025-09-10T17:43:54.506Z","repository":{"id":229546018,"uuid":"777016650","full_name":"rspack-contrib/rsbuild-plugin-open-graph","owner":"rspack-contrib","description":"An Rsbuild plugin to generate Open Graph meta tags.","archived":false,"fork":false,"pushed_at":"2025-04-01T05:37:30.000Z","size":65,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T10:13:19.973Z","etag":null,"topics":["rsbuild","rsbuild-plugin","rspack"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rspack-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-25T02:50:45.000Z","updated_at":"2025-04-01T05:37:33.000Z","dependencies_parsed_at":"2024-03-25T03:44:10.620Z","dependency_job_id":"217b3c9a-205b-4f40-84a2-5a11e0ad4aab","html_url":"https://github.com/rspack-contrib/rsbuild-plugin-open-graph","commit_stats":null,"previous_names":["rspack-contrib/rsbuild-plugin-open-graph"],"tags_count":3,"template":false,"template_full_name":"rspack-contrib/rsbuild-plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-open-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-open-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-open-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Frsbuild-plugin-open-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rspack-contrib","download_url":"https://codeload.github.com/rspack-contrib/rsbuild-plugin-open-graph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860167,"owners_count":21173342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rsbuild","rsbuild-plugin","rspack"],"created_at":"2024-08-02T13:00:51.403Z","updated_at":"2025-09-10T17:43:54.447Z","avatar_url":"https://github.com/rspack-contrib.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Rsbuild Plugins"],"readme":"# rsbuild-plugin-open-graph\n\nAn Rsbuild plugin to generate Open Graph meta tags.\n\n\u003cp\u003e\n  \u003ca href=\"https://npmjs.com/package/rsbuild-plugin-open-graph\"\u003e\n   \u003cimg src=\"https://img.shields.io/npm/v/rsbuild-plugin-open-graph?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"npm version\" /\u003e\n  \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"license\" /\u003e\n\u003c/p\u003e\n\n## Usage\n\nInstall:\n\n```bash\nnpm add rsbuild-plugin-open-graph -D\n```\n\nAdd plugin to your `rsbuild.config.ts`:\n\n```ts\n// rsbuild.config.ts\nimport { pluginOpenGraph } from 'rsbuild-plugin-open-graph';\n\nexport default {\n  plugins: [\n    pluginOpenGraph({\n      // options\n    }),\n  ],\n};\n```\n\n## Example\n\n- Config:\n\n```ts\npluginOpenGraph({\n  title: 'Rsbuild',\n  type: 'website',\n  url: 'https://rsbuild.dev/',\n  image: 'https://rsbuild.dev/og-image.png',\n  description: 'The Rspack-based build tool',\n  twitter: {\n    site: '@rspack_dev',\n    card: 'summary_large_image',\n  },\n});\n```\n\n- Generated HTML:\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta property=\"og:url\" content=\"https://rsbuild.dev/\" /\u003e\n    \u003cmeta property=\"og:type\" content=\"website\" /\u003e\n    \u003cmeta property=\"og:title\" content=\"Rsbuild\" /\u003e\n    \u003cmeta property=\"og:image\" content=\"https://rsbuild.dev/og-image.png\" /\u003e\n    \u003cmeta property=\"og:description\" content=\"The Rspack-based build tool\" /\u003e\n    \u003cmeta property=\"twitter:site\" content=\"@rspack_dev\" /\u003e\n    \u003cmeta property=\"twitter:card\" content=\"summary_large_image\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Options\n\nHere are the available options:\n\n```ts\ntype PluginOpenGraphOptions = {\n  url?: string;\n  type?: string;\n  title?: string;\n  image?: string;\n  audio?: string;\n  video?: string;\n  locale?: string;\n  determiner?: 'a' | 'an' | 'the' | 'auto' | '';\n  description?: string;\n  twitter?: {\n    site?: string;\n    card?: string;\n    title?: string;\n    image?: string;\n    player?: string;\n    creator?: string;\n    description?: string;\n  };\n};\n```\n\nSee the following documents for details:\n\n- [The Open Graph protocol](https://ogp.me/)\n- [The Open Graph of Twitter](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/abouts-cards)\n- [The Open Graph of Meta / Facebook](https://developers.facebook.com/docs/sharing/webmasters)\n\n## Multi Page Application\n\nIf you are using a multi-page application, you can pass a function to the plugin options. The function will be called with the `entryName` as the argument, and you can return the options for each entry.\n\n```ts\npluginOpenGraph(({ entryName }) =\u003e {\n  const commonOptions = {\n    type: 'website',\n    url: 'https://rsbuild.dev/',\n    image: 'https://rsbuild.dev/og-image.png',\n    description: 'The Rspack-based build tool',\n    twitter: {\n      site: '@rspack_dev',\n      card: 'summary_large_image',\n    },\n  };\n\n  if (entryName === 'index') {\n    return {\n      ...commonOptions,\n      title: 'Index',\n    };\n  }\n  if (entryName === 'about') {\n    return {\n      ...commonOptions,\n      title: 'About',\n      url: 'https://rsbuild.dev/about',\n    };\n  }\n});\n```\n\n## License\n\n[MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-open-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-open-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Frsbuild-plugin-open-graph/lists"}