Skip to content

Conversation

@nimrodkra
Copy link
Member

@nimrodkra nimrodkra commented Jan 6, 2026

  • 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.

Preview domain

https://technical-seo-improvements.preview.app.daily.dev

- 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.
@vercel
Copy link

vercel bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
daily-webapp Ready Ready Preview Jan 6, 2026 2:32pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
storybook Ignored Ignored Jan 6, 2026 2:32pm

- 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
- 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.
@idoshamun
Copy link
Member

@claude review this PR

@claude
Copy link
Contributor

claude bot commented Jan 6, 2026

Claude finished @idoshamun's task in 1m 23s —— View job


PR Review

Progress

  • Read all changed files
  • Analyze SEO schema changes
  • Review metadata improvements
  • Check for bugs and best practices
  • Post comprehensive review

Overview

This 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

  1. TechArticle Schema: Good choice to change from generic Article to TechArticle - more semantically accurate for developer content
  2. Breadcrumb Navigation: Excellent addition for SEO and user experience
  3. Comment Schemas: Smart implementation with Q&A detection for question posts
  4. 404 Handling: Proper notFound: true return improves crawl budget
  5. Image Metadata: Adding dimensions and alt text to Open Graph is a good practice
  6. Top Comments Query: New GraphQL query structure looks clean

Issues & Suggestions

1. Missing topComments data in share/index.tsx

Severity: Medium

packages/webapp/pages/posts/[id]/share/index.tsx:110-117

The share page doesn't fetch or pass topComments to PostPage, but the main post page does. This means comment schemas won't render on shared post pages.

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: [] })),
]);

Fix this →

2. Potential null reference in video schema

Severity: Low

packages/webapp/components/PostSEOSchema.tsx:116-127

The video schema uses post.videoId without checking if it exists first. If a VideoYouTube post somehow lacks a videoId, this could create invalid schema markup.

...(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: {
    // ...
  },
}),

Fix this →

3. Schema validation concern: author field conditional logic

Severity: Low

packages/webapp/components/PostSEOSchema.tsx:67-97

The schema uses post.author to determine if author should be Person or Organization. However, for Article/TechArticle schema, the author field is required by Google. If post.author is null/undefined but post.source is also missing, the schema could be invalid.

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',
    },

Fix this →

4. Comment schema could include parent comment context

Severity: Low / Enhancement

packages/webapp/components/PostSEOSchema.tsx:159-174

The commentToSchema function doesn't include parent comment information. For nested discussions, this context could be valuable for search engines.

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 simplistic

Severity: Low

packages/webapp/components/PostSEOSchema.tsx:194-197

The question detection only checks if the title ends with ?. This could miss questions like "How to do X" or misidentify non-questions that happen to end 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 updating

Severity: Medium

packages/webapp/__tests__/PostPage.tsx:301-390

The tests validate the getSeoDescription function thoroughly, but there are no tests for:

  • The new schema generation functions (getSEOJsonLd, getBreadcrumbJsonLd, getCommentsJsonLd, getQAJsonLd)
  • The Q&A detection logic
  • The comment schema transformation

Recommendation: Add test coverage for the new schema functions to ensure they generate valid JSON-LD and handle edge cases properly.

Minor Issues

7. Inconsistent comment in graphql/comments.ts

packages/shared/src/graphql/comments.ts:283

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

  1. How are "top comments" determined in the TOP_COMMENTS_QUERY? Is it by upvotes, recency, or another metric?
  2. Have you validated the generated schema.org markup using Google's Rich Results Test?
  3. Is there a reason the share page doesn't include comment schemas? Was this intentional?

Security & Performance

✅ No security concerns identified
✅ Parallel fetching of post and comments data is efficient
✅ Graceful error handling for comment fetch failures
✅ Proper use of ISR revalidation (60s)

Summary

This is a solid SEO improvement PR. The main concerns are:

  1. Missing topComments in share page (should be fixed)
  2. Some defensive null checks needed for edge cases
  3. Test coverage should be expanded

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)
Copy link
Member

@idoshamun idoshamun left a 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)
@nimrodkra
Copy link
Member Author

@idoshamun fixed

@idoshamun idoshamun merged commit c4063ed into main Jan 6, 2026
12 checks passed
@idoshamun idoshamun deleted the technical-seo-improvements branch January 6, 2026 15:16
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.

3 participants