diff --git a/package.json b/package.json index 68986ca..e928cb2 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "@unpic/react": "^1.0.2", "@vitejs/plugin-react": "^6.0.1", "framer-motion": "^12.23.9", - "lucide-react": "^0.525.0", "nitro": "^3.0.260415-beta", "react": "^19.1.0", "react-dom": "^19.1.0", diff --git a/src/app/__root.tsx b/src/app/__root.tsx index d686505..232510c 100644 --- a/src/app/__root.tsx +++ b/src/app/__root.tsx @@ -18,7 +18,7 @@ export const Route = createRootRoute({ // OpenGraph { property: "og:title", content: "Mozimo - Premium Artisanal Chocolate" }, { property: "og:description", content: "India's Premier European Style Bean to Bar Chocolate Experience" }, - { property: "og:url", content: "https://mozimo.com" }, + { property: "og:url", content: "https://mozimo.in" }, { property: "og:site_name", content: "Mozimo Chocolate" }, { property: "og:image", content: "/og-image.jpg" }, { property: "og:locale", content: "en_US" }, @@ -43,13 +43,38 @@ export const Route = createRootRoute({ // Preload critical images { rel: 'preload', as: 'image', href: '/banners/slider-1.jpg' }, - { rel: 'preload', as: 'image', href: '/logo/logo.svg' }, - { rel: 'preload', as: 'image', href: '/bst/bs1.svg' }, // DNS prefetch { rel: 'dns-prefetch', href: '//fonts.googleapis.com' }, { rel: 'dns-prefetch', href: '//fonts.gstatic.com' }, ], + scripts: [ + { + src: "https://www.googletagmanager.com/gtag/js?id=AW-16664307519", + async: true, + }, + { + children: ` + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + gtag('config', 'AW-16664307519'); + `, + }, + { + type: 'application/ld+json', + children: JSON.stringify({ + "@context": "https://schema.org", + "@type": "Organization", + "name": "Mozimo Chocolate", + "url": "https://mozimo.in", + "logo": "https://mozimo.in/logo/logo.svg", + "sameAs": [ + "https://www.instagram.com/mozimo_chocolate/" + ] + }) + } + ] }), component: RootLayout, notFoundComponent: () => { @@ -67,9 +92,6 @@ function RootLayout() { - {/* We apply a generic font-sans class or remove Next.js specific font variables. - Since the Inter Google Font is loaded via the stylesheet above, it will automatically apply - if configured in Tailwind CSS. */} diff --git a/src/app/about.tsx b/src/app/about.tsx index feaf8c9..3da9baa 100644 --- a/src/app/about.tsx +++ b/src/app/about.tsx @@ -8,6 +8,15 @@ import { lazy, Suspense } from "react"; const Footer = lazy(() => import("@/components/Footer")); export const Route = createFileRoute('/about')({ component: AboutPage, + head: () => ({ + meta: [ + { title: "About Us - Mozimo Chocolate" }, + { name: "description", content: "Discover the passionate pursuit of crafting exceptional chocolate at Mozimo. We champion cocoa diversity and sustainability." } + ], + links: [ + { rel: "canonical", href: "https://mozimo.in/about" } + ] + }) }); // Premium animation variants diff --git a/src/app/api/instagram.ts b/src/app/api/instagram.ts index 83ec532..c2131c5 100644 --- a/src/app/api/instagram.ts +++ b/src/app/api/instagram.ts @@ -3,6 +3,10 @@ import { createFileRoute } from '@tanstack/react-router'; // Instagram Basic Display API configuration const INSTAGRAM_ACCESS_TOKEN = process.env.INSTAGRAM_ACCESS_TOKEN || 'IGQWRQSUY4b3RQWU9ZARHlVVUFDaWxJZAWFOUVllM0NxMk1zSHJ5X2JGc2dpRUxyTjBaeDNhUm0yaFZAQeUotVU9VUmFEQkJxU25CdFp3bURSZAGtnLXhCZAHVId21SWUNiNjVzc0pjZAlhPNDRxTDFzZAEQ0ZAXoyVlpUaHcZD'; +let cachedPosts: any = null; +let cacheTimestamp = 0; +const CACHE_DURATION = 30 * 60 * 1000; // 30 minutes + interface InstagramPostData { id: string; caption?: string; @@ -25,33 +29,10 @@ export const Route = createFileRoute('/api/instagram')({ ); } - // First, get the user ID using the access token - const userResponse = await fetch( - `https://graph.instagram.com/me?fields=id,username&access_token=${INSTAGRAM_ACCESS_TOKEN}` - ); - - if (!userResponse.ok) { - const errorText = await userResponse.text(); - console.error('Failed to fetch user info:', errorText); - - // Check if token is expired - if (errorText.includes('Session has expired') || errorText.includes('code":190')) { - return Response.json( - { - error: 'Instagram access token has expired', - details: 'The access token needs to be refreshed. Please generate a new token from Instagram Developer Console.', - code: 'TOKEN_EXPIRED' - }, - { status: 401 } - ); - } - - throw new Error('Failed to authenticate with Instagram'); + if (cachedPosts && Date.now() - cacheTimestamp < CACHE_DURATION) { + return Response.json({ posts: cachedPosts }); } - const userData = await userResponse.json(); - console.log('Instagram user data:', userData); - // Fetch user's media (posts) const mediaResponse = await fetch( `https://graph.instagram.com/me/media?fields=id,caption,media_type,media_url,thumbnail_url,permalink,timestamp&access_token=${INSTAGRAM_ACCESS_TOKEN}&limit=6` @@ -89,6 +70,9 @@ export const Route = createFileRoute('/api/instagram')({ timestamp: post.timestamp })); + cachedPosts = posts; + cacheTimestamp = Date.now(); + return Response.json({ posts }); } catch (error) { console.error('Instagram API Error:', error); diff --git a/src/app/index.tsx b/src/app/index.tsx index 04c5ac8..6bff0a8 100644 --- a/src/app/index.tsx +++ b/src/app/index.tsx @@ -12,6 +12,11 @@ const Footer = lazy(() => import("@/components/Footer")); export const Route = createFileRoute('/')({ component: Home, + head: () => ({ + links: [ + { rel: "canonical", href: "https://mozimo.in/" } + ] + }) }); // Premium animation variants diff --git a/yarn.lock b/yarn.lock index e0f7de9..0bcdca1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2815,11 +2815,6 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -lucide-react@^0.525.0: - version "0.525.0" - resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.525.0.tgz#5f7bcecd65e4f9b2b5b6b5d295e3376df032d5e3" - integrity sha512-Tm1txJ2OkymCGkvwoHt33Y2JpN5xucVq1slHcgE6Lk0WjDfjgKWor5CdVER8U6DvcfMwh4M8XxmpTiyzfmfDYQ== - magic-string@^0.30.21: version "0.30.21" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.21.tgz#56763ec09a0fa8091df27879fd94d19078c00d91"