Skip to content

Commit

Permalink
fix: dupplicates seo
Browse files Browse the repository at this point in the history
  • Loading branch information
thedaviddias committed Feb 11, 2025
1 parent 604f2a5 commit 95e4c3e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
18 changes: 14 additions & 4 deletions app/[lang]/[[...mdxPath]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,28 @@ export async function generateMetadata({ params }): Promise<Metadata> {
const description = frontMatter?.description || metadata?.description || ''
const summary = frontMatter?.summary || ''

// OG image handling
// Page type detection
const isPatternPage = params.mdxPath?.[0] === 'patterns'
const isGlossaryPage = params.mdxPath?.[0] === 'glossary'

// Title with context
const titleWithContext = isPatternPage
? `${title} Pattern`
: isGlossaryPage
? `${title} - UX Glossary Term`
: title

// OG image handling
const patternName = isPatternPage ? params.mdxPath?.[params.mdxPath.length - 1] : null
const ogImageUrl = isHomepage
? '/og/opengraph-image.png'
: `/api/og?title=${encodeURIComponent(title)}`
: `/api/og?title=${encodeURIComponent(titleWithContext)}`

return {
title,
title: titleWithContext,
description,
openGraph: {
title,
title: titleWithContext,
description,
type: isHomepage ? 'website' : 'article',
images: isPatternPage && patternName ? [{
Expand Down
2 changes: 1 addition & 1 deletion content/en/glossary/pagination.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { GlossaryStructuredData } from "@app/_components/glossary/structured-dat
category={["Pattern", "Navigation"]}
/>

# Pagination
# Pagination in UX Design

Pagination is a fundamental user interface pattern that divides large sets of content into smaller, more manageable chunks called "pages". This pattern helps users navigate through extensive collections of data, such as search results, product listings, or blog posts.

Expand Down
4 changes: 4 additions & 0 deletions content/en/patterns/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: UX Patterns for Devs is a comprehensive resource that helps developers implement effective, accessible, and usable UI components
---

import { Link } from "nextra-theme-docs";
import { Callout, FileTree, Steps } from "nextra/components";

Expand Down

0 comments on commit 95e4c3e

Please sign in to comment.