SEO Enhancement - agiusalexandre.com
Blog posts weren't appearing correctly in search results or showing rich previews when shared on social media.
The Problem
My blog posts weren’t appearing correctly in search results. When shared on social media, they showed generic previews instead of article-specific information. The site lacked the meta infrastructure that search engines and social platforms need to properly index and display content.
The Solution
Built a dedicated BlogLayout.astro component that wraps blog posts with comprehensive SEO infrastructure:
- Open Graph tags for Facebook/LinkedIn previews
- Twitter Card tags for Twitter previews
- JSON-LD structured data for Google rich snippets
- Canonical URLs to prevent duplicate content issues
How It Works
The JSON-LD structured data provides rich context to search engines:
const jsonLd = {
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": title,
"description": description,
"image": ogImage,
"datePublished": isoDate,
"dateModified": isoDate,
"author": {
"@type": "Person",
"name": authorName,
"url": authorLinkedIn,
"jobTitle": "Senior Solutions Architect",
"worksFor": {
"@type": "Organization",
"name": "Amazon Web Services"
}
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": canonicalUrl
}
};
Open Graph tags ensure proper social sharing previews:
<!-- Open Graph / Facebook -->
<meta property="og:type" content="article" />
<meta property="og:url" content={canonicalUrl} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={ogImage} />
<!-- Article specific Open Graph -->
<meta property="article:published_time" content={isoDate} />
<meta property="article:author" content={authorLinkedIn} />
{tags.map(tag => (
<meta property="article:tag" content={tag} />
))}
Key Files Changed
| File | Change |
|---|---|
src/layouts/BlogLayout.astro | New SEO-optimized layout with full meta tags |
src/pages/blog/[...slug].astro | Updated to use BlogLayout |
What I Learned
- Astro’s component model works well for SEO — The layout system allows centralized SEO configuration while keeping individual pages clean
- JSON-LD is straightforward to implement — Using JavaScript objects that serialize to JSON makes structured data easy to maintain
- Article-specific OG tags matter —
article:published_timeandarticle:tagprovide richer context than genericog:tags
What’s Next
- Add sitemap.xml generation for search engine crawling
- Implement RSS feed for blog subscribers
- Add structured data testing with Google’s Rich Results Test
Related Posts
Tag Filtering - agiusalexandre.com
Blog readers needed a way to browse content by topic instead of scrolling through all posts.
DevelopmentBrowser Automation Agents - Amazon Bedrock AgentCore
Enterprise workflows often require interacting with web applications that lack APIs. Traditional automation scripts are brittle and break when UIs change.
DevelopmentAWS Backup Cost Analysis
EBS snapshot costs were growing month-over-month with no clear explanation or optimization strategy.
