import React from 'react'; import { Tag } from '../../../src/components/Tag'; import { H2 } from '../../../src/components/ArticleHeading'; import { Paragraph, LeadParagraph } from '../../../src/components/ArticleParagraph'; import { UL, LI } from '../../../src/components/ArticleList'; import { CodeBlock } from '../../../src/components/ArticleBlockquote'; import { YouTubeEmbed } from '../../../src/components/YouTubeEmbed'; import { TwitterEmbed } from '../../../src/components/TwitterEmbed'; import { GenericEmbed } from '../../../src/components/GenericEmbed'; import { Mermaid } from '../../../src/components/Mermaid'; import { BlogPostClient } from '../../../src/components/BlogPostClient'; export default function EmbedDemoPage() { const post = { title: "Rich Content Embedding Demo", description: "Testing our new free embed components for YouTube, Twitter, Mermaid diagrams, and other platforms", date: "2024-02-15", slug: "embed-demo", tags: ["embeds", "components", "tutorial", "mermaid"] }; const formattedDate = new Date(post.date).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }); const readingTime = 5; return (

{post.title}

{readingTime} min

{post.description}

{post.tags.map((tag, index) => ( ))}
This post demonstrates our new free embed components that give you full styling control over YouTube videos, Twitter tweets, and other rich content - all generated at build time.

YouTube Embed Example

Here's a YouTube video embedded with full styling control. The component uses build-time generation for optimal performance.
You can customize the appearance using CSS variables or data attributes: {``}

Twitter/X Embed Example

Twitter embeds use the official Twitter iframe embed for reliable display.
{``}

Generic Embed Example

The generic component supports direct embeds for Vimeo, CodePen, GitHub Gists, and other platforms.
{``}

Mermaid Diagrams

We've added support for Mermaid diagrams! You can now create flowcharts, sequence diagrams, and more using a simple text-based syntax.
B[Load Balancer] B --> C[App Server 1] B --> D[App Server 2] C --> E[(Database)] D --> E`} />
Usage is straightforward: {` B[Load Balancer] B --> C[App Server 1] B --> D[App Server 2] C --> E[(Database)] D --> E\`} />`}

Styling Control

All components use CSS variables for easy customization: {`.youtube-embed { --aspect-ratio: 56.25%; --bg-color: #000000; --border-radius: 12px; --shadow: 0 4px 12px rgba(0,0,0,0.15); } /* Data attribute variations */ .youtube-embed[data-style="minimal"] { --border-radius: 4px; --shadow: none; }`}

Benefits

  • Free: No paid services required
  • Fast: Build-time generation, no runtime API calls
  • Flexible: Full styling control via CSS variables
  • Self-hosted: Complete ownership and privacy
  • SEO-friendly: Static HTML content

Integration

Simply import the components in your blog posts: {`import { YouTubeEmbed } from '../components/YouTubeEmbed'; import { TwitterEmbed } from '../components/TwitterEmbed'; import { GenericEmbed } from '../components/GenericEmbed'; `}
); }