-
Notifications
You must be signed in to change notification settings - Fork 290
feat: enhance SEO schema and improve post metadata #5243
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
- Updated SEO description format for better clarity. - Changed article type to 'TechArticle' and added new properties for improved structured data. - Introduced breadcrumb JSON-LD for better navigation and SEO. - Enhanced Open Graph metadata with image dimensions and alt text. - Added additional meta tags for robots to optimize image previews. - Implemented proper 404 handling for not found posts to improve SEO and crawl budget.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add TOP_COMMENTS_QUERY to fetch top 5 comments by upvotes - Add Comment schema for regular posts with comments - Add Q&A schema (QAPage) for question-style posts (title ends with ?) - Add Review schema for highly upvoted comments (10+ upvotes) - Fetch top comments in parallel with post data in getStaticProps - Gracefully handle cases with no comments or API errors SEO Impact: - Comment schema enables rich snippets - Q&A schema can trigger Q&A rich results in Google - Review schema adds star ratings to search results
f463b42 to
23a0c5d
Compare
- Remove aggregateRating from TechArticle (not supported by Google for Articles) - Remove Review schema (itemReviewed as Article not supported by Google) Google only supports these schemas for specific types: - aggregateRating: Product, Recipe, LocalBusiness, etc. - Review: Product, Book, Movie, etc.
|
@claude review this PR |
|
Claude finished @idoshamun's task in 1m 23s —— View job PR ReviewProgress
OverviewThis PR makes significant improvements to SEO structured data and metadata handling for post pages. The changes are well-structured and follow best practices for schema.org markup. Positive Changes
Issues & Suggestions1. Missing topComments data in share/index.tsxSeverity: Medium
The share page doesn't fetch or pass return {
props: {
id: initialData.post.id,
initialData,
seo,
shareUser: shareUser || null,
shareUserId: shareUser ? (query.userid as string) : null,
// topComments is missing here
},
};Recommendation: Fetch top comments in share/index.tsx similar to the main post page: const [initialData, shareUser, commentsData] = await Promise.all([
gqlClient.request<PostData>(POST_BY_ID_STATIC_FIELDS_QUERY, { id }),
// ... existing shareUser fetch
gqlClient
.request<TopCommentsData>(TOP_COMMENTS_QUERY, { postId: id, first: 5 })
.catch(() => ({ topComments: [] })),
]);2. Potential null reference in video schemaSeverity: Low
The video schema uses ...(post.type === PostType.VideoYouTube && {
video: {
'@type': 'VideoObject',
// ...
embedUrl: `https://www.youtube.com/embed/${post.videoId}`, // videoId might be undefined
},
}),Recommendation: Add a check for videoId: ...(post.type === PostType.VideoYouTube && post.videoId && {
video: {
// ...
},
}),3. Schema validation concern: author field conditional logicSeverity: Low
The schema uses Recommendation: Ensure there's always a fallback: author: post.author
? {
'@type': 'Person',
// ...
}
: {
'@type': 'Organization',
name: post.source?.name || 'daily.dev',
logo: post.source?.image,
url: post.source?.permalink || 'https://daily.dev',
},4. Comment schema could include parent comment contextSeverity: Low / Enhancement
The Optional Enhancement: Consider if parent comment relationships should be included in the schema for better context understanding by search engines. 5. isQuestionPost detection is too simplisticSeverity: Low
The question detection only checks if the title ends with const isQuestionPost = (post: Post): boolean => {
const
return title?.endsWith('?') || false;
};Recommendation: While this is a pragmatic approach, consider documenting this limitation or enhancing it to check for common question patterns: const isQuestionPost = (post: Post): boolean => {
const
if (!title) return false;
return (
title.endsWith('?') ||
title.startsWith('how to') ||
title.startsWith('how do') ||
title.startsWith('what is') ||
title.startsWith('why ')
);
};6. Test coverage needs updatingSeverity: Medium
The tests validate the
Recommendation: Add test coverage for the new schema functions to ensure they generate valid JSON-LD and handle edge cases properly. Minor Issues7. Inconsistent comment in graphql/comments.ts
The comment says "SEO: Top comments query for structured data" but could be more descriptive about what "top" means (most upvoted? newest? oldest?). Questions for Author
Security & Performance✅ No security concerns identified SummaryThis is a solid SEO improvement PR. The main concerns are:
The structured data implementation follows schema.org best practices and should significantly improve search engine understanding of post content. Recommendation: Fix issue #1 (missing topComments on share page) before merging. Issues #2-3 are nice-to-haves but not blockers. |
- Add topComments fetch to share page for comment schemas (#1) - Add videoId null check for video schema (#2) - Add fallback author to 'daily.dev' when both author and source missing (#3) - Enhance isQuestionPost to detect 'how to', 'what is', etc. patterns (#5) - Improve TOP_COMMENTS_QUERY comment to clarify ordering (#7)
idoshamun
left a comment
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.
see my feedback
- Remove unused 'content' field from TOP_COMMENTS_QUERY (only need contentHtml) - Remove isQuestionPost detection and Q&A schema (too heuristic)
|
@idoshamun fixed |
Preview domain
https://technical-seo-improvements.preview.app.daily.dev