Conversation
- Fix invalid JSON-LD schemas by replacing is:inline define:vars with
set:html={JSON.stringify()} pattern in BaseHead.astro and
BreadcrumbSchema.astro
- Fix category URL case inconsistency (TypeScript → typescript) to
prevent duplicate content
- Add ogType prop to support og:type="article" for blog posts
- Add lastmod dates to sitemap via serialize function
- Expand homepage meta description from 50 to 176 characters for
better SERP snippets
Code Review: Fix Critical SEO Issues with Structured Data and Meta TagsOverall Assessment: Approve with SuggestionsThis PR addresses critical SEO issues with JSON-LD structured data and meta tags. The changes are well-thought-out and follow best practices. However, there are a few concerns and suggestions for improvement. ✅ Strengths1. Correct JSON-LD ImplementationThe fix replacing Before (broken): <script is:inline define:vars={{ siteUrl: SITE_URL }} type="application/ld+json">
{ "@context": "https://schema.org", ... }
</script>After (correct): <script type="application/ld+json" set:html={JSON.stringify(websiteSchema)} />This ensures search engines can properly parse and index the structured data. 2. Category Case Consistency FixChanging 3. Enhanced Meta Tags
🔴 Critical Issues1. Sitemap lastmod Implementation is IncorrectFile: serialize(item) {
// Add lastmod to all sitemap entries
// For blog posts, this will be updated by the build process
// Static pages get the build date
item.lastmod = new Date().toISOString();
return item;
}Problem: This sets
Recommended Fix: serialize(item) {
// item.url contains the full URL, we need to extract post-specific lastmod
// For blog posts, use their updatedDate or pubDate
// For static pages, use build date as fallback
// Note: Astro's sitemap integration doesn't have direct access to content data
// The proper fix requires adding lastmod in the sitemap integration config
// by reading blog post frontmatter during build
// For now, it's better to OMIT lastmod entirely than provide incorrect dates
// Search engines will use HTTP Last-Modified header or crawl frequency instead
return item;
}Alternative Better Approach: Impact: Medium-High - Incorrect
|
The run page remains accessible via direct URL but is no longer linked in the main navigation or homepage links section.
Code ReviewSummaryThis PR addresses critical SEO issues related to structured data, Open Graph metadata, and sitemap improvements. The changes are well-structured and follow best practices for search engine optimization. ✅ Strengths1. JSON-LD Schema Fix (Critical)
2. Open Graph Type Enhancement
3. Sitemap Enhancement
4. Category Case Consistency
5. Meta Description Expansion
🔍 Code Quality Observations1. Clean Refactoring
2. Type Safety
3. Consistent Patterns
|
Summary
is:inline define:varspattern withset:html={JSON.stringify()}in BaseHead.astro and BreadcrumbSchema.astro. The previous pattern wrapped JSON-LD in JavaScript IIFEs, making schemas unparseable by search engines.TypeScripttotypescriptin blog post frontmatter to prevent duplicate category pages (/category/TypeScript/and/category/typescript/were showing different content)ogTypeprop to Layout and BaseHead components; blog posts now correctly usearticleinstead ofwebsite<lastmod>timestamps to all URLsTest plan
npm run build)/sitemap-0.xml