-
Notifications
You must be signed in to change notification settings - Fork 25
Add Open Graph and JSON-LD metadata to news pages #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add OG protocol tags to improve social media sharing for news content: - /news listing: og:title, og:description, og:url, og:site_name, og:locale, og:type - /news/[slug] articles: article-specific tags including published_time and authors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add NewsArticle schema.org structured data for better Google Search indexing. Includes sanitized JSON-LD output utility to prevent XSS in PR contributions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds Open Graph protocol metadata and JSON-LD structured data to news pages to improve social media sharing and search engine indexing. The implementation includes a security-focused utility function to sanitize JSON-LD output and prevent XSS attacks from potentially malicious content.
Key Changes
- Added Open Graph meta tags to
/newslisting and/news/[slug]article pages with title, description, URL, and article-specific metadata - Implemented JSON-LD structured data using the NewsArticle schema for individual articles
- Created
safeJsonLdStringifyutility function to escape potentially dangerous characters in JSON-LD script tags
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
utils/jsonLd.ts |
New utility function for safely stringifying JSON-LD data with XSS protection via character escaping |
app/[locale]/news/page.tsx |
Added Open Graph metadata to news listing page, including typed return for generateMetadata |
app/[locale]/news/[slug]/page.tsx |
Added Open Graph metadata and JSON-LD NewsArticle schema to individual article pages, with proper use of sanitization utility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reduces auto-generated excerpt from 200 to 150 characters to meet Open Graph description guidelines (110-160 characters optimal). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Add & -> \u0026 escaping for comprehensive XSS protection - Add unit tests covering script injection, HTML entities, nested objects, and arrays 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Summary
/newslisting and/news/[slug]article pages for better social media sharingTest plan
🤖 Generated with Claude Code