• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
alexwein

alexwein

gordwame

Remix of stevekrouse/reactHonoExample
Public
Like
gordwame
Home
Code
5
backend
3
docs
1
frontend
5
shared
2
README.md
Branches
4
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
docs
/
social-sharing.md
Code
/
docs
/
social-sharing.md
Search
5/24/2025
social-sharing.md

Social Media Share Cards

This document explains how the social media share card feature works in Gord Wame.

Overview

When links to the game are shared on social media platforms (like Bluesky, Discord, Twitter, Facebook, etc.), they display rich preview cards with:

  • Game title and description
  • A visual representation of the current board
  • Proper Open Graph and Twitter Card meta tags

How It Works

1. Meta Tags

Each page includes comprehensive meta tags for social media sharing:

  • Open Graph tags: Used by Facebook, Discord, and many other platforms
  • Twitter Card tags: Used by Twitter/X
  • Additional meta tags: For broader compatibility

2. Dynamic Images

The system generates SVG images of the game board for each unique board configuration:

  • Route: /share-image/:boardstring
  • Format: SVG (1200x630 pixels - standard social media ratio)
  • Content: Game title, board visualization, and instructions
  • Caching: 1 hour cache for performance

3. Board String Handling

The system handles different scenarios:

  • Default route (/): Uses "DEGWOARM" as the default board
  • Valid board string (/play/TESTWORD): Uses the specific board configuration
  • Invalid board string (/play/INVALID123): Falls back to "DEGWOARM"

4. URL Generation

The system automatically detects the current running URL to generate correct image URLs, ensuring compatibility across different deployment environments.

Configuration

Share Text Configuration

Edit /shared/shareConfig.ts to customize the share card text:

export const shareConfig = { title: "Gord Wame: A Word Game", description: "Use every letter inside the circle in any order to try and spell a word. Press a letter outside to circle to swap it in. Find as many words as you can!", siteName: "Gord Wame", twitterCard: "summary_large_image", twitterSite: "@gordwame", // Update with actual Twitter handle defaultBoardString: "DEGWOARM" };

Image Customization

The board images are generated in /backend/svgRenderer.ts. You can customize:

  • Colors and styling
  • Layout and positioning
  • Text content and fonts
  • Image dimensions

Testing

To test the share cards:

  1. Direct image access: Visit /share-image/BOARDSTRING to see the generated image
  2. Meta tag validation: Use tools like:
    • Facebook Sharing Debugger
    • Twitter Card Validator
    • LinkedIn Post Inspector

Platform Compatibility

The implementation is designed to work with:

  • ✅ Discord: Supports SVG images and Open Graph tags
  • ✅ Bluesky: Supports Open Graph tags
  • ✅ Twitter/X: Uses Twitter Card tags
  • ✅ Facebook: Uses Open Graph tags
  • ✅ LinkedIn: Uses Open Graph tags
  • ✅ Slack: Supports Open Graph tags

Technical Details

SVG vs PNG

The system currently uses SVG images because:

  • They're vector-based and scale perfectly
  • Smaller file sizes
  • No external dependencies for conversion
  • Good support across modern platforms

If PNG compatibility is needed in the future, you could:

  1. Use an external SVG-to-PNG conversion service
  2. Pre-generate PNG versions for common boards
  3. Use a server-side rendering solution

Caching Strategy

  • Images are cached for 1 hour (Cache-Control: public, max-age=3600)
  • This balances performance with the ability to update content
  • Social media platforms typically cache images for longer periods

Error Handling

The system includes robust error handling:

  • Invalid board strings fall back to the default board
  • Image generation errors return a default image
  • All errors are logged for debugging

Future Improvements

Potential enhancements could include:

  1. PNG conversion: For platforms that don't support SVG
  2. Board state visualization: Show current game progress
  3. Animated previews: For platforms that support animated images
  4. Localization: Multi-language support for share text
  5. Custom themes: Different visual styles for share cards
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.