Add Open Graph and JSON-LD metadata to news pages#255
Merged
NebraskaCoder merged 4 commits intodevelopfrom Dec 4, 2025
Merged
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/newslisting and/news/[slug]article pages for better social media sharingTest plan
🤖 Generated with Claude Code