- Changed favicon and logo references to ONYXSimple - Updated package.json to modify start command and add deploy scripts - Adjusted layout and page metadata to reflect ONYXSimple branding - Enhanced marquee animation with dynamic duration - Added robots.txt and sitemap.xml for SEO - Refactored various components for consistency and clarity
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import type { Metadata } from 'next'
|
|
|
|
import type { Media, Page, Post, Config } from '../payload-types'
|
|
|
|
import { mergeOpenGraph } from './mergeOpenGraph'
|
|
import { getServerSideURL } from './getURL'
|
|
|
|
const getImageURL = (image?: Media | Config['db']['defaultIDType'] | null) => {
|
|
const serverUrl = getServerSideURL()
|
|
|
|
let url = serverUrl + '/website-template-OG.webp'
|
|
|
|
if (image && typeof image === 'object' && 'url' in image) {
|
|
const ogUrl = image.sizes?.og?.url
|
|
|
|
url = ogUrl ? serverUrl + ogUrl : serverUrl + image.url
|
|
}
|
|
|
|
return url
|
|
}
|
|
|
|
export const generateMeta = async (args: {
|
|
doc: Partial<Page> | Partial<Post> | null
|
|
}): Promise<Metadata> => {
|
|
const { doc } = args
|
|
|
|
const ogImage = getImageURL(doc?.meta?.image)
|
|
|
|
const title = doc?.meta?.title
|
|
? doc?.meta?.title + ' | ONYXSimple'
|
|
: 'ONYXSimple'
|
|
|
|
return {
|
|
description: doc?.meta?.description,
|
|
openGraph: mergeOpenGraph({
|
|
description: doc?.meta?.description || '',
|
|
images: ogImage
|
|
? [
|
|
{
|
|
url: ogImage,
|
|
},
|
|
]
|
|
: undefined,
|
|
title,
|
|
url: Array.isArray(doc?.slug) ? doc?.slug.join('/') : '/',
|
|
}),
|
|
title,
|
|
}
|
|
}
|