From 4ca1cc9605e0761d18b692157013a1b05a17c21f Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 14 Mar 2026 15:17:16 -0400 Subject: [PATCH] chore: refactor post layout for atUri - Added `atUri` to `content.config.ts` - Updated types for `BaseHead` - Passed `atUri` through post layout and base head to create `` tags when present --- package.json | 1 - src/components/layout/BaseHead.astro | 6 ++++-- src/content.config.ts | 3 ++- src/layouts/PostLayout.astro | 3 ++- src/types/component.types.ts | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b1771c7..4e1a5bd 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "dev": "astro dev", "prebuild": "pnpm exec tsx scripts/toggle-proxy.ts", "build": "pnpm run prebuild && astro build", - "postbuild": "sequoia inject", "preview": "astro preview", "astro": "astro", "lint": "eslint .", diff --git a/src/components/layout/BaseHead.astro b/src/components/layout/BaseHead.astro index 3087f1d..aa16c53 100644 --- a/src/components/layout/BaseHead.astro +++ b/src/components/layout/BaseHead.astro @@ -7,7 +7,7 @@ import 'katex/dist/katex.min.css' const canonicalURL = new URL(Astro.url.pathname, Astro.site) -const { title, description, ogImage } = Astro.props as BaseHeadProps +const { title, description, ogImage, atUri } = Astro.props as BaseHeadProps const imageUrl = ogImage ? new URL(ogImage, Astro.url) : new URL('/og/chiri-og.png', Astro.url) --- @@ -25,6 +25,8 @@ const imageUrl = ogImage ? new URL(ogImage, Astro.url) : new URL('/og/chiri-og.p +{atUri && } + {title || themeConfig.site.title} @@ -55,4 +57,4 @@ const imageUrl = ogImage ? new URL(ogImage, Astro.url) : new URL('/og/chiri-og.p gtag('js', new Date()); gtag('config', 'G-QG1BRT6R0V'); -</script> \ No newline at end of file +</script> diff --git a/src/content.config.ts b/src/content.config.ts index a8be435..161246e 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -10,7 +10,8 @@ const posts = defineCollection({ title: z.string(), // Transform string to Date object pubDate: z.coerce.date(), - image: z.string().optional() + image: z.string().optional(), + atUri: z.string().optional() }) }) diff --git a/src/layouts/PostLayout.astro b/src/layouts/PostLayout.astro index 9fce407..81654ab 100644 --- a/src/layouts/PostLayout.astro +++ b/src/layouts/PostLayout.astro @@ -19,7 +19,7 @@ import BaseLayout from '@/layouts/BaseLayout.astro' import { themeConfig } from '@/config' -const { title, pubDate, readingTime, toc, image} = Astro.props as PostLayoutProps +const { title, pubDate, readingTime, toc, image, atUri} = Astro.props as PostLayoutProps const postSlug = Astro.url.pathname.split('/').filter(Boolean).pop() || '' const backupImage = `/open-graph/${postSlug}.png` @@ -31,6 +31,7 @@ const backupImage = `/open-graph/${postSlug}.png` description={themeConfig.site.description} ogImage={image ? image : backupImage} slot="head" + atUri={atUri} /> <div class="post-container"> <main> diff --git a/src/types/component.types.ts b/src/types/component.types.ts index 045bc20..bd95ef3 100644 --- a/src/types/component.types.ts +++ b/src/types/component.types.ts @@ -31,6 +31,7 @@ export interface BaseHeadProps { title: string description: string ogImage?: string + atUri?: string } // ImageOptimizer component props interface -- 2.51.2