feat: add basic webui
This commit is contained in:
15
packages/seo/json-ld.tsx
Normal file
15
packages/seo/json-ld.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { Thing, WithContext } from 'schema-dts';
|
||||
|
||||
type JsonLdProps = {
|
||||
code: WithContext<Thing>;
|
||||
};
|
||||
|
||||
export const JsonLd = ({ code }: JsonLdProps) => (
|
||||
<script
|
||||
type="application/ld+json"
|
||||
// biome-ignore lint/security/noDangerouslySetInnerHtml: "This is a JSON-LD script, not user-generated content."
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(code) }}
|
||||
/>
|
||||
);
|
||||
|
||||
export * from 'schema-dts';
|
||||
67
packages/seo/metadata.ts
Normal file
67
packages/seo/metadata.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import merge from 'lodash.merge';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
type MetadataGenerator = Omit<Metadata, 'description' | 'title'> & {
|
||||
title: string;
|
||||
description: string;
|
||||
image?: string;
|
||||
};
|
||||
|
||||
const applicationName = 'next-forge';
|
||||
const author: Metadata['authors'] = {
|
||||
name: 'Hayden Bleasel',
|
||||
url: 'https://haydenbleasel.com/',
|
||||
};
|
||||
const publisher = 'Hayden Bleasel';
|
||||
const twitterHandle = '@haydenbleasel';
|
||||
|
||||
export const createMetadata = ({
|
||||
title,
|
||||
description,
|
||||
image,
|
||||
...properties
|
||||
}: MetadataGenerator): Metadata => {
|
||||
const parsedTitle = `${title} | ${applicationName}`;
|
||||
const defaultMetadata: Metadata = {
|
||||
title: parsedTitle,
|
||||
description,
|
||||
applicationName,
|
||||
authors: [author],
|
||||
creator: author.name,
|
||||
formatDetection: {
|
||||
telephone: false,
|
||||
},
|
||||
appleWebApp: {
|
||||
capable: true,
|
||||
statusBarStyle: 'default',
|
||||
title: parsedTitle,
|
||||
},
|
||||
openGraph: {
|
||||
title: parsedTitle,
|
||||
description,
|
||||
type: 'website',
|
||||
siteName: applicationName,
|
||||
locale: 'en_US',
|
||||
},
|
||||
publisher,
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
creator: twitterHandle,
|
||||
},
|
||||
};
|
||||
|
||||
const metadata: Metadata = merge(defaultMetadata, properties);
|
||||
|
||||
if (image && metadata.openGraph) {
|
||||
metadata.openGraph.images = [
|
||||
{
|
||||
url: image,
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: title,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return metadata;
|
||||
};
|
||||
22
packages/seo/package.json
Normal file
22
packages/seo/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@konobangu/seo",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"clean": "git clean -xdf .cache .turbo dist node_modules",
|
||||
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash.merge": "^4.6.2",
|
||||
"react": "^19.0.0",
|
||||
"schema-dts": "^1.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@konobangu/typescript-config": "workspace:*",
|
||||
"@types/lodash.merge": "^4.6.9",
|
||||
"@types/node": "22.10.1",
|
||||
"@types/react": "19.0.1",
|
||||
"@types/react-dom": "^19.0.2",
|
||||
"next": "^15.1.3"
|
||||
}
|
||||
}
|
||||
8
packages/seo/tsconfig.json
Normal file
8
packages/seo/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@konobangu/typescript-config/react-library.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
},
|
||||
"include": ["**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user