Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ export default async function BlogPost({ params }: BlogPostProps) {
const title = metadata.title;
const description = metadata.description || `${title} — an engineer's take on building real software. From CyberWorld Builders.`;

// Ensure schema image URL is absolute — relative URLs fail structured-data validation.
const toAbsoluteUrl = (path?: string) =>
!path ? null : path.startsWith('http') ? path : `https://cyberworldbuilders.com${path}`;
const schemaImageUrl =
toAbsoluteUrl(metadata.socialImage) ||
toAbsoluteUrl(metadata.headerImage) ||
'https://cyberworldbuilders.com/images/logo.png';

// Build allPosts list for related posts and navigation
const allPostEntries = getAllPosts();
const allPosts = allPostEntries.map(p => ({
Expand Down Expand Up @@ -153,14 +161,12 @@ export default async function BlogPost({ params }: BlogPostProps) {
{new Date(metadata.publishedDate).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
</time>
</p>
{metadata.modifiedDate && metadata.modifiedDate !== metadata.publishedDate && (
<p className="text-[#00ff00]/50 text-xs">
Updated{' '}
<time dateTime={metadata.modifiedDate}>
{new Date(metadata.modifiedDate).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
</time>
</p>
)}
<p className="text-[#00ff00]/50 text-xs">
Last updated{' '}
<time dateTime={metadata.modifiedDate || metadata.publishedDate}>
{new Date(metadata.modifiedDate || metadata.publishedDate).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
</time>
</p>
</div>
</div>
</div>
Expand All @@ -174,7 +180,12 @@ export default async function BlogPost({ params }: BlogPostProps) {
"@type": "BlogPosting",
headline: title,
description,
image: metadata.socialImage || "https://cyberworldbuilders.com/images/logo.png",
image: {
"@type": "ImageObject",
url: schemaImageUrl,
width: 1200,
height: 630,
},
author: {
"@type": "Person",
name: "Jay Long",
Expand Down
28 changes: 25 additions & 3 deletions app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,14 @@ export default async function BlogIndex({ searchParams }: BlogIndexProps) {
</div>
)}

{/* CollectionPage Schema with freshness signals */}
{/* Blog schema with embedded BlogPosting entries — gives crawlers explicit
BlogPosting markup on the listing page in addition to per-post pages. */}
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@type": "CollectionPage",
"@type": "Blog",
name: tagFilter
? `Posts tagged with "${tagFilter}" - CyberWorld Builders Blog`
: "Blog — Real Engineering, Not AI Fluff | CyberWorld Builders",
Expand All @@ -201,8 +202,29 @@ export default async function BlogIndex({ searchParams }: BlogIndexProps) {
publisher: {
"@type": "Organization",
name: "CyberWorld Builders",
logo: { "@type": "ImageObject", url: "https://cyberworldbuilders.com/images/logo.png" },
logo: { "@type": "ImageObject", url: "https://cyberworldbuilders.com/images/logo.png", width: 250, height: 250 },
},
blogPost: posts.map((p) => {
const headerImage = p.headerImage && p.headerImage.trim() !== ''
? (p.headerImage.startsWith('http') ? p.headerImage : `https://cyberworldbuilders.com${p.headerImage}`)
: 'https://cyberworldbuilders.com/images/logo.png';
return {
"@type": "BlogPosting",
headline: p.title,
description: p.description,
url: `https://cyberworldbuilders.com/blog/${p.slug}`,
mainEntityOfPage: { "@type": "WebPage", "@id": `https://cyberworldbuilders.com/blog/${p.slug}` },
datePublished: p.mtime.toISOString(),
dateModified: new Date(p.modifiedDate || p.mtime.toISOString()).toISOString(),
image: { "@type": "ImageObject", url: headerImage, width: 1200, height: 630 },
author: { "@type": "Person", name: "Jay Long", url: "https://cyberworldbuilders.com" },
publisher: {
"@type": "Organization",
name: "CyberWorld Builders",
logo: { "@type": "ImageObject", url: "https://cyberworldbuilders.com/images/logo.png", width: 250, height: 250 },
},
};
}),
mainEntity: {
"@type": "ItemList",
numberOfItems: allPosts.length,
Expand Down
Loading