Skip to content

Commit 87b8343

Browse files
authored
docs: add social images and better search metadata (#1383)
* docs: add social images to the website pages Links to the website showed no image in social networks and chats: the pages had no og:image. Every page now gets one with its title and description, generated at build time with astro-og-canvas and the Inter font from npm, so the build fetches nothing. * docs: describe the website pages for search results The component and example pages had titles such as "Line" and descriptions such as "Description of Line component from react-chartjs-2.". They get titles with the words people search for, such as "React Line Chart Example", and descriptions of what each page shows. The overview pages and the older docs pages get better descriptions too. * chore: describe the package for npm search npm search ranks packages by their keywords and description, which named neither React nor the chart types.
1 parent 6911b42 commit 87b8343

43 files changed

Lines changed: 269 additions & 38 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎package.json‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-chartjs-2",
33
"type": "module",
44
"version": "6.0.0",
5-
"description": "React components for Chart.js.",
5+
"description": "React components for Chart.js, the most popular charting library.",
66
"author": "Jeremy Ayerst",
77
"license": "MIT",
88
"homepage": "https://react-chartjs-2.js.org",
@@ -15,12 +15,28 @@
1515
"url": "https://github.com/reactchartjs/react-chartjs-2/issues"
1616
},
1717
"keywords": [
18+
"react",
19+
"react-component",
1820
"chart",
19-
"chart-js",
21+
"charts",
22+
"charting",
2023
"chart.js",
24+
"chartjs",
25+
"chart-js",
2126
"react-chartjs-2",
2227
"react chart.js",
23-
"react-chart.js"
28+
"react-chart.js",
29+
"graph",
30+
"visualization",
31+
"data-visualization",
32+
"bar-chart",
33+
"line-chart",
34+
"pie-chart",
35+
"doughnut-chart",
36+
"polar-area-chart",
37+
"radar-chart",
38+
"scatter-chart",
39+
"bubble-chart"
2440
],
2541
"sideEffects": false,
2642
"types": "./dist/index.d.ts",

‎pnpm-lock.yaml‎

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎website/astro.config.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export default defineConfig({
106106
PageSidebar: './src/components/PageSidebar.astro',
107107
Footer: './src/components/Footer.astro'
108108
},
109+
routeMiddleware: './src/routeData.ts',
109110
plugins: [
110111
llmsTxt({
111112
projectName: 'react-chartjs-2',

‎website/oxlint.config.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ export default defineConfig({
1818
'eslint/no-implicit-globals': 'off'
1919
}
2020
},
21+
{
22+
// The design of the social images: colors and sizes are data
23+
files: ['src/pages/og/**'],
24+
rules: {
25+
'eslint/no-magic-numbers': 'off'
26+
}
27+
},
2128
{
2229
// Served as is: a classic service worker script, not a module
2330
files: ['public/**'],

‎website/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"@astrojs/check": "^0.9.12",
2929
"@astrojs/markdown-remark": "^7.3.10",
3030
"@astrojs/starlight": "^0.43.2",
31+
"@fontsource/inter": "^5.3.0",
3132
"astro": "^7.4.13",
33+
"astro-og-canvas": "^0.13.3",
34+
"canvaskit-wasm": "^0.42.0",
3235
"react-docgen-typescript": "^2.4.0",
3336
"starlight-llms-txt": "^0.12.0"
3437
},

‎website/src/assets/og-logo.png‎

5.83 KB
Loading

‎website/src/content/docs/components/bar.mdx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
title: "Bar"
3-
description: "Description of Bar component from react-chartjs-2."
3+
description: "The Bar component of react-chartjs-2 renders a Chart.js bar chart in React: vertical, horizontal, stacked or grouped. See how to use it, its props and examples."
4+
head:
5+
- tag: title
6+
content: "Bar: React Bar Chart Component | react-chartjs-2"
47
---
58

69
import PropsTable from '../../../components/PropsTable.astro'

‎website/src/content/docs/components/bubble.mdx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
title: "Bubble"
3-
description: "Description of Bubble component from react-chartjs-2."
3+
description: "The Bubble component of react-chartjs-2 renders a Chart.js bubble chart in React. See how to use it, its props and an example."
4+
head:
5+
- tag: title
6+
content: "Bubble: React Bubble Chart Component | react-chartjs-2"
47
next: false
58
---
69

‎website/src/content/docs/components/chart.mdx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
title: "Chart"
3-
description: "Description of Chart component from react-chartjs-2."
3+
description: "The Chart component of react-chartjs-2 renders a Chart.js chart of any type in React, mixed charts included. See how to use it, its props and examples."
4+
head:
5+
- tag: title
6+
content: "Chart: React Component for Any Chart Type | react-chartjs-2"
47
prev: Components
58
---
69

‎website/src/content/docs/components/doughnut.mdx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
title: "Doughnut"
3-
description: "Description of Doughnut component from react-chartjs-2."
3+
description: "The Doughnut component of react-chartjs-2 renders a Chart.js doughnut chart in React. See how to use it, its props and an example."
4+
head:
5+
- tag: title
6+
content: "Doughnut: React Doughnut Chart Component | react-chartjs-2"
47
---
58

69
import PropsTable from '../../../components/PropsTable.astro'

0 commit comments

Comments
 (0)