--- import LoadingIndicator from 'astro-loading-indicator/component' import { Schema } from 'astro-seo-schema' import { ClientRouter } from 'astro:transitions' import { isNotArray } from '../lib/arrays' import { DEPLOYMENT_MODE } from '../lib/envVariables' import HtmxScript from './HtmxScript.astro' import { makeOgImageUrl } from './OgImage' import TailwindJsPluggin from './TailwindJsPluggin.astro' import type { ComponentProps } from 'astro/types' import type { WithContext, BreadcrumbList, ListItem } from 'schema-dts' export type BreadcrumArray = [ ...{ name: string url: string }[], { name: string url?: string }, ] type Props = { pageTitle: string /** * Whether to enable htmx. * * @default false */ htmx?: boolean /** * Page meta description * * @default 'KYCnot.me helps you find services without KYC for better privacy and control over your data.' */ description?: string /** * Open Graph image. * - If `string` is provided, it will be used as the image URL. * - If `{ template: string, ...props }` is provided, it will be used to generate an Open Graph image based on the template. */ ogImage?: Parameters[0] schemas?: ComponentProps['item'][] breadcrumbs?: BreadcrumArray | BreadcrumArray[] } const { pageTitle, htmx = false, description = 'KYCnot.me helps you find services without KYC for better privacy and control over your data.', ogImage, schemas, breadcrumbs, } = Astro.props const breadcrumbLists = breadcrumbs?.every(Array.isArray) ? (breadcrumbs as BreadcrumArray[]) : breadcrumbs?.every(isNotArray) ? [breadcrumbs] : [] const modeName = DEPLOYMENT_MODE === 'production' ? '' : DEPLOYMENT_MODE === 'staging' ? 'PRE' : 'DEV' const fullTitle = `${pageTitle} | KYCnot.me ${modeName}` const ogImageUrl = makeOgImageUrl(ogImage, Astro.url) --- {DEPLOYMENT_MODE === 'development' && } {DEPLOYMENT_MODE === 'staging' && } {fullTitle} {!!ogImageUrl && } {!!ogImageUrl && } {htmx && } {schemas?.map((item) => )} { breadcrumbLists.map((breadcrumbList) => ( ({ '@type': 'ListItem', position: index + 1, name: item.name, item: item.url ? new URL(item.url, Astro.url).href : undefined, }) satisfies ListItem ), } satisfies WithContext } /> )) }