Skip to content

feat: dynamic OG meta tag generation on build (#64)#99

Merged
alohays merged 2 commits intomainfrom
feat/og-meta-tags
Mar 19, 2026
Merged

feat: dynamic OG meta tag generation on build (#64)#99
alohays merged 2 commits intomainfrom
feat/og-meta-tags

Conversation

@alohays
Copy link
Owner

@alohays alohays commented Mar 19, 2026

Summary

  • Adds ogMetaPlugin() Vite plugin that reads monitor-forge.config.json at build/dev time and injects config values into index.html OG meta tags (og:title, og:description, twitter:title, twitter:description, <title>)
  • Adds ogImage field to BrandingSchema — when set, og:image and twitter:image tags are injected; when absent, any existing image tags are stripped
  • Registers the plugin in vite.config.ts alongside the existing apiDevPlugin

Test plan

  • npx vitest run forge/ — 372 tests pass (13 new tests for og-meta-plugin)
  • npx tsc --noEmit — zero new errors introduced (pre-existing src/App.ts generated-manifest errors and api/proxy/v1 error are unrelated and existed on main)
  • HTML escaping verified for &, ", <, > in name/description
  • ogImage injection and removal both tested
  • Graceful fallback when config file is missing (returns HTML unchanged)

Closes #64

🤖 Generated with Claude Code

alohays and others added 2 commits March 20, 2026 03:03
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add single-quote escaping (&#x27;) to escapeHtml to prevent XSS via
  attribute injection in single-quoted HTML attributes
- Refactor ogImage block to handle og:image and twitter:image
  independently, so twitter:image is always replaced or injected when
  ogImage is configured, even when og:image already exists in the HTML

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alohays alohays force-pushed the feat/og-meta-tags branch from b8af7c5 to 5a7e5a5 Compare March 19, 2026 18:04
@alohays alohays merged commit 2811dc5 into main Mar 19, 2026
1 check passed
@alohays alohays deleted the feat/og-meta-tags branch March 19, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: OG meta tag auto-generation on build

1 participant