diff --git a/apps/www/app/(blog)/blog/[...slug]/page.tsx b/apps/www/app/(blog)/blog/[...slug]/page.tsx index 59dc89466..5fff4ca24 100644 --- a/apps/www/app/(blog)/blog/[...slug]/page.tsx +++ b/apps/www/app/(blog)/blog/[...slug]/page.tsx @@ -4,14 +4,15 @@ import Link from "next/link" import { notFound } from "next/navigation" import { mdxComponents } from "@/mdx-components" import { ArrowLeftIcon } from "lucide-react" -import { Badge } from "@/components/ui/badge" import type { BlogPosting, BreadcrumbList, WithContext } from "schema-dts" + import { siteConfig } from "@/config/site" import { blogSource } from "@/lib/source" import { absoluteUrl, calculateReadingTime, formatDate } from "@/lib/utils" +import { Badge } from "@/components/ui/badge" import { buttonVariants } from "@/components/ui/button" -import { BlogTableOfContents } from "@/components/blog/table-of-contents" import { MobileTOC } from "@/components/blog/mobile-toc" +import { BlogTableOfContents } from "@/components/blog/table-of-contents" import { SidebarCTA } from "@/components/sidebar-cta" export const revalidate = false @@ -188,7 +189,7 @@ export default async function BlogPage({ params }: PageProps) { {doc.title}
@@ -219,14 +220,16 @@ export default async function BlogPage({ params }: PageProps) { return ( tags.length > 0 && ( -
+
{tags.map((tag) => ( - + {tag} diff --git a/apps/www/app/(blog)/blog/page.tsx b/apps/www/app/(blog)/blog/page.tsx index 658c8c601..6f3164f3c 100644 --- a/apps/www/app/(blog)/blog/page.tsx +++ b/apps/www/app/(blog)/blog/page.tsx @@ -127,7 +127,7 @@ export default async function Page({ __html: serializedBreadcrumbStructuredData, }} /> -
+

Blog

@@ -202,20 +202,20 @@ export default async function Page({ > {post.data?.image && ( -
+
{post.data?.title
)}
-

+

{post.data?.title ?? post.url}

{post.data?.description && ( @@ -239,15 +239,17 @@ export default async function Page({ {normalizeTag(post.data?.tags).length > 0 && (
- {normalizeTag(post.data.tags).slice(0, 3).map((tag) => ( - - {tag} - - ))} + {normalizeTag(post.data.tags) + .slice(0, 3) + .map((tag) => ( + + {tag} + + ))}
)}
diff --git a/apps/www/app/(docs)/docs/[[...slug]]/page.tsx b/apps/www/app/(docs)/docs/[[...slug]]/page.tsx index 0be40074a..c5251a1be 100644 --- a/apps/www/app/(docs)/docs/[[...slug]]/page.tsx +++ b/apps/www/app/(docs)/docs/[[...slug]]/page.tsx @@ -55,9 +55,16 @@ export async function generateMetadata({ const url = process.env.NEXT_PUBLIC_APP_URL - const ogUrl = new URL(`${url}/og`) - ogUrl.searchParams.set("title", doc.title ?? "") - ogUrl.searchParams.set("description", doc.description ?? "") + let ogUrl: URL | null = null + try { + if (url) { + ogUrl = new URL(`${url}/og`) + ogUrl.searchParams.set("title", doc.title ?? "") + ogUrl.searchParams.set("description", doc.description ?? "") + } + } catch { + // Invalid URL, will use default + } return { title: `${doc.title} | React Components & Templates`, @@ -67,19 +74,21 @@ export async function generateMetadata({ description: doc.description, type: "article", url: absoluteUrl(page.url), - images: [ - { - url: ogUrl.toString(), - width: 1200, - height: 630, - }, - ], + images: ogUrl + ? [ + { + url: ogUrl.toString(), + width: 1200, + height: 630, + }, + ] + : [], }, twitter: { card: "summary_large_image", title: doc.title, description: doc.description, - images: [ogUrl.toString()], + images: ogUrl ? [ogUrl.toString()] : [], creator: "@dillionverma", }, } diff --git a/apps/www/components/blog/table-of-contents.tsx b/apps/www/components/blog/table-of-contents.tsx index 557b1e62d..6a65bca64 100644 --- a/apps/www/components/blog/table-of-contents.tsx +++ b/apps/www/components/blog/table-of-contents.tsx @@ -16,10 +16,10 @@ const generateHeadingId = (text: string) => { .trim() } -export function BlogTableOfContents({ +export function BlogTableOfContents({ className, onLinkClick, -}: { +}: { className?: string onLinkClick?: () => void }) { diff --git a/apps/www/components/docs-copy-page.tsx b/apps/www/components/docs-copy-page.tsx index 33774c179..acc26a8c6 100644 --- a/apps/www/components/docs-copy-page.tsx +++ b/apps/www/components/docs-copy-page.tsx @@ -41,8 +41,8 @@ export function DocsCopyPage({ page, url }: { page: string; url: string }) { let pathname = "/docs" try { pathname = new URL(url).pathname - } catch (e) { - console.error(e) + } catch { + // Invalid URL provided, using default pathname } const menuItems: Record React.ReactNode> = { viewMarkdown: () => { diff --git a/apps/www/components/posthog-provider.tsx b/apps/www/components/posthog-provider.tsx index f809492eb..c07e23bd4 100644 --- a/apps/www/components/posthog-provider.tsx +++ b/apps/www/components/posthog-provider.tsx @@ -5,8 +5,8 @@ import { usePathname, useSearchParams } from "next/navigation" import posthog from "posthog-js" import { PostHogProvider } from "posthog-js/react" -if (typeof window !== "undefined") { - posthog.init(process.env.NEXT_PUBLIC_POSTHOG_API_KEY!, { +if (typeof window !== "undefined" && process.env.NEXT_PUBLIC_POSTHOG_API_KEY) { + posthog.init(process.env.NEXT_PUBLIC_POSTHOG_API_KEY, { api_host: "https://app.posthog.com", capture_pageview: true, session_recording: { diff --git a/apps/www/components/sidebar-cta.tsx b/apps/www/components/sidebar-cta.tsx index 7e4a79ae5..267739a95 100644 --- a/apps/www/components/sidebar-cta.tsx +++ b/apps/www/components/sidebar-cta.tsx @@ -28,7 +28,20 @@ export function ProCTA() { Faster {" "} - with Magic UI Pro + with{" "} + + Magic UI Pro +

Stop building from scratch.
Get{" "} @@ -45,20 +58,20 @@ export function ProCTA() {

-
- +
+
Next.js 15 + TypeScript ready
-
- +
+
Copy, paste, customize in minutes
-
- +
+
Save 100+ hours of development
diff --git a/apps/www/content/blog/typescript-vs-javascript-differences.mdx b/apps/www/content/blog/typescript-vs-javascript-differences.mdx index 04ecda5d5..86d260d31 100644 --- a/apps/www/content/blog/typescript-vs-javascript-differences.mdx +++ b/apps/www/content/blog/typescript-vs-javascript-differences.mdx @@ -39,7 +39,7 @@ This comparison isn't about crowning a winner. It’s about helping you make the
- + - + @@ -73,7 +73,7 @@ This comparison isn't about crowning a winner. It’s about helping you make the maintainability. - + @@ -84,7 +84,7 @@ This comparison isn't about crowning a winner. It’s about helping you make the Catches type-related errors during compilation, before code is run. - + diff --git a/apps/www/content/docs/components/highlighter.mdx b/apps/www/content/docs/components/highlighter.mdx index e295c153b..18ec08a7b 100644 --- a/apps/www/content/docs/components/highlighter.mdx +++ b/apps/www/content/docs/components/highlighter.mdx @@ -51,7 +51,7 @@ import { Highlighter } from "@/components/ui/highlighter" Magic UI Highlighter {" "} makes important{" "} - + text stand out {" "} effortlessly. diff --git a/apps/www/mdx-components.tsx b/apps/www/mdx-components.tsx index 35f658e7c..94ef6cf06 100644 --- a/apps/www/mdx-components.tsx +++ b/apps/www/mdx-components.tsx @@ -100,10 +100,7 @@ export const mdxComponents = { /> ), p: ({ className, ...props }: React.ComponentProps<"p">) => ( -

+

), strong: ({ className, ...props }: React.HTMLAttributes) => ( @@ -119,7 +116,10 @@ export const mdxComponents = { ), blockquote: ({ className, ...props }: React.ComponentProps<"blockquote">) => (

), @@ -128,40 +128,30 @@ export const mdxComponents = { {alt} ), iframe: ({ className, ...props }: React.ComponentProps<"iframe">) => ( -
Project Scope
Error Detection
Developer Experience