@x-wave/blog 1.0.37 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +45 -3
  2. package/index.js +1074 -1068
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -56,6 +56,20 @@ src/
56
56
  ├── welcome.mdx
57
57
  ├── glossary.mdx
58
58
  └── faq.mdx
59
+ public/
60
+ └── og/
61
+ ├── en/ # Language-specific OG images
62
+ │ ├── welcome-preview.png
63
+ │ ├── glossary-preview.png
64
+ │ └── faq-preview.png
65
+ ├── es/
66
+ │ ├── welcome-preview.png
67
+ │ ├── glossary-preview.png
68
+ │ └── faq-preview.png
69
+ └── zh/
70
+ ├── welcome-preview.png
71
+ ├── glossary-preview.png
72
+ └── faq-preview.png
59
73
  ```
60
74
 
61
75
  ### 2. Set up i18n and styles
@@ -254,6 +268,7 @@ Regular content here.
254
268
  | `author` | `string` | Author name. Displayed below the page title with a user icon. |
255
269
  | `date` | `string` | Publication or update date. Displayed below the page title with "Last edited" label and calendar icon (i18n supported). |
256
270
  | `keywords` | `string[] \| string` | Optional array of keywords or comma-separated string for SEO. Inserted into the page `<meta name="keywords">` tag. |
271
+ | `ogImage` | `string` | Optional Open Graph image filename (just the filename, not the full path). Images should be stored in `public/og/<language>/` folder. Used for social media sharing previews. |
257
272
  | `hasAdvanced` | `boolean` | Enables Simple/Advanced mode toggle. Requires a `-advanced.mdx` variant. |
258
273
  | `tags` | `string[]` | Array of tag strings for categorizing content. Tags are automatically indexed by the framework when you pass `mdxFiles` to BlogProvider. Tags are clickable and show search results. |
259
274
 
@@ -450,17 +465,38 @@ keywords: [getting started, tutorial, basics]
450
465
 
451
466
  ### SEO and metadata
452
467
 
453
- The framework automatically handles SEO metadata using React Helmet. Page `<title>`, `<meta description>`, and `<meta keywords>` tags are set based on:
468
+ The framework automatically handles SEO metadata using React Helmet. Page `<title>`, `<meta description>`, `<meta keywords>`, and Open Graph tags are set based on article frontmatter and site configuration.
454
469
 
455
470
  **Article pages:**
456
471
  - **Title**: `"{article title} | {site title}"` (if title exists in frontmatter)
457
472
  - **Description**: Uses article `description` from frontmatter, falls back to site-level `description` from config
458
473
  - **Keywords**: Uses article `keywords` from frontmatter (converts array to comma-separated string)
474
+ - **Open Graph Image**: Uses article `ogImage` filename (image path is auto-constructed from language folder)
475
+
476
+ **Open Graph tags (for social media sharing):**
477
+ When an article includes an `ogImage`, the framework automatically generates:
478
+ - `og:image` - The full image URL for social media preview
479
+ - `og:title` - The article title
480
+ - `twitter:card` - Set to `summary_large_image` for Twitter/X preview
481
+ - `twitter:image` - The image URL for Twitter/X sharing
459
482
 
460
483
  **Home page:**
461
484
  - **Title**: Site title from config
462
485
  - **Description**: Uses site-level `description` from config
463
486
 
487
+ Image folder structure for serving OG images:
488
+
489
+ ```
490
+ public/og/
491
+ ├── en/
492
+ │ ├── getting-started.png # Served as /og/en/getting-started.png
493
+ │ └── tutorial.png # Served as /og/en/tutorial.png
494
+ ├── es/
495
+ │ └── getting-started.png # Served as /og/es/getting-started.png
496
+ └── zh/
497
+ └── getting-started.png # Served as /og/zh/getting-started.png
498
+ ```
499
+
464
500
  Example setup:
465
501
 
466
502
  ```tsx
@@ -483,12 +519,18 @@ Then in your MDX frontmatter:
483
519
  title: Getting Started
484
520
  author: Jane Doe
485
521
  date: 2026-02-23
486
- description: Step-by-step guide to getting started in 5 minutes // Overrides site description
522
+ description: Step-by-step guide to getting started in 5 minutes
487
523
  keywords: [getting started, setup, tutorial, beginners]
524
+ ogImage: getting-started.png // Image at /og/en/getting-started.png (or /og/es/, /og/zh/)
488
525
  ---
489
526
  ```
490
527
 
491
- This ensures proper SEO for search engines and social media sharing, with support for multi-language content.
528
+ When users share this article on social media:
529
+ - Facebook will show the title, description, and the OG image
530
+ - Twitter/X will show a large image preview with the article title
531
+ - LinkedIn and other platforms will use the OG metadata for rich previews
532
+
533
+ This ensures proper SEO for search engines and rich sharing previews on social media, with full support for multi-language content.
492
534
 
493
535
  ### Custom headers
494
536