Skip to content

Commit c3d2132

Browse files
committed
use Meta, Schema components
1 parent 061d142 commit c3d2132

File tree

4 files changed

+20
-59
lines changed

4 files changed

+20
-59
lines changed

src/app/layout.tsx

Lines changed: 17 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import "@/once-ui/tokens/index.scss";
33

44
import classNames from "classnames";
55
import { headers } from "next/headers";
6-
import { Metadata } from "next";
76

8-
import { baseURL, style, meta, og, schema, social } from "@/app/resources/config";
9-
import { Background, Column, Flex, ToastProvider, ThemeProvider } from "@/once-ui/components";
7+
import { baseURL, meta, og, schema, style } from "@/app/resources/config";
8+
import { Background, Column, Flex, ThemeProvider, ToastProvider } from "@/once-ui/components";
9+
import { Meta, Schema } from "@/once-ui/modules";
1010

1111
import { Geist } from "next/font/google";
1212
import { Geist_Mono } from "next/font/google";
@@ -36,58 +36,16 @@ const tertiary: FontConfig | undefined = undefined;
3636
/*
3737
*/
3838

39-
export async function generateMetadata(): Promise<Metadata> {
40-
const host = (await headers()).get("host");
41-
const metadataBase = host ? new URL(`https://${host}`) : undefined;
42-
43-
return {
39+
export async function generateMetadata() {
40+
return Meta.generate({
4441
title: meta.title,
4542
description: meta.description,
46-
openGraph: {
47-
title: og.title,
48-
description: og.description,
49-
url: "https://" + baseURL,
50-
images: [
51-
{
52-
url: og.image,
53-
alt: og.title,
54-
},
55-
],
56-
type: og.type as
57-
| "website"
58-
| "article"
59-
| "book"
60-
| "profile"
61-
| "music.song"
62-
| "music.album"
63-
| "music.playlist"
64-
| "music.radio_station"
65-
| "video.movie"
66-
| "video.episode"
67-
| "video.tv_show"
68-
| "video.other",
69-
},
70-
twitter: {
71-
card: "summary_large_image",
72-
title: og.title,
73-
description: og.description,
74-
images: [og.image],
75-
},
76-
metadataBase,
77-
};
43+
baseURL,
44+
path: "/",
45+
image: og.image
46+
});
7847
}
7948

80-
const schemaData = {
81-
"@context": "https://schema.org",
82-
"@type": schema.type,
83-
url: "https://" + baseURL,
84-
logo: schema.logo,
85-
name: schema.name,
86-
description: schema.description,
87-
email: schema.email,
88-
sameAs: Object.values(social).filter(Boolean),
89-
};
90-
9149
export default function RootLayout({
9250
children,
9351
}: Readonly<{
@@ -116,13 +74,15 @@ export default function RootLayout({
11674
tertiary ? tertiary.variable : "",
11775
)}
11876
>
77+
<Schema
78+
as="organization"
79+
title={schema.name}
80+
description={schema.description}
81+
baseURL={baseURL}
82+
path="/"
83+
image={schema.logo}
84+
/>
11985
<head>
120-
<script
121-
type="application/ld+json"
122-
dangerouslySetInnerHTML={{
123-
__html: JSON.stringify(schemaData),
124-
}}
125-
/>
12686
<script
12787
dangerouslySetInnerHTML={{
12888
__html: `

src/app/resources/config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ const meta = {
6363
const og = {
6464
title: meta.title,
6565
description: meta.description,
66-
type: "website",
6766
image: "/images/cover.jpg",
6867
};
6968

src/once-ui/components/MegaMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const MegaMenu: React.FC<MegaMenuProps> = ({ menuGroups, className, ...re
9191

9292
// Check if a menu item should be selected based on the current path
9393
const isSelected = (href?: string) => {
94-
if (!href) return false;
94+
if (!href || !pathname) return false;
9595
return pathname.startsWith(href);
9696
};
9797

src/once-ui/modules/media/MediaUpload.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import React, { useRef, useState, forwardRef, useEffect } from "react";
24
import Compressor from "compressorjs";
35
import { Flex, Icon, SmartImage, Spinner, Text } from "@/once-ui/components";

0 commit comments

Comments
 (0)