Merge pull request #534 from sarinali/fix/seo-domain-fix

fix/SEO canonical URL + other optimizations
This commit is contained in:
James Murdza
2025-10-29 16:51:28 -07:00
committed by GitHub
4 changed files with 276 additions and 15 deletions

View File

@@ -273,15 +273,99 @@ export async function generateMetadata(props: {
if (page.url.includes('api')) title = `${page.data.title} | Cua API Docs`;
if (page.url.includes('guide')) title = ` Guide: ${page.data.title} | Cua Docs`;
// Canonical URL points to cua.ai to consolidate all SEO authority on main domain
const canonicalUrl = `https://cua.ai${page.url}`;
// Extract keywords from the page for SEO
const keywords = [
'computer use agent',
'computer use',
'AI automation',
'visual automation',
page.data.title,
];
// Structured data for better Google indexing (TechArticle schema)
const structuredData = {
'@context': 'https://schema.org',
'@type': 'TechArticle',
headline: page.data.title,
description: page.data.description,
url: canonicalUrl,
publisher: {
'@type': 'Organization',
name: 'Cua',
url: 'https://cua.ai',
logo: {
'@type': 'ImageObject',
url: 'https://cua.ai/cua_logo_black.svg',
},
},
mainEntityOfPage: {
'@type': 'WebPage',
'@id': canonicalUrl,
},
};
// Breadcrumb schema for better site structure understanding
const breadcrumbSchema = {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
itemListElement: [
{
'@type': 'ListItem',
position: 1,
name: 'Cua',
item: 'https://cua.ai',
},
{
'@type': 'ListItem',
position: 2,
name: 'Documentation',
item: 'https://cua.ai/docs',
},
{
'@type': 'ListItem',
position: 3,
name: page.data.title,
item: canonicalUrl,
},
],
};
return {
title,
description: page.data.description,
keywords,
authors: [{ name: 'Cua', url: 'https://cua.ai' }],
robots: {
index: true,
follow: true,
googleBot: {
index: true,
follow: true,
'max-image-preview': 'large',
'max-snippet': -1,
},
},
alternates: {
canonical: canonicalUrl,
},
openGraph: {
title,
description: page.data.description,
type: 'article',
siteName: 'Cua Docs',
url: 'https://trycua.com/docs',
url: canonicalUrl,
},
twitter: {
card: 'summary',
title,
description: page.data.description,
creator: '@trycua',
},
other: {
'script:ld+json': JSON.stringify([structuredData, breadcrumbSchema]),
},
};
}

View File

@@ -41,15 +41,15 @@ export const baseOptions: BaseLayoutProps = {
githubUrl: 'https://github.com/trycua/cua',
links: [
{
url: 'https://trycua.com',
text: 'Cua home',
url: 'https://cua.ai',
text: 'Cua Home',
type: 'icon',
icon: <HomeIcon />,
external: false,
external: true,
},
{
url: 'https://discord.com/invite/mVnXXpdE85',
text: 'Cua discord',
text: 'Discord',
type: 'icon',
icon: (
<>
@@ -69,6 +69,7 @@ export const baseOptions: BaseLayoutProps = {
/>
</>
),
external: true,
},
],
};

32
docs/src/app/sitemap.ts Normal file
View File

@@ -0,0 +1,32 @@
import { MetadataRoute } from 'next';
import { source } from '@/lib/source';
export default function sitemap(): MetadataRoute.Sitemap {
const baseUrl = 'https://cua.ai';
// Get all pages from fumadocs source
const pages = source.getPages();
// Map pages to sitemap entries with /docs prefix
const docPages = pages.map((page) => {
// Ensure URL starts with /docs
const url = page.url.startsWith('/docs') ? page.url : `/docs${page.url}`;
return {
url: `${baseUrl}${url}`,
lastModified: new Date(),
changeFrequency: 'weekly' as const,
priority: url === '/docs' ? 1.0 : 0.8,
};
});
// Add main docs page if not included
const mainDocsPage = {
url: `${baseUrl}/docs`,
lastModified: new Date(),
changeFrequency: 'weekly' as const,
priority: 1.0,
};
return [mainDocsPage, ...docPages];
}

View File

@@ -1,15 +1,159 @@
export function Footer() {
return (
<footer className="mt-auto border-t border-fd-border py-4">
<div className="container mx-auto px-4 flex justify-end">
<a
href="https://www.cua.ai/cookie-policy"
target="_blank"
rel="noopener noreferrer"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Cookie Policy
</a>
<footer className="mt-auto border-t border-fd-border py-8">
<div className="container mx-auto px-4">
<div className="grid grid-cols-1 md:grid-cols-4 gap-8 mb-6">
{/* Product Links */}
<div>
<h3 className="font-semibold text-sm mb-3 text-fd-foreground">Product</h3>
<ul className="space-y-2">
<li>
<a
href="https://cua.ai"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Home
</a>
</li>
<li>
<a
href="https://cua.ai/pricing"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Pricing
</a>
</li>
<li>
<a
href="https://cua.ai/#features"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Features
</a>
</li>
</ul>
</div>
{/* Documentation Links */}
<div>
<h3 className="font-semibold text-sm mb-3 text-fd-foreground">Documentation</h3>
<ul className="space-y-2">
<li>
<a
href="/docs"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Getting Started
</a>
</li>
<li>
<a
href="/docs/agent-sdk/agent-loops"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Agent Loops
</a>
</li>
<li>
<a
href="/docs/quickstart-devs"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Quick Start
</a>
</li>
</ul>
</div>
{/* Resources Links */}
<div>
<h3 className="font-semibold text-sm mb-3 text-fd-foreground">Resources</h3>
<ul className="space-y-2">
<li>
<a
href="https://cua.ai/blog"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Blog
</a>
</li>
<li>
<a
href="https://github.com/trycua/cua"
target="_blank"
rel="noopener noreferrer"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
GitHub
</a>
</li>
<li>
<a
href="https://discord.com/invite/mVnXXpdE85"
target="_blank"
rel="noopener noreferrer"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Discord Community
</a>
</li>
</ul>
</div>
{/* Company Links */}
<div>
<h3 className="font-semibold text-sm mb-3 text-fd-foreground">Company</h3>
<ul className="space-y-2">
<li>
<a
href="https://cua.ai/about"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
About
</a>
</li>
<li>
<a
href="mailto:hello@trycua.com"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Contact
</a>
</li>
<li>
<a
href="https://cua.ai/cookie-policy"
target="_blank"
rel="noopener noreferrer"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Cookie Policy
</a>
</li>
</ul>
</div>
</div>
{/* Bottom Bar */}
<div className="pt-6 border-t border-fd-border flex flex-col md:flex-row justify-between items-center gap-4">
<p className="text-sm text-fd-muted-foreground">
© {new Date().getFullYear()} Cua. All rights reserved.
</p>
<div className="flex gap-4">
<a
href="https://cua.ai/privacy"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Privacy Policy
</a>
<a
href="https://cua.ai/terms"
className="text-sm text-fd-muted-foreground hover:text-fd-foreground transition-colors"
>
Terms of Service
</a>
</div>
</div>
</div>
</footer>
);